gate.creole
Class FeatureSchema

java.lang.Object
  extended by gate.creole.FeatureSchema
All Implemented Interfaces:
Serializable

public class FeatureSchema
extends Object
implements Serializable

This class describes a schema for a feature. It is used as part of AnnotationSchema class.

See Also:
Serialized Form

Constructor Summary
FeatureSchema(String aFeatureName, Class<?> aFeatureValueClass, String aFeatureValue, String aFeatureUse, Set aFeaturePermissibleValuesSet)
          Construction given a name of an feature and a feature value class name
 
Method Summary
 boolean addPermissibleValue(Object obj)
          Adds a value to the enumeration of permissible value for a feature of this type.
 String getFeatureName()
          Get the feature name
 String getFeatureValue()
          This method returns the value of the feature.
 Class<?> getFeatureValueClass()
           
 Set getPermittedValues()
          Returns the permissible values as a Set
 String getRawFeatureValue()
          This method returns the value of the feature regardless of the current value of featureUse.
 boolean isDefault()
          This method is used to check if the feature is default.
 boolean isEnumeration()
          Tests whether the values are an enumeration or not.
 boolean isFixed()
          This method is used to check if the feature, is fixed.
 boolean isOptional()
          This method is used to check if the feature is optional.
 boolean isProhibited()
          This method is used to check if the feature is prohibited.
 boolean isRequired()
          This method is used to check if the feature is required.
 void setFeatureValue(String aFeatureValue)
          This method sets the value of the feature.
 boolean setPermissibleValues(Set aPermisibleValuesSet)
          Adds all values from the given set as permissible values for the given feature.
 String toXSchema(Map aJava2XSchemaMap)
          This method transforms a feature to its XSchema representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureSchema

public FeatureSchema(String aFeatureName,
                     Class<?> aFeatureValueClass,
                     String aFeatureValue,
                     String aFeatureUse,
                     Set aFeaturePermissibleValuesSet)
Construction given a name of an feature and a feature value class name

Method Detail

isEnumeration

public boolean isEnumeration()
Tests whether the values are an enumeration or not.


getFeatureName

public String getFeatureName()
Get the feature name


getFeatureValueClass

public Class<?> getFeatureValueClass()
Returns:
the featureValueClass

getPermittedValues

public Set getPermittedValues()
Returns the permissible values as a Set


setPermissibleValues

public boolean setPermissibleValues(Set aPermisibleValuesSet)
Adds all values from the given set as permissible values for the given feature. No check is performed to see if the class name of the feature value is the same as the the elements of the given set. Returns true if the set has been assigned.


addPermissibleValue

public boolean addPermissibleValue(Object obj)
Adds a value to the enumeration of permissible value for a feature of this type. Returns false, i.e. fails, if the class name of the feature value does not match the class name of the given object

Parameters:
obj - the object representing a permissible value. If null then simply returns with false.

toXSchema

public String toXSchema(Map aJava2XSchemaMap)
This method transforms a feature to its XSchema representation. It is used in toXSchema().

Parameters:
aJava2XSchemaMap - a Java map object that will be serialized in XSchema
Returns:
a String containing the XSchema representation

getFeatureValue

public String getFeatureValue()
This method returns the value of the feature. If featureUse is something else than "default" or "fixed" it will return the empty string "".


getRawFeatureValue

public String getRawFeatureValue()
This method returns the value of the feature regardless of the current value of featureUse.


setFeatureValue

public void setFeatureValue(String aFeatureValue)
This method sets the value of the feature.

Parameters:
aFeatureValue - a String representing the value of a feature.

isRequired

public boolean isRequired()
This method is used to check if the feature is required.

Returns:
true if the feature is required. Otherwhise returns false

isDefault

public boolean isDefault()
This method is used to check if the feature is default. Default is used if the feature was omitted.

Returns:
true if the feature is default. Otherwhise returns false

isFixed

public boolean isFixed()
This method is used to check if the feature, is fixed.

Returns:
true if the feature is fixed. Otherwhise returns false

isOptional

public boolean isOptional()
This method is used to check if the feature is optional.

Returns:
true if the optional is fixed. Otherwhise returns false

isProhibited

public boolean isProhibited()
This method is used to check if the feature is prohibited.

Returns:
true if the prohibited is fixed. Otherwhise returns false