UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.schema
Class SchemaField

java.lang.Object
  |
  +--edu.berkeley.guir.lib.schema.SchemaField
All Implemented Interfaces:
Serializable

public abstract class SchemaField
extends Object
implements Serializable

Represents a field in its entirety. This value uses a loaded Schema to check if values passed in are valid.

In order to enable multiple schemata, you should subclass this class, with each class representing one of the schema. You can hide the constructor call requiring the schema variable (in this class) by having the subclass handle it (since its schema should be fixed).

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Nov 27 1998, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK 1.2
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Constructor Summary
protected SchemaField(Schema newSchema)
          Constructor for subclasses only.
  SchemaField(Schema newSchema, String newFieldName)
          Create a new property with this field name.
  SchemaField(Schema newSchema, String newFieldName, String newFieldValue)
          Create a new property with this field name and this field value.
 
Method Summary
 String getFieldName()
          Get the field name.
 String getFieldValue()
          Get the field value.
 Enumeration getPropertyNames()
          Get an Enumeration of the property names in this field.
 String getPropertyValue(String strPropertyName)
          Get the specified property value.
 void setFieldName(String newFieldName)
          Set the field name.
 void setFieldValue(String strValue)
          Set the field value.
 void setPropertyValue(String strPropertyName, String strValue)
          Set a property to a given value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchemaField

protected SchemaField(Schema newSchema)
Constructor for subclasses only.

SchemaField

public SchemaField(Schema newSchema,
                   String newFieldName)
Create a new property with this field name.
Parameters:
newFieldName - is the field name to use.

SchemaField

public SchemaField(Schema newSchema,
                   String newFieldName,
                   String newFieldValue)
Create a new property with this field name and this field value.
Parameters:
newFieldName - is the field name to use.
newFieldValue - is the value to use.
Method Detail

getFieldName

public String getFieldName()
Get the field name.

getFieldValue

public String getFieldValue()
Get the field value.

getPropertyValue

public String getPropertyValue(String strPropertyName)
Get the specified property value.

getPropertyNames

public Enumeration getPropertyNames()
Get an Enumeration of the property names in this field.
Returns:
an Enumeration of Strings, each of which is a key to a property value.

setFieldName

public void setFieldName(String newFieldName)
Set the field name. Does not work if the field name has already been set.
Parameters:
newFieldName - is the name to set the field to. Must be a valid field name.

setFieldValue

public void setFieldValue(String strValue)
Set the field value. This does not work unless a field name has already been set (either in the constructor or via setFieldName()).
Parameters:
strValue - is the value to set the field to. Use null to unset the value. Must be a valid value otherwise.

setPropertyValue

public void setPropertyValue(String strPropertyName,
                             String strValue)
Set a property to a given value. This does not work unless a field name has already been set (either in the constructor or via setFieldName()).
Parameters:
strPropertyName - is the property to set. Must be a valid property name.
strValue - is the value to set the property to. Use null to unset the value. Must be a valid value for this property otherwise.

toString

public String toString()
Overrides:
toString in class Object

Copyright Information