com.arsdigita.util.parameter
Interface ParameterContext

All Known Subinterfaces:
Script
All Known Implementing Classes:
AbstractParameterContext, AbstractScript

public interface ParameterContext

Subject to change. A container of parameters. A parameter context binds together a set of parameters and keeps their values.

Version:
$Id: //core-platform/dev/src/com/arsdigita/util/parameter/ParameterContext.java#6 $
Author:
Justin Ross <jross@redhat.com>
See Also:
Parameter

Field Summary
static String versionId
           
 
Method Summary
 Object get(Parameter param)
          Gets the unmarshaled value of param.
 Object get(Parameter param, Object dephalt)
          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.
 void load(ParameterReader reader, ErrorList errors)
          Reads and unmarshals all values associated with the registered parameters from reader.
 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.
 void validate(ErrorList errors)
          Validates all values associated with the registered parameters.
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Method Detail

getParameters

public Parameter[] getParameters()
Returns all the parameters registered on the parameter context.

Returns:
A Parameter[] of all the parameters; it cannot be null

get

public Object get(Parameter param)
Gets the unmarshaled value of param. If the loaded value is null, param.getDefaultValue() is returned.

Parameters:
param - The named Parameter whose value to retrieve; it cannot be null
Returns:
The unmarshaled Java object value of param

get

public Object get(Parameter param,
                  Object dephalt)
Gets the unmarshaled value of param, returning dephalt if param's value is null.

Parameters:
param - The Parameter whose value to retrieve; it cannot be null
dephalt - The fallback default value; it may be null
Returns:
The unmarshaled Java object value of param or dephalt if the former is null

set

public void set(Parameter param,
                Object value)
Sets the value of param to value.

Parameters:
param - The Parameter whose value to set; it cannot be null
value - The new value of param; it may be null

load

public void load(ParameterReader reader,
                 ErrorList errors)
Reads and unmarshals all values associated with the registered parameters from reader. If any errors are encountered, they are added to errors.

Parameters:
reader - The ParameterReader from which to fetch the values; it cannot be null
errors - The ErrorList that captures any errors while loading; it cannot be null

save

public void save(ParameterWriter writer)
Marshals and writes all values associated with the registered parameters to writer.

Parameters:
writer - The ParameterWriter to which values are written; it cannot be null

validate

public void validate(ErrorList errors)
Validates all values associated with the registered parameters. Any errors encountered are added to errors.

Parameters:
errors - The ErrorList that captures validation errors; it cannot be null


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC