fdda.propertyTypes
Interface TypeGenerator

All Known Implementing Classes:
AbstractGenerator

public interface TypeGenerator

A TypeGenerator can generate values for properties of a certain type. It also corrects facets that don't fit with the type and values that don't fit with the type or with the constraints imposed by the facets. Those last abilities are especially used when parsing properties from external files.

Author:
Jörg Rüdenauer

Field Summary
static int FACET_DEFAULT_IS_GREATER_THAN_MAX
          RC: the default value for the property was higher than the maximum allowed value.
static int FACET_DEFAULT_IS_LOWER_THAN_MIN
          RC: the default value for the property was lower than the minimum allowed value.
static int FACET_DEFAULT_NOT_ALLOWED
          RC: the default value for the property was not allowed.
static int FACET_MIN_IS_GREATER_THAN_MAX
          RC: the minimum allowed value was higher than the maximum allowed value.
static int FACET_OF_WRONG_TYPE
          RC: a facet value is of the wrong type.
static int VALUE_SET_TO_CLASS_DEFAULT
          RC: the value was wrong.
static int VALUE_SET_TO_MAX
          RC: the value was too high.
static int VALUE_SET_TO_MIN
          RC: the value was too low.
static int VALUE_SET_TO_USER_DEFAULT
          RC: the value was wrong.
static int WELL_DONE
          Return Code: No corrections were necessary
static int WRONG_CLASS_OBJECT
          RC: The Object was of the wrong type.
 
Method Summary
 Object cloneValue(Object valueObject)
          Returns a 'deep' copy of a value.
 int correctFacets(Property property)
          Checks whether the facets of a property fit to the type and corrects them, if necessary.
 Object correctValue(Object inValue, Property property)
          Corrects a value of a property so that it fits to the type and facets.
 String describeAction(int actionCode)
          Returns a String describing a correcting action, user-friendly
 int getlastCorrectAction()
          Returns the last action made by correctValue
 Object parseString(String string)
          Returns a value parsed from a String representation.
 

Field Detail

WELL_DONE

public static final int WELL_DONE
Return Code: No corrections were necessary

See Also:
Constant Field Values

WRONG_CLASS_OBJECT

public static final int WRONG_CLASS_OBJECT
RC: The Object was of the wrong type. A correction was impossible.

See Also:
Constant Field Values

VALUE_SET_TO_MAX

public static final int VALUE_SET_TO_MAX
RC: the value was too high. It was set to the maximum allowed value.

See Also:
Constant Field Values

VALUE_SET_TO_MIN

public static final int VALUE_SET_TO_MIN
RC: the value was too low. It was set to the minimum allowed value.

See Also:
Constant Field Values

VALUE_SET_TO_CLASS_DEFAULT

public static final int VALUE_SET_TO_CLASS_DEFAULT
RC: the value was wrong. It was set to the type's default value.

See Also:
Constant Field Values

VALUE_SET_TO_USER_DEFAULT

public static final int VALUE_SET_TO_USER_DEFAULT
RC: the value was wrong. It was set to the property's default value.

See Also:
Constant Field Values

FACET_MIN_IS_GREATER_THAN_MAX

public static final int FACET_MIN_IS_GREATER_THAN_MAX
RC: the minimum allowed value was higher than the maximum allowed value. They were switched.

See Also:
Constant Field Values

FACET_DEFAULT_IS_GREATER_THAN_MAX

public static final int FACET_DEFAULT_IS_GREATER_THAN_MAX
RC: the default value for the property was higher than the maximum allowed value. It was set to the maximum value.

See Also:
Constant Field Values

FACET_DEFAULT_IS_LOWER_THAN_MIN

public static final int FACET_DEFAULT_IS_LOWER_THAN_MIN
RC: the default value for the property was lower than the minimum allowed value. It was set to the minimum value.

See Also:
Constant Field Values

FACET_OF_WRONG_TYPE

public static final int FACET_OF_WRONG_TYPE
RC: a facet value is of the wrong type. No corrections are possible.

See Also:
Constant Field Values

FACET_DEFAULT_NOT_ALLOWED

public static final int FACET_DEFAULT_NOT_ALLOWED
RC: the default value for the property was not allowed. It was set to the class default value.

See Also:
Constant Field Values
Method Detail

cloneValue

public Object cloneValue(Object valueObject)
Returns a 'deep' copy of a value.

Parameters:
valueObject - the value
Returns:
a copy of the value

parseString

public Object parseString(String string)
                   throws ParseException
Returns a value parsed from a String representation.

Parameters:
string - the representation of the value
Returns:
the parsed value
Throws:
ParseException - if the String doesn't represent a value of the type

getlastCorrectAction

public int getlastCorrectAction()
Returns the last action made by correctValue

Returns:
the code of the last correcting action
See Also:
correctValue(Object, Property)

describeAction

public String describeAction(int actionCode)
Returns a String describing a correcting action, user-friendly

Parameters:
actionCode - the code of the action
Returns:
the description of that action

correctValue

public Object correctValue(Object inValue,
                           Property property)
                    throws WrongFacetException
Corrects a value of a property so that it fits to the type and facets. It is a precondition that the facets of the property are correct; if necessary, that should be ensured by calling correctFacets(Property). The action taken by the method can afterwards be retrieved by a call to getLastCorrectAction().

Parameters:
inValue - the value
property - the property (to get the facets)
Returns:
the corrected value
Throws:
WrongFacetException - if the facets of the property are erroneous.

correctFacets

public int correctFacets(Property property)
Checks whether the facets of a property fit to the type and corrects them, if necessary.

Parameters:
property - the property that holds the facets
Returns:
an error code that contains the action taken


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.