|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.domain.DomainObject
com.arsdigita.globalization.Locale
Locale DomainObject implements a persistent Locale object.
Field Summary | |
static String |
BASE_DATA_OBJECT_TYPE
|
static String |
versionId
|
Constructor Summary | |
Locale()
Constructor. |
|
Locale(DataObject dataObject)
Constructor. |
|
Locale(OID oid)
Constructor. |
|
Locale(String language)
Constructor. |
|
Locale(String language,
String country)
Constructor. |
|
Locale(String language,
String country,
String variant)
Constructor. |
Method Summary | |
protected void |
afterDelete()
|
protected void |
afterSave()
|
protected void |
beforeSave()
|
Locale |
fallback()
Fallback to the more generic version of this locale. |
static Locale |
fallback(Locale locale)
Fallback to the more generic version of the locale. |
static Locale |
fromJavaLocale(Locale locale)
Retrieve a Locale DomainObject based on a java.util.Locale |
static Locale |
fromJavaLocaleBestMatch(Locale locale)
Retrieve the best matching Locale DomainObject based on a java.util.Locale |
String |
getBaseDataObjectType()
Returns the appropriate object type for a Locale so that the proper type validation can take place when retrieving Locales by OID. |
String |
getCountry()
Retrieve the country for this Locale. |
Charset |
getDefaultCharset()
Retrieve the default character set for this Locale. |
BigDecimal |
getID()
Return ID. |
String |
getLanguage()
Retrieve the language for this Locale. |
String |
getVariant()
Retrieve the variant for this Locale. |
protected void |
initialize()
Called from all of the DomainObject constructors
to initalize or validate the new domain object or its
encapsulated data object. |
static Locale |
retrieve(String language)
Retrieve a Locale DomainObject. |
static Locale |
retrieve(String language,
String country)
Retrieve a Locale DomainObject. |
static Locale |
retrieve(String language,
String country,
String variant)
Retrieve a Locale DomainObject. |
void |
setCountry(String country)
Set the country for this Locale. |
void |
setDefaultCharset(Charset charset)
Set the default character set for this Locale. |
void |
setLanguage(String language)
Set the language for this Locale. |
void |
setVariant(String variant)
Set the variant for this Locale. |
Locale |
toJavaLocale()
Create an equivalent java.util.Locale |
static Locale |
toJavaLocale(Locale locale)
Create a java.util.Locale from a Locale DomainObject |
Methods inherited from class com.arsdigita.domain.DomainObject |
add, add, addToAssociation, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String versionId
public static final String BASE_DATA_OBJECT_TYPE
Constructor Detail |
public Locale()
Constructor. Creates an instance for a new Locale.
public Locale(String language)
Constructor. Creates a persistent Locale DomainObject.
language
- The language of the Locale to create.public Locale(String language, String country)
Constructor. Creates a persistent Locale DomainObject.
language
- The language of the Locale to create.country
- The country of the Locale to create.public Locale(String language, String country, String variant)
Constructor. Creates a persistent Locale DomainObject.
language
- The language of the Locale to create.country
- The country of the Locale to create.variant
- The variant of the Locale to create.public Locale(OID oid) throws DataObjectNotFoundException
Constructor. Retrieves a persistent Locale DomainObject.
oid
- Object ID of the Locale to retrieve.
DataObjectNotFoundException
- Thrown if we cannot retrieve a
DataObject for the specified OID.public Locale(DataObject dataObject)
Constructor. Retrieves a persistent Locale DomainObject.
dataObject
- DataObject of the Locale to retrieve.Method Detail |
protected void initialize()
DomainObject
DomainObject
constructors
to initalize or validate the new domain object or its
encapsulated data object. This was introduced in order to
support efficient validation of the encapsualted data object's
type. If the validation is typically performed in class
constructors, then redundant validation is performed in
superclass constructors. This validation now occurs here.
initialize
in class DomainObject
public Locale fallback()
Fallback to the more generic version of this locale. That is, if the current locale is "en_US_WIN" then this method returns "en_US", if called again on that locale it will return "en", and if called again it will return null.
public static Locale fallback(Locale locale)
Fallback to the more generic version of the locale. That is, if the passed in locale is "en_US_WIN" then this method returns "en_US", if called again on that locale it will return "en", and if called again it will return null.
locale
- java.util.Locale
public String getBaseDataObjectType()
Returns the appropriate object type for a Locale so that the proper type validation can take place when retrieving Locales by OID.
getBaseDataObjectType
in class DomainObject
public BigDecimal getID()
Return ID.
public String getLanguage()
Retrieve the language for this Locale.
public void setLanguage(String language)
Set the language for this Locale.
language
- ISO-639 language code.public String getCountry()
Retrieve the country for this Locale.
public void setCountry(String country)
Set the country for this Locale.
country
- ISO-3166 country code.public String getVariant()
Retrieve the variant for this Locale.
public void setVariant(String variant)
Set the variant for this Locale.
variant
- variant.public Charset getDefaultCharset()
Retrieve the default character set for this Locale.
public void setDefaultCharset(Charset charset)
Set the default character set for this Locale.
charset
- Charset DomainObject.public static Locale retrieve(String language) throws DataObjectNotFoundException
Retrieve a Locale DomainObject.
language
- The language of the Locale to retrieve.
DataObjectNotFoundException
public static Locale retrieve(String language, String country) throws DataObjectNotFoundException
Retrieve a Locale DomainObject.
language
- The language of the Locale to retrieve.country
- The country of the Locale to retrieve.
DataObjectNotFoundException
public static Locale retrieve(String language, String country, String variant) throws DataObjectNotFoundException
Retrieve a Locale DomainObject.
language
- The language of the Locale to retrieve.country
- The country of the Locale to retrieve.variant
- The variant of the Locale to retrieve.
DataObjectNotFoundException
public static Locale fromJavaLocale(Locale locale) throws GlobalizationException
Retrieve a Locale DomainObject based on a java.util.Locale
GlobalizationException
public static Locale fromJavaLocaleBestMatch(Locale locale)
Retrieve the best matching Locale DomainObject based on a java.util.Locale
public Locale toJavaLocale()
Create an equivalent java.util.Locale
public static Locale toJavaLocale(Locale locale)
Create a java.util.Locale from a Locale DomainObject
protected void beforeSave()
beforeSave
in class DomainObject
protected void afterSave()
afterSave
in class DomainObject
protected void afterDelete()
afterDelete
in class DomainObject
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |