biz.c24.io.api.data
Class DefaultEnumeration

java.lang.Object
  extended by biz.c24.io.api.data.DefaultEnumeration
All Implemented Interfaces:
Enumeration, ModelComponent, Validator, Serializable

public class DefaultEnumeration
extends Object
implements Enumeration

The default enumeration implementation.

Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.

See Also:
Serialized Form

Constructor Summary
DefaultEnumeration()
          Creates a new instance.
 
Method Summary
 void addEntry(String value, String name, Annotation annotation)
          Adds a new entry.
 void addEntry(String value, String name, Annotation annotation, int index)
          Adds a new entry at the specified index.
 void addEntryWithDescription(String value, String name, String description)
          Adds a new entry with a simple description.
 void addNumericRange(int fromInclusive, int toInclusive, boolean padToMaxSize)
           
 Annotation getAnnotation()
          Returns the annotation associated with this enumeration.
 Annotation getAnnotation(int index)
          Returns the annotation associated with the enumeration value at index.
 int getCount()
          Returns the number of enumeration values.
 String getErrorCode()
          Returns the error code for this enumeration.
 int getIndex(String value)
          Returns the first index of value or -1 if it was not found.
 String getName()
          Returns the name of this component.
 String getName(int index)
          Returns the name associated with the enumeration value at index.
 String getValue(int index)
          Returns the enumeration value at index.
 boolean isCaseSensitive()
          Returns whether equality comparisons should consider case.
 void removeEntry(int index)
          Removes an entry.
 void setAnnotation(Annotation annotation)
          Sets the annotation.
 void setCaseSensitive(boolean caseSensitive)
          Sets whether equality comparisons should consider case.
 void setErrorCode(String errorCode)
          Sets the error code
 void setName(String name)
          Sets the name.
 String toString()
           
 boolean validate(Object object, DataComponent component, ComplexDataObject context, ValidationManager manager)
          Validate the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultEnumeration

public DefaultEnumeration()
Creates a new instance.

Method Detail

setName

public void setName(String name)
Sets the name.

Parameters:
name - The name.

getName

public String getName()
Description copied from interface: ModelComponent
Returns the name of this component.

Specified by:
getName in interface ModelComponent
Returns:
The name.

setAnnotation

public void setAnnotation(Annotation annotation)
Sets the annotation.

Parameters:
annotation - The annotation.

getAnnotation

public Annotation getAnnotation()
Description copied from interface: Enumeration
Returns the annotation associated with this enumeration.

Specified by:
getAnnotation in interface Enumeration
Returns:
The annotation

setErrorCode

public void setErrorCode(String errorCode)
Sets the error code

Parameters:
errorCode -

getErrorCode

public String getErrorCode()
Description copied from interface: Enumeration
Returns the error code for this enumeration.

Specified by:
getErrorCode in interface Enumeration
Returns:
The error code.

isCaseSensitive

public boolean isCaseSensitive()
Returns whether equality comparisons should consider case.

Returns:
Whether to perform case insensitive equals checks

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Sets whether equality comparisons should consider case.

Parameters:
caseSensitive - Whether to perform case sensitive equals checks

addEntry

public void addEntry(String value,
                     String name,
                     Annotation annotation)
Adds a new entry.

Parameters:
value - The value.
name - The name.
annotation - The annotation.
Throws:
NullPointerException - If value is null.

addEntry

public void addEntry(String value,
                     String name,
                     Annotation annotation,
                     int index)
Adds a new entry at the specified index.

Parameters:
value - The value.
name - The name.
annotation - The annotation.
index - The index at which to add the entry.
Throws:
NullPointerException - If value is null.

addEntryWithDescription

public void addEntryWithDescription(String value,
                                    String name,
                                    String description)
Adds a new entry with a simple description.

This is a simple convenience method to avoid the additional code required to create the wrapping Annotation.

Parameters:
value - The value.
name - The name.
description - The description to be wrapped in an annotation.
Throws:
NullPointerException - If value is null.

addNumericRange

public void addNumericRange(int fromInclusive,
                            int toInclusive,
                            boolean padToMaxSize)

removeEntry

public void removeEntry(int index)
Removes an entry.

Parameters:
index - The index of the entry to be removed.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getCount()).

getIndex

public int getIndex(String value)
Description copied from interface: Enumeration
Returns the first index of value or -1 if it was not found.

Specified by:
getIndex in interface Enumeration
Parameters:
value - The value to look for.
Returns:
The index of the first occurance of value or -1 if it was not found.

getCount

public int getCount()
Description copied from interface: Enumeration
Returns the number of enumeration values.

Specified by:
getCount in interface Enumeration
Returns:
The number of values.

getValue

public String getValue(int index)
Description copied from interface: Enumeration
Returns the enumeration value at index.

Specified by:
getValue in interface Enumeration
Parameters:
index - The index of the value to return.
Returns:
The value at index.

getName

public String getName(int index)
Description copied from interface: Enumeration
Returns the name associated with the enumeration value at index.

Specified by:
getName in interface Enumeration
Parameters:
index - The index of the name to return.
Returns:
The name at index.

getAnnotation

public Annotation getAnnotation(int index)
Description copied from interface: Enumeration
Returns the annotation associated with the enumeration value at index.

Specified by:
getAnnotation in interface Enumeration
Parameters:
index - The index of the annotation to return.
Returns:
The name at index.

validate

public boolean validate(Object object,
                        DataComponent component,
                        ComplexDataObject context,
                        ValidationManager manager)
                 throws ValidationException
Description copied from interface: Validator
Validate the given object.

Specified by:
validate in interface Validator
Parameters:
object - The object to be validated - commonly a String, Integer, Double, Date etc.
component - The Element or Attribute inside context which defines object.
context - The parent of object - could be null.
manager - The validation manager which is performing this validation.
Returns:
Whether the object is valid if the validation manager is not operating in exception mode.
Throws:
ValidationException - If the object is not valid and the validation maanger is operating in exception mode.

toString

public String toString()
Overrides:
toString in class Object


C24 Technologies © 2002-2012: All Rights Reserved.