Package com.forgerock.opendj.util
Class ASCIICharProp
- java.lang.Object
-
- com.forgerock.opendj.util.ASCIICharProp
-
- All Implemented Interfaces:
Comparable<ASCIICharProp>
public final class ASCIICharProp extends Object implements Comparable<ASCIICharProp>
AASCIICharPropprovides fast access to ASCII character properties. In particular, the ability to query whether a character is a letter, a digit, hexadecimal character, as well as various methods for performing character conversions.The methods in this class do not perform memory allocations nor calculations and so can be used safely in high performance situations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description charcharValue()Returns the char value associated with thisASCIICharProp.intcompareTo(ASCIICharProp o)intdecimalValue()Returns the decimal value associated with thisASCIICharProp, or-1if the value is not a decimal digit.booleanequals(Object obj)inthashCode()inthexValue()Returns the hexadecimal value associated with thisASCIICharProp, or-1if the value is not a hexadecimal digit.booleanisDigit()Indicates whether the char value associated with thisASCIICharPropis a decimal digit.booleanisHexDigit()Indicates whether the char value associated with thisASCIICharPropis a hexadecimal digit.booleanisKeyChar(boolean allowCompatChars)Indicates whether the char value associated with thisASCIICharPropis akeycharas defined in RFC 4512.booleanisLetter()Indicates whether the char value associated with thisASCIICharPropis a letter.booleanisLowerCase()Indicates whether the char value associated with thisASCIICharPropis a lower-case character.booleanisUpperCase()Indicates whether the char value associated with thisASCIICharPropis an upper-case character.chartoLowerCase()Returns the lower-case char value associated with thisASCIICharProp.StringtoString()chartoUpperCase()Returns the upper-case char value associated with thisASCIICharProp.static ASCIICharPropvalueOf(char c)Returns the character properties for the provided ASCII character.static ASCIICharPropvalueOf(int c)Returns the character properties for the provided ASCII character.
-
-
-
Method Detail
-
valueOf
public static ASCIICharProp valueOf(char c)
Returns the character properties for the provided ASCII character. If a non-ASCII character is provided then this method returnsnull.- Parameters:
c- The ASCII character.- Returns:
- The character properties for the provided ASCII character, or
nullifcis greater than.
-
valueOf
public static ASCIICharProp valueOf(int c)
Returns the character properties for the provided ASCII character. If a non-ASCII character is provided then this method returnsnull.- Parameters:
c- The ASCII character.- Returns:
- The character properties for the provided ASCII character, or
nullifcis less than zero or greater than.
-
charValue
public char charValue()
Returns the char value associated with thisASCIICharProp.- Returns:
- The char value associated with this
ASCIICharProp.
-
compareTo
public int compareTo(ASCIICharProp o)
- Specified by:
compareToin interfaceComparable<ASCIICharProp>
-
decimalValue
public int decimalValue()
Returns the decimal value associated with thisASCIICharProp, or-1if the value is not a decimal digit.- Returns:
- The decimal value associated with this
ASCIICharProp, or-1if the value is not a decimal digit.
-
hexValue
public int hexValue()
Returns the hexadecimal value associated with thisASCIICharProp, or-1if the value is not a hexadecimal digit.- Returns:
- The hexadecimal value associated with this
ASCIICharProp, or-1if the value is not a hexadecimal digit.
-
isDigit
public boolean isDigit()
Indicates whether the char value associated with thisASCIICharPropis a decimal digit.- Returns:
trueif the char value associated with thisASCIICharPropis a decimal digit.
-
isHexDigit
public boolean isHexDigit()
Indicates whether the char value associated with thisASCIICharPropis a hexadecimal digit.- Returns:
trueif the char value associated with thisASCIICharPropis a hexadecimal digit.
-
isKeyChar
public boolean isKeyChar(boolean allowCompatChars)
Indicates whether the char value associated with thisASCIICharPropis akeycharas defined in RFC 4512. Akeycharis a letter, a digit, or a hyphen. WhenallowCompatCharsistruethe following illegal characters will be permitted:HYPHEN = %x2D ; hyphen ("-") DOT = %x2E ; period (".") EQUALS = %x3D ; equals sign ("=") USCORE = %x5F ; underscore ("_")- Parameters:
allowCompatChars-trueif certain illegal characters should be allowed for compatibility reasons.- Returns:
trueif the char value associated with thisASCIICharPropis akeychar.
-
isLetter
public boolean isLetter()
Indicates whether the char value associated with thisASCIICharPropis a letter.- Returns:
trueif the char value associated with thisASCIICharPropis a letter.
-
isLowerCase
public boolean isLowerCase()
Indicates whether the char value associated with thisASCIICharPropis a lower-case character.- Returns:
trueif the char value associated with thisASCIICharPropis a lower-case character.
-
isUpperCase
public boolean isUpperCase()
Indicates whether the char value associated with thisASCIICharPropis an upper-case character.- Returns:
trueif the char value associated with thisASCIICharPropis an upper-case character.
-
toLowerCase
public char toLowerCase()
Returns the lower-case char value associated with thisASCIICharProp.- Returns:
- The lower-case char value associated with this
ASCIICharProp.
-
toUpperCase
public char toUpperCase()
Returns the upper-case char value associated with thisASCIICharProp.- Returns:
- The upper-case char value associated with this
ASCIICharProp.
-
-