com.abra.j2xb.beans.propertyEditors
Class MOEnumPropertyEditor

java.lang.Object
  extended by com.abra.j2xb.beans.propertyEditors.MOEnumPropertyEditor
All Implemented Interfaces:
MOPropertyEditor

public class MOEnumPropertyEditor
extends java.lang.Object
implements MOPropertyEditor

Since:
JDK1.5
Version:
1.0, May 1, 2008
Author:
Yoav Abrahami

Constructor Summary
MOEnumPropertyEditor()
           
 
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.util.Set<java.lang.Enum> getEnumConstants(java.lang.Class clazz)
           
 java.util.Set<java.lang.Enum> getEnumConstants(MOPropertyDescriptor propertyDescriptor)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MOEnumPropertyEditor

public MOEnumPropertyEditor()
Method Detail

fromString

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

Specified by:
fromString in interface MOPropertyEditor
Parameters:
propertyValueType - the class of the propery value
value - - the string value
Returns:
the property value

toString

public java.lang.String toString(java.lang.Class<?> propertyValueType,
                                 java.lang.Object value)
Description copied from interface: MOPropertyEditor
encodes the property value to string.

Specified by:
toString in interface MOPropertyEditor
Parameters:
propertyValueType - the class of the propery value
value - - the property value
Returns:
string encoding

fromXmlValue

public java.lang.Object fromXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor,
                                     XmlValue value)
Description copied from interface: MOPropertyEditor
decodes the property value from the value used to store in XML.

Specified by:
fromXmlValue in interface MOPropertyEditor
Parameters:
simpleTypeDescriptor - descriptor for simple type instance
value - - the value to decode
Returns:
decoded value.

toXmlValue

public XmlValue toXmlValue(MOPropertySimpleTypeDescriptor simpleTypeDescriptor,
                           java.lang.Object value)
Description copied from interface: MOPropertyEditor
encodes the value to XML representation

Specified by:
toXmlValue in interface MOPropertyEditor
Parameters:
simpleTypeDescriptor - descriptor for simple type instance
value - - the value to encode
Returns:
encoded value.

validateStringEncoding

public MOValueValidationResult validateStringEncoding(java.lang.Class propertyValueType,
                                                      java.lang.String value)
Description copied from interface: MOPropertyEditor
validates the string encoding.

Specified by:
validateStringEncoding in interface MOPropertyEditor
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

isCompatibleSimpleType

public boolean isCompatibleSimpleType(MoXmlBaseSimpleType xmlSimpleType)
Specified by:
isCompatibleSimpleType in interface MOPropertyEditor
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

public MoXmlBaseSimpleType getXmlDefaultSimpleType(MoXmlBaseSimpleType xmlSimpleType)
Description copied from interface: MOPropertyEditor
gets the base XML encoding type, used as the element base type in an XML schema

Specified by:
getXmlDefaultSimpleType in interface MOPropertyEditor
Parameters:
xmlSimpleType - an xml simple type. can be MoXmlBaseSimpleType.xmlNotSpecified
Returns:
the XML type

getEnumerations

public java.lang.String[] getEnumerations(java.lang.Class<?> propertyValueType)
Specified by:
getEnumerations in interface MOPropertyEditor
Parameters:
propertyValueType - the enumeration class
Returns:
XML enumeration restriction

getEnumConstants

public java.util.Set<java.lang.Enum> getEnumConstants(MOPropertyDescriptor propertyDescriptor)

getEnumConstants

public java.util.Set<java.lang.Enum> getEnumConstants(java.lang.Class clazz)

supportsStringValidations

public boolean supportsStringValidations()
Description copied from interface: MOPropertyEditor
indicates that the type supports the MOValidationString for string validations

Specified by:
supportsStringValidations in interface MOPropertyEditor
Returns:
true if support

supportsNumberValidations

public boolean supportsNumberValidations()
Description copied from interface: MOPropertyEditor
indicates that the type supports the MOValidationNumber for Number validations

Specified by:
supportsNumberValidations in interface MOPropertyEditor
Returns:
true if support

compareValues

public int compareValues(java.lang.Object obj_a,
                         java.lang.Object obj_b)
Specified by:
compareValues in interface MOPropertyEditor


Copyright © 2008. All Rights Reserved.