Class BasePrimitiveDomainType
- java.lang.Object
-
- org.openbravo.base.model.domaintype.BaseDomainType
-
- org.openbravo.base.model.domaintype.BasePrimitiveDomainType
-
- All Implemented Interfaces:
DomainType
,PrimitiveDomainType
- Direct Known Subclasses:
AbsoluteDateTimeDomainType
,AbsoluteTimeDomainType
,BaseEnumerateDomainType
,BigDecimalDomainType
,BinaryDomainType
,BooleanDomainType
,ButtonDomainType
,DateDomainType
,DatetimeDomainType
,LongDomainType
,ObjectDomainType
,StringDomainType
,TimestampDomainType
public abstract class BasePrimitiveDomainType extends BaseDomainType implements PrimitiveDomainType
The base class for primitive property types. Subclasses only need to implementPrimitiveDomainType.getPrimitiveType()
.- Author:
- mtaal
-
-
Field Summary
-
Fields inherited from interface org.openbravo.base.model.domaintype.PrimitiveDomainType
EMPTY_STRING
-
-
Constructor Summary
Constructors Constructor Description BasePrimitiveDomainType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIsValidValue(Property property, Object value)
Checks if a certain value is valid according to the type of the reference.String
convertToString(Object value)
Converts an object value of this type to a locale/system neutral String.Object
createFromString(String strValue)
Converts a string back to an object value of the primitive type ({link #getPrimitiveType()}) represented by this DomainType.String
getFormatId()
Returns the id of the format definition to use for this domain type.Class<?>
getHibernateType()
The type used in the hibernate mapping.-
Methods inherited from class org.openbravo.base.model.domaintype.BaseDomainType
checkObjectIsValid, getClasses, getModelProvider, getReference, initialize, setModelProvider, setReference
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openbravo.base.model.domaintype.DomainType
checkObjectIsValid, getModelProvider, getReference, initialize, setModelProvider, setReference
-
Methods inherited from interface org.openbravo.base.model.domaintype.PrimitiveDomainType
getPrimitiveType, getXMLSchemaType
-
-
-
-
Method Detail
-
getHibernateType
public Class<?> getHibernateType()
Description copied from interface:PrimitiveDomainType
The type used in the hibernate mapping. Most of the time is the same as thePrimitiveDomainType.getPrimitiveType()
. Can be used to set a hibnernate user type class. See the hibernate documentation for more information on this.- Specified by:
getHibernateType
in interfacePrimitiveDomainType
- Returns:
- the class representing the hibernate type
-
checkIsValidValue
public void checkIsValidValue(Property property, Object value) throws ValidationException
Description copied from interface:DomainType
Checks if a certain value is valid according to the type of the reference.- Specified by:
checkIsValidValue
in interfaceDomainType
- Parameters:
property
- the property which has this valuevalue
- the value- Throws:
ValidationException
-
getFormatId
public String getFormatId()
Description copied from interface:PrimitiveDomainType
Returns the id of the format definition to use for this domain type. Is normally only relevant for numeric domain types. The id is the prefix part of the name in the Format.xml file. So for example the id 'integer' maps to all the Format.xml entries with integer as a prefix.- Specified by:
getFormatId
in interfacePrimitiveDomainType
- Returns:
- the name of the format definition in the format.xml, if not relevant then null is returned.
-
convertToString
public String convertToString(Object value)
Description copied from interface:PrimitiveDomainType
Converts an object value of this type to a locale/system neutral String. Is used in XML conversion. The opposite of this method is thePrimitiveDomainType.createFromString(String)
method.- Specified by:
convertToString
in interfacePrimitiveDomainType
- Parameters:
value
- the value to convert to a string.- Returns:
- the String representation, if the value is null then an empty String is returned
-
createFromString
public Object createFromString(String strValue)
Description copied from interface:PrimitiveDomainType
Converts a string back to an object value of the primitive type ({link #getPrimitiveType()}) represented by this DomainType. This method is the opposite of thePrimitiveDomainType.convertToString(Object)
method.- Specified by:
createFromString
in interfacePrimitiveDomainType
- Parameters:
strValue
- the string value to convert- Returns:
- the object value, null is returned if an empty string or null are passed as parameter.
-
-