org.jpox.store.mapped.mapping
Class LocaleMapping
java.lang.Object
org.jpox.store.mapped.mapping.JavaTypeMapping
org.jpox.store.mapped.mapping.SingleFieldMapping
org.jpox.store.mapped.mapping.ObjectAsStringMapping
org.jpox.store.mapped.mapping.LocaleMapping
- All Implemented Interfaces:
- SimpleDatastoreRepresentation
public class LocaleMapping
- extends ObjectAsStringMapping
Mapping for Locale type.
Locale should be stored in colums from 2 to 20 characters. Normaly, we will have a string no longer than
5 characters, but variants, in general, are vendor specific and can be longer than expected.
The Variant codes are vendor and browser-specific. For example, use WIN for Windows, MAC for Macintosh,
and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most
important one first. For example, a Traditional Spanish collation might construct a locale with
parameters for language, country and variant as: "es", "ES", "Traditional_WIN".
language_country_variant
Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC"
- Version:
- $Revision: 1.18 $
- See Also:
Locale
| Fields inherited from class org.jpox.store.mapped.mapping.JavaTypeMapping |
datastoreContainer, datastoreMappings, dba, fmd, LOCALISER, MAPPING_ARRAY_ELEMENT, MAPPING_COLLECTION_ELEMENT, MAPPING_FIELD, MAPPING_MAP_KEY, MAPPING_MAP_VALUE, referenceMapping, roleForField, type |
|
Method Summary |
int |
getDefaultLength(int index)
Method to return the default length of this type in the datastore. |
java.lang.Class |
getJavaType()
Method to return the Java type. |
java.lang.Object |
getSampleValue(ClassLoaderResolver clr)
Return a sample value of the mapping type to be used for internal
evaluation of type and conversion. |
protected java.lang.String |
objectToString(java.lang.Object object)
Method to set the datastore string value based on the object value. |
protected java.lang.Object |
stringToObject(java.lang.String datastoreValue)
Method to extract the objects value from the datastore string value. |
| Methods inherited from class org.jpox.store.mapped.mapping.SingleFieldMapping |
equals, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShort, getString, getValidValues, initialize, prepareDatastoreMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString |
| Methods inherited from class org.jpox.store.mapped.mapping.JavaTypeMapping |
addDataStoreMapping, failureMessage, getDatastoreContainer, getDataStoreMapping, getDataStoreMappings, getFieldMetaData, getNumberOfDatastoreFields, getObject, getReferenceMapping, getRoleForField, getType, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, setDefault, setFieldInformation, setObject, setReferenceMapping, setRoleForField |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocaleMapping
public LocaleMapping()
getSampleValue
public java.lang.Object getSampleValue(ClassLoaderResolver clr)
- Description copied from class:
JavaTypeMapping
- Return a sample value of the mapping type to be used for internal
evaluation of type and conversion.
- Specified by:
getSampleValue in class JavaTypeMapping
- Parameters:
clr - TODO
- Returns:
- The sample value.
getJavaType
public java.lang.Class getJavaType()
- Description copied from class:
ObjectAsStringMapping
- Method to return the Java type.
- Specified by:
getJavaType in class ObjectAsStringMapping
- Returns:
- The Java type being represented.
getDefaultLength
public int getDefaultLength(int index)
- Method to return the default length of this type in the datastore.
Locales require 20 characters.
- Overrides:
getDefaultLength in class SingleFieldMapping
- Parameters:
index - The index position
- Returns:
- The default length
objectToString
protected java.lang.String objectToString(java.lang.Object object)
- Method to set the datastore string value based on the object value.
- Specified by:
objectToString in class ObjectAsStringMapping
- Parameters:
object - The object
- Returns:
- The string value to pass to the datastore
stringToObject
protected java.lang.Object stringToObject(java.lang.String datastoreValue)
- Method to extract the objects value from the datastore string value.
- Specified by:
stringToObject in class ObjectAsStringMapping
- Parameters:
datastoreValue - Value obtained from the datastore
- Returns:
- The value of this object (derived from the datastore string value)
Copyright © -2008 . All Rights Reserved.