com.flexive.shared.configuration
Interface Parameter<T>

Type Parameters:
T - parameter value type
All Known Implementing Classes:
BooleanParameter, IntegerParameter, LongParameter, ObjectParameter, ParameterImpl, StringParameter

public interface Parameter<T>

Configuration parameter interface.

Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
ParameterFactory

Method Summary
 Parameter<T> copy()
          Return a copy of this parameter instance.
 Parameter<T> freeze()
          Freeze the parameter configuration.
 ParameterData<T> getData()
          Returns the data object containing path and key for the parameter.
 java.lang.String getDatabaseValue(T value)
          Convert the given value to a string that will be stored in the configuration.
 T getDefaultValue()
          Return the parameter's default value or null if it is not set.
 java.lang.String getKey()
          Return the parameter's key.
 ParameterPath getPath()
          Return the parameter's path (including its scope).
 ParameterScope getScope()
          Return the parameter's scope.
 T getValue(java.lang.Object dbValue)
          Convert the given database value (in string representation) to an object of type T.
 boolean isValid(T value)
          Returns true if the given value is a valid configuration value (e.g.
 Parameter<T> setData(ParameterData<T> data)
          Sets the data for this parameter.
 

Method Detail

getData

ParameterData<T> getData()
Returns the data object containing path and key for the parameter.

Returns:
the data object containing path and key for the parameter.

getValue

T getValue(java.lang.Object dbValue)
Convert the given database value (in string representation) to an object of type T.

Parameters:
dbValue - the value to be converted
Returns:
dbValue as type T.

getDatabaseValue

java.lang.String getDatabaseValue(T value)
Convert the given value to a string that will be stored in the configuration.

Parameters:
value - the parameter value to be stored
Returns:
the value's string representation
See Also:
getValue(Object)

isValid

boolean isValid(T value)
Returns true if the given value is a valid configuration value (e.g. primitive parameters may not be null).

Parameters:
value - the value to be checked
Returns:
true if the given value is a valid configuration value

getDefaultValue

T getDefaultValue()
Return the parameter's default value or null if it is not set.

Returns:
the parameter's default value or null if it is not set.

getPath

ParameterPath getPath()
Return the parameter's path (including its scope).

Returns:
the parameter's path (including its scope).

getScope

ParameterScope getScope()
Return the parameter's scope.

Returns:
the parameter's scope.

getKey

java.lang.String getKey()
Return the parameter's key.

Returns:
the parameter's key.

setData

Parameter<T> setData(ParameterData<T> data)
Sets the data for this parameter. Only works if the parameter instance is not frozen yet (see freeze()).

Parameters:
data - the parameter data beans
Returns:
this

freeze

Parameter<T> freeze()
Freeze the parameter configuration. The parameter data cannot be modified on this instance after calling this method.

Returns:
this

copy

Parameter<T> copy()
Return a copy of this parameter instance. If this instance was frozen, the new object will be "unfrozen". The ParameterData instance will not be cloned, however you can replace it with a new instance, e.g. to update the parameter key.

Returns:
a copy of this parameter instance