Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.property
Class AbstractPropertyDefinition

    java.lang.Object
      com.bea.p13n.property.AbstractPropertyDefinition

All Implemented Interfaces
  PropertyDefinition, Serializable

Direct Known Subclasses:
  PropertyDefinitionImpl

    public abstract class AbstractPropertyDefinition

extends Object
implements PropertyDefinition, Serializable

Default implementation of a PropertyDefinition.

See Also
  Serialized Form

Field Summary

Fields inherited from interface com.bea.p13n.property.PropertyDefinition
`BOOLEAN, DATETIME, FLOAT, INTEGER, TEXT, USER_DEFINED`

Constructor Summary
`AbstractPropertyDefinition()` Default constructor
`AbstractPropertyDefinition(String descriptionArg, int typeArg, boolean multiValuedArg, boolean restrictedArg, Collection restrictedValuesArg, Object defaultValueArg)` Constructor to initialize attributes

Method Summary
`int` | `compareTo(Object o)` Implementation of Object.compareTo(); returns 0 if the two objects are equal; attempts to determine an ordering otherwise and returns -1 if this object is less than the comparison object, and 1 if this object is greater than the comparison object.
`protected int` | `determinePropertyType(Object value)` Determines if the data type of the property value is a known property type.
`boolean` | `equals(Object o)` Equality operator.
`Object` | `getDefaultValue()` Get the default value for this property.
`String` | `getDescription()` Get the description of this property
`Collection` | `getRestrictedValues()` Get the allowable values, if this property is restricted.
`int` | `getType()` Get the datatype of the property
`protected String` | `getTypeClassName(int type)` Get a meaningful data type for better exception on illegal type when set new property value
`int` | `hashCode()` Computes a hashcode for this object based on its attributes
`boolean` | `isMultiValued()` Can this property support multiple values?
`boolean` | `isRestricted()` Is this property restricted to a certain list of values?
`void` | `setDefaultValue(Object o)` Set the default value for this property.
`void` | `setDescription(String s)` Set the description of this property
`void` | `setMultiValued(boolean b)` Set if this property support multiple values?
`void` | `setRestricted(boolean b)` Set if this property restricted to a certain list of values?
`void` | `setRestrictedValues(Collection c)` Set the allowable values, if this property is restricted
`void` | `setType(int i)` Set the datatype of the property
`String` | `toString()` Basic toString method
`void` | `validate(Object value)` Validates the given value against the property definition.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AbstractPropertyDefinition

    public AbstractPropertyDefinition()

  Default constructor

### AbstractPropertyDefinition

    public AbstractPropertyDefinition(String descriptionArg,
                                      int typeArg,
                                      boolean multiValuedArg,
                                      boolean restrictedArg,
                                      Collection restrictedValuesArg,
                                      Object defaultValueArg)

  Constructor to initialize attributes

Method Detail

### getDescription

    public String getDescription()

  Get the description of this property

  Specified by:
    `getDescription` in interface `PropertyDefinition`

### setDescription

    public void setDescription(String s)

  Set the description of this property

### getType

    public int getType()

  Get the datatype of the property

  Specified by:
    `getType` in interface `PropertyDefinition`

### setType

    public void setType(int i)

  Set the datatype of the property

### isMultiValued

    public boolean isMultiValued()

  Can this property support multiple values?

  Specified by:
    `isMultiValued` in interface `PropertyDefinition`

### setMultiValued

    public void setMultiValued(boolean b)

  Set if this property support multiple values?

### isRestricted

    public boolean isRestricted()

  Is this property restricted to a certain list of values?

  Specified by:
    `isRestricted` in interface `PropertyDefinition`

### setRestricted

    public void setRestricted(boolean b)

  Set if this property restricted to a certain list of values?

### getRestrictedValues

    public Collection getRestrictedValues()

  Get the allowable values, if this property is restricted. Note: this does a shallow clone to prevent the collection from being modified, but if any property values are mutable, care must be taken not to modify them.

  Specified by:
    `getRestrictedValues` in interface `PropertyDefinition`
  Returns
    a Collection of allowable values, or null if there are none

### setRestrictedValues

    public void setRestrictedValues(Collection c)

  Set the allowable values, if this property is restricted

### getDefaultValue

    public Object getDefaultValue()

  Get the default value for this property. If it is multivalued, this might be a collection of values. Note: this returns a clone of the default value; if it is a collection, and the property values are mutable objects, care must be taken not to modify them.

  Specified by:
    `getDefaultValue` in interface `PropertyDefinition`
  Returns
    the default value, or null if there is none

### setDefaultValue

    public void setDefaultValue(Object o)

  Set the default value for this property.

### validate

    public void validate(Object value)
                  throws PropertyValidationException

  Validates the given value against the property definition. Compares datatypes, and checks against allowable values.

  Specified by:
    `validate` in interface `PropertyDefinition`
  Throws
    `PropertyValidationException` - if the value is not valid

### equals

    public boolean equals(Object o)

  Equality operator.

  Overrides:
    `equals` in class `Object`
  Returns
    true if the compareTomethod would return 0 for this target

### hashCode

    public int hashCode()

  Computes a hashcode for this object based on its attributes

  Overrides:
    `hashCode` in class `Object`
  Returns
    the calculated hashcode

### compareTo

    public int compareTo(Object o)

  Implementation of Object.compareTo(); returns 0 if the two objects are equal; attempts to determine an ordering otherwise and returns -1 if this object is less than the comparison object, and 1 if this object is greater than the comparison object. Because Property Definitions do not have an inherent order, any non-zero value is somewhat arbitrary.

### determinePropertyType

    protected int determinePropertyType(Object value)

  Determines if the data type of the property value is a known property type. Defaults to USER_DEFINED if the type of the value cannot be determined.

  Parameters
    `value` -
  Returns
    `int` which is one of the datatype constants defined in the PropertyDefinition interface

### getTypeClassName

    protected String getTypeClassName(int type)

  Get a meaningful data type for better exception on illegal type when set new property value

  Parameters
    `type` - dateype constants defined in `PropertyDefinition` interface
  Returns
    Name of the class that match the datatype constants defined in the `PropertyDefinition` interface If more than one classes match the datatype constants, the class with higher precision is returned

### toString

    public String toString()

  Basic toString method

  Overrides:
    `toString` in class `Object`
  Returns
    a displayable String representing this property definition

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved