org.apache.openjpa.lib.conf
Class Value

java.lang.Object
  extended by org.apache.openjpa.lib.conf.Value
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
BooleanValue, DoubleValue, FileValue, IntValue, ObjectValue, StringListValue, StringValue

public abstract class Value
extends java.lang.Object
implements java.lang.Cloneable

A configuration value.

Author:
Marc Prud'hommeaux

Constructor Summary
Value()
          Default constructor.
Value(java.lang.String prop)
          Constructor.
 
Method Summary
 java.lang.String alias(java.lang.String str)
          Alias the given setting.
protected  java.lang.String alias(java.lang.String str, java.lang.String[] aliases, boolean nullNotFound)
          Alias the given setting.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object other)
           
 java.lang.String[] getAliases()
          Aliases for the value in the form key1, value1, key2, value2, ...
 java.lang.String getDefault()
          The default value for the property as a string.
 java.lang.String getInstantiatingGetter()
          The name of the getter method for the instantiated value of this property(as opposed to the string value)
protected abstract  java.lang.String getInternalString()
          Return the internal string form of this value.
 ValueListener getListener()
          Listener for value changes.
 java.lang.String getLoadKey()
          The key under which this value was loaded, or null.
 java.lang.String getProperty()
          The property name that will be used when setting or getting this value in a Map.
 java.lang.Class getScope()
          A class defining the scope in which this value is defined.
 java.lang.String getString()
          Return a stringified version of this value.
abstract  java.lang.Class getValueType()
          Returns the type of the property that this Value represents.
 int hashCode()
           
 boolean isAliasListComprehensive()
          Whether or not the alias list defines all possible settings for this value.
 void setAlias(java.lang.String key, java.lang.String value)
          Replaces an existing alias, or adds the given alias to the front of the alias list if it does not already exist.
protected  java.lang.String[] setAlias(java.lang.String key, java.lang.String value, java.lang.String[] aliases)
          Set an alias into a current alias list, returning the new list.
 void setAliases(java.lang.String[] aliases)
          Aliases for the value in the form key1, value1, key2, value2, ...
 void setAliasListComprehensive(boolean aliasListIsComprehensive)
          Whether or not the alias list defines all possible settings for this value.
 void setDefault(java.lang.String def)
          The default value for the propert as a string.
 void setInstantiatingGetter(java.lang.String getter)
          The name of the getter method for the instantiated value of this property(as opposed to the string value).
protected abstract  void setInternalObject(java.lang.Object obj)
          Set this value from an object.
protected abstract  void setInternalString(java.lang.String str)
          Set this value from the given string.
 void setListener(ValueListener listen)
          Listener for value changes.
 void setLoadKey(java.lang.String loadKey)
          The key under which this value was loaded, or null.
 void setObject(java.lang.Object obj)
          Set this value as an object.
 void setProperty(java.lang.String prop)
          The property name that will be used when setting or getting this value in a Map.
 void setScope(java.lang.Class cls)
          A class defining the scope in which this value is defined.
 void setString(java.lang.String val)
          Set this value from the given string.
 java.lang.String unalias(java.lang.String str)
          Unalias the given setting.
protected  java.lang.String unalias(java.lang.String str, java.lang.String[] aliases, boolean nullNotFound)
          Unalias the given setting.
 void valueChanged()
          Subclasses should call this method when their inernal value changes.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Value

public Value()
Default constructor.


Value

public Value(java.lang.String prop)
Constructor. Supply the property name.

See Also:
setProperty(java.lang.String)
Method Detail

getProperty

public java.lang.String getProperty()
The property name that will be used when setting or getting this value in a Map.


setProperty

public void setProperty(java.lang.String prop)
The property name that will be used when setting or getting this value in a Map.


getLoadKey

public java.lang.String getLoadKey()
The key under which this value was loaded, or null.


setLoadKey

public void setLoadKey(java.lang.String loadKey)
The key under which this value was loaded, or null.


getAliases

public java.lang.String[] getAliases()
Aliases for the value in the form key1, value1, key2, value2, ... All alias values must be in string form.


setAliases

public void setAliases(java.lang.String[] aliases)
Aliases for the value in the form key1, value1, key2, value2, ... All alias values must be in string form.


setAlias

public void setAlias(java.lang.String key,
                     java.lang.String value)
Replaces an existing alias, or adds the given alias to the front of the alias list if it does not already exist. All alias values must be in string form.


setAlias

protected java.lang.String[] setAlias(java.lang.String key,
                                      java.lang.String value,
                                      java.lang.String[] aliases)
Set an alias into a current alias list, returning the new list.


isAliasListComprehensive

public boolean isAliasListComprehensive()
Whether or not the alias list defines all possible settings for this value. If so, an error will be generated when attempting to invoke any method on this value with an unknown option.


setAliasListComprehensive

public void setAliasListComprehensive(boolean aliasListIsComprehensive)
Whether or not the alias list defines all possible settings for this value. If so, an error will be generated when attempting to invoke any method on this value with an unknown option.


alias

public java.lang.String alias(java.lang.String str)
Alias the given setting.


alias

protected java.lang.String alias(java.lang.String str,
                                 java.lang.String[] aliases,
                                 boolean nullNotFound)
Alias the given setting.


unalias

public java.lang.String unalias(java.lang.String str)
Unalias the given setting.


unalias

protected java.lang.String unalias(java.lang.String str,
                                   java.lang.String[] aliases,
                                   boolean nullNotFound)
Unalias the given setting.


getDefault

public java.lang.String getDefault()
The default value for the property as a string.


setDefault

public void setDefault(java.lang.String def)
The default value for the propert as a string.


getInstantiatingGetter

public java.lang.String getInstantiatingGetter()
The name of the getter method for the instantiated value of this property(as opposed to the string value)


setInstantiatingGetter

public void setInstantiatingGetter(java.lang.String getter)
The name of the getter method for the instantiated value of this property(as opposed to the string value). If the string starts with this., then the getter will be looked up on the value instance itself. Otherwise, the getter will be looked up on the configuration instance.


getScope

public java.lang.Class getScope()
A class defining the scope in which this value is defined. This will be used by the configuration framework to look up metadata about the value.


setScope

public void setScope(java.lang.Class cls)
A class defining the scope in which this value is defined. This will be used by the configuration framework to look up metadata about the value.


getString

public java.lang.String getString()
Return a stringified version of this value. If the current value has a short alias key, the alias key is returned.


setString

public void setString(java.lang.String val)
Set this value from the given string. If the given string is null or empty and a default is defined, the default is used. If the given string(or default) is an alias key, it will be converted to the corresponding value internally.


setObject

public void setObject(java.lang.Object obj)
Set this value as an object.


getValueType

public abstract java.lang.Class getValueType()
Returns the type of the property that this Value represents.


getInternalString

protected abstract java.lang.String getInternalString()
Return the internal string form of this value.


setInternalString

protected abstract void setInternalString(java.lang.String str)
Set this value from the given string.


setInternalObject

protected abstract void setInternalObject(java.lang.Object obj)
Set this value from an object.


getListener

public ValueListener getListener()
Listener for value changes.


setListener

public void setListener(ValueListener listen)
Listener for value changes.


valueChanged

public void valueChanged()
Subclasses should call this method when their inernal value changes.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object


Copyright © 2006 Apache Software Foundation. All Rights Reserved.