|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.util.parameter.AbstractParameterContext
Subject to change.
A base implementation of the ParameterContext
interface.
ParameterContext
Field Summary | |
static String |
versionId
|
Constructor Summary | |
AbstractParameterContext()
Constructs a parameter context. |
Method Summary | |
Object |
get(Parameter param)
Gets the unmarshaled value of param . |
Object |
get(Parameter param,
Object dephault)
Gets the unmarshaled value of param , returning
dephalt if param 's value is null. |
Parameter[] |
getParameters()
Returns all the parameters registered on the parameter context. |
ErrorList |
load(ParameterReader reader)
Reads and unmarshals all values associated with the registered parameters from reader . |
void |
load(ParameterReader reader,
ErrorList errors)
Reads and unmarshals all values associated with the registered parameters from reader . |
protected void |
loadInfo()
Loads source data for ParameterInfo objects from
the file YourClass_parameter.properties next to
YourClass.class . |
void |
register(Parameter param)
Registers param to the context. |
void |
save(ParameterWriter writer)
Marshals and writes all values associated with the registered parameters to writer . |
void |
set(Parameter param,
Object value)
Sets the value of param to value . |
ErrorList |
validate()
Validates all values associated with the registered parameters. |
void |
validate(ErrorList errors)
Validates all values associated with the registered parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public AbstractParameterContext()
Method Detail |
public final void register(Parameter param)
param
to the context.
param
- The Parameter
being registered; it
cannot be nullpublic final Parameter[] getParameters()
ParameterContext
getParameters
in interface ParameterContext
Parameter[]
of all the parameters; it
cannot be nullParameterContext.getParameters()
public Object get(Parameter param)
ParameterContext
param
. If the
loaded value is null, param.getDefaultValue()
is
returned.
get
in interface ParameterContext
param
- The named Parameter
whose value to
retrieve; it cannot be null
param
ParameterContext.get(Parameter)
public Object get(Parameter param, Object dephault)
ParameterContext
param
, returning
dephalt
if param
's value is null.
get
in interface ParameterContext
param
- The Parameter
whose value to
retrieve; it cannot be nulldephault
- The fallback default value; it may be null
param
or dephalt
if the former is nullParameterContext.get(Parameter,Object)
public void set(Parameter param, Object value)
ParameterContext
param
to value
.
set
in interface ParameterContext
param
- The Parameter
whose value to set; it
cannot be nullvalue
- The new value of param
; it may be
nullParameterContext.get(Parameter,Object)
public final ErrorList load(ParameterReader reader)
reader
. Any errors are returned.
reader
- The ParameterReader
from which to
fetch the values; it cannot be null
ErrorList
containing any errors
encountered while loading; it cannot be nullpublic final void load(ParameterReader reader, ErrorList errors)
ParameterContext
reader
. If any errors are
encountered, they are added to errors
.
load
in interface ParameterContext
reader
- The ParameterReader
from which to
fetch the values; it cannot be nullerrors
- The ErrorList
that captures any
errors while loading; it cannot be nullParameterContext.load(ParameterReader,ErrorList)
public final ErrorList validate()
ErrorList
containing validation errors;
it cannot be nullpublic final void validate(ErrorList errors)
ParameterContext
errors
.
validate
in interface ParameterContext
errors
- The ErrorList
that captures
validation errors; it cannot be nullParameterContext.validate(ErrorList)
public final void save(ParameterWriter writer)
ParameterContext
writer
.
save
in interface ParameterContext
writer
- The ParameterWriter
to which values
are written; it cannot be nullParameterContext.save(ParameterWriter)
protected final void loadInfo()
ParameterInfo
objects from
the file YourClass_parameter.properties
next to
YourClass.class
.
YourClass_parameter.properties
:
yourforum.notification_enabled.title=Flag to enable forum notifications yourforum.notification_enabled.purpose=Enables or disables forum notifications yourforum.notification_enabled.example=true yourforum.notifiaction_enabled.format=true|false
ParameterInfo
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |