com.abra.j2xb.beans.propertyEditors
Interface MOPropertyEditor

All Known Implementing Classes:
MOBigDecimalPropertyEditor, MOBigIntegerPropertyEditor, MOBooleanPropertyEditor, MOBytePropertyEditor, MOBytesPropertyEditor, MOCalendarPropertyEditor, MODatePropertyEditor, MODoublePropertyEditor, MOEnumPropertyEditor, MOFloatPropertyEditor, MOIntegerPropertyEditor, MOLongPropertyEditor, MONumberPropertyEditor, MOQNamePropertyEditor, MOShortPropertyEditor, MOStringPropertyEditor, MOTimePropertyEditor

public interface MOPropertyEditor

Defines how to support mapping of a Java class to an XML simple type. Implementations of this interface are available for most of the Java standard built in types.

To extend the library to support additional simple types, implement this interface and register the implementation with the MOPropertyEditorRegistry

Since:
JDK1.5
Version:
1.0, Dec 10, 2007
Author:
Yoav Abrahami
See Also:
MOPropertyEditorRegistry

Method Summary
 int compareValues(java.lang.Object obj_a, java.lang.Object obj_b)
           
 java.lang.Object fromString(java.lang.Class<?> propertyValueType, java.lang.String value)
          decodes the property value from string. this string can be used in annotations as the property default value.
 java.lang.Object fromXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor, XmlValue value)
          decodes the property value from the value used to store in XML.
 java.lang.String[] getEnumerations(java.lang.Class<?> propertyValueType)
           
 MoXmlBaseSimpleType getXmlDefaultSimpleType(MoXmlBaseSimpleType xmlSimpleType)
          gets the base XML encoding type, used as the element base type in an XML schema
 boolean isCompatibleSimpleType(MoXmlBaseSimpleType xmlSimpleType)
           
 boolean supportsNumberValidations()
          indicates that the type supports the MOValidationNumber for Number validations
 boolean supportsStringValidations()
          indicates that the type supports the MOValidationString for string validations
 java.lang.String toString(java.lang.Class<?> propertyValueType, java.lang.Object value)
          encodes the property value to string.
 XmlValue toXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor, java.lang.Object value)
          encodes the value to XML representation
 MOValueValidationResult validateStringEncoding(java.lang.Class propertyValueType, java.lang.String value)
          validates the string encoding.
 

Method Detail

fromString

java.lang.Object fromString(java.lang.Class<?> propertyValueType,
                            java.lang.String value)
decodes the property value from string. this string can be used in annotations as the property default value.

Parameters:
propertyValueType - the class of the propery value
value - - the string value
Returns:
the property value

toString

java.lang.String toString(java.lang.Class<?> propertyValueType,
                          java.lang.Object value)
encodes the property value to string.

Parameters:
propertyValueType - the class of the propery value
value - - the property value
Returns:
string encoding

validateStringEncoding

MOValueValidationResult validateStringEncoding(java.lang.Class propertyValueType,
                                               java.lang.String value)
validates the string encoding.

Parameters:
propertyValueType - the class of the propery value
value - - string encoding to validate
Returns:
validation object specifing if the value is valid, and if not a problem description

fromXmlValue

java.lang.Object fromXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor,
                              XmlValue value)
                              throws MOBeansException
decodes the property value from the value used to store in XML.

Parameters:
simpleTypeDescriptor - descriptor for simple type instance
value - - the value to decode
Returns:
decoded value.
Throws:
MOBeansException

toXmlValue

XmlValue toXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor,
                    java.lang.Object value)
encodes the value to XML representation

Parameters:
simpleTypeDescriptor - descriptor for simple type instance
value - - the value to encode
Returns:
encoded value.

isCompatibleSimpleType

boolean isCompatibleSimpleType(MoXmlBaseSimpleType xmlSimpleType)
Parameters:
xmlSimpleType - simple type to check if compatible with the property editor
Returns:
returns if the simple type is compatible with this property editor

getXmlDefaultSimpleType

MoXmlBaseSimpleType getXmlDefaultSimpleType(MoXmlBaseSimpleType xmlSimpleType)
gets the base XML encoding type, used as the element base type in an XML schema

Parameters:
xmlSimpleType - an xml simple type. can be MoXmlBaseSimpleType.xmlNotSpecified
Returns:
the XML type

getEnumerations

java.lang.String[] getEnumerations(java.lang.Class<?> propertyValueType)
Parameters:
propertyValueType - the enumeration class
Returns:
XML enumeration restriction

supportsStringValidations

boolean supportsStringValidations()
indicates that the type supports the MOValidationString for string validations

Returns:
true if support

supportsNumberValidations

boolean supportsNumberValidations()
indicates that the type supports the MOValidationNumber for Number validations

Returns:
true if support

compareValues

int compareValues(java.lang.Object obj_a,
                  java.lang.Object obj_b)


Copyright © 2008. All Rights Reserved.