Package com.mckoi.database
Class TStringType
java.lang.Object
com.mckoi.database.TType
com.mckoi.database.TStringType
- All Implemented Interfaces:
Serializable
An implementation of TType for a String.
- Author:
- Tobias Downer
- See Also:
-
Field Summary
Fields inherited from class com.mckoi.database.TType
ARRAY_TYPE, BINARY_TYPE, BOOLEAN_TYPE, DATE_TYPE, NULL_TYPE, NUMERIC_TYPE, QUERY_PLAN_TYPE, STRING_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionTStringType
(int sql_type, int max_size, String locale_str) Constructor without strength and decomposition that sets to default levels.TStringType
(int sql_type, int max_size, String locale_str, int strength, int decomposition) Constructs a type with the given sql_type value, the maximum size, and the locale of the string.TStringType
(int sql_type, int max_size, Locale locale, int strength, int decomposition) Constructs a type with the given sql_type value, the maximum size, and the locale of the string. -
Method Summary
Modifier and TypeMethodDescriptionint
Calculates the approximate memory usage of an object of this type in bytes.boolean
comparableTypes
(TType type) For strings, the locale must be the same for the types to be comparable.int
compareObs
(Object ob1, Object ob2) Compares two objects that are logically comparable under this type.int
Returns the decomposition of this string type as defined in java.text.Collator.Returns the locale of the string.Returns the locale information as a formatted string.int
Returns the maximum size of the string (-1 is don't care).int
Returns the strength of this string type as defined in java.text.Collator.Returns the Java Class that is used to represent this type of object.Methods inherited from class com.mckoi.database.TType
asEncodedString, asEncodedString, asSQLString, binaryType, booleanType, castObjectToTType, dateType, decodeString, decodeTypes, fromClass, getSQLType, getWidestType, javaObjectType, numericType, stringType
-
Constructor Details
-
TStringType
Constructs a type with the given sql_type value, the maximum size, and the locale of the string. Note that the 'sql_type' MUST be a string SQL type.Note that a string type may be constructed with a NULL locale which means strings are compared lexicographically.
-
TStringType
Constructs a type with the given sql_type value, the maximum size, and the locale of the string. Note that the 'sql_type' MUST be a string SQL type.Note that a string type may be constructed with a NULL locale which means strings are compared lexicographically. The string locale is formated as [2 char language][2 char country][rest is variant]. For example, US english would be 'enUS', French would be 'fr' and Germany would be 'deDE'.
-
TStringType
Constructor without strength and decomposition that sets to default levels.
-
-
Method Details
-
getMaximumSize
public int getMaximumSize()Returns the maximum size of the string (-1 is don't care). -
getStrength
public int getStrength()Returns the strength of this string type as defined in java.text.Collator. -
getDecomposition
public int getDecomposition()Returns the decomposition of this string type as defined in java.text.Collator. -
getLocale
Returns the locale of the string. -
getLocaleString
Returns the locale information as a formatted string.Note that a string type may be constructed with a NULL locale which means strings are compared lexicographically. The string locale is formated as [2 char language][2 char country][rest is variant]. For example, US english would be 'enUS', French would be 'fr' and Germany would be 'deDE'.
-
comparableTypes
For strings, the locale must be the same for the types to be comparable. If the locale is not the same then they are not comparable. Note that strings with a locale of null can be compared with any other locale. So this will only return false if both types have different (but defined) locales.- Specified by:
comparableTypes
in classTType
-
compareObs
Description copied from class:TType
Compares two objects that are logically comparable under this type. Returns 0 if the values are equal, >1 if ob1 is greater than ob2, and <1 if ob1 is less than ob2. It is illegal to pass NULL values for ob1 or ob2 into this method.- Specified by:
compareObs
in classTType
-
calculateApproximateMemoryUse
Description copied from class:TType
Calculates the approximate memory usage of an object of this type in bytes.- Specified by:
calculateApproximateMemoryUse
in classTType
-
javaClass
Description copied from class:TType
Returns the Java Class that is used to represent this type of object. For example, string types would return String.class.
-