net.sourceforge.jparam.paramset
Class Param

java.lang.Object
  |
  +--net.sourceforge.jparam.paramset.Param
Direct Known Subclasses:
ioParam, iParam, oParam

public class Param
extends java.lang.Object

Represents a single parameter in a ParamSet


Field Summary
(package private)  java.lang.Object assignedValue
           
(package private)  java.lang.Object defaultValue
           
(package private)  boolean isInput
           
(package private)  boolean isOutput
           
(package private)  java.lang.Class typeBound
           
 
Constructor Summary
protected Param(java.lang.String name_description, boolean isInput, boolean isOutput, java.lang.Object defaultValue, java.lang.Class typeBound)
          Creates a Param object with given attributes.
 
Method Summary
protected  void clearValue()
           
 java.lang.Object getDefaultValue()
          Returns the parameter's default value, or null if it has none.
 java.lang.String getDescription()
          Returns the parameter's description.
 java.lang.String getName()
          Returns the parameter's name.
 java.lang.Class getTypeBound()
          Returns the parameter's type bound.
 java.lang.Object getValue()
          Returns the parameter's current value, or null if no such value exists.
 boolean hasDefaultValue()
           
 boolean hasGivenValue()
           
 boolean isInput()
          Returns whether the parameter is an input parameter
 boolean isOutput()
          Returns whether the parameter is an output parameter
 void setDefaultValue(java.lang.Object defaultValue)
          Sets the parameter's default value.
 void setDescription(java.lang.String description)
          Sets the parameter's description.
 void setValue(java.lang.Object value)
          Sets the parameter's current value.
 boolean wasAssignedTo()
          Returns whether the parameter was assigned a value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isInput

boolean isInput

isOutput

boolean isOutput

defaultValue

java.lang.Object defaultValue

assignedValue

java.lang.Object assignedValue

typeBound

java.lang.Class typeBound
Constructor Detail

Param

protected Param(java.lang.String name_description,
                boolean isInput,
                boolean isOutput,
                java.lang.Object defaultValue,
                java.lang.Class typeBound)
         throws JParamException
Creates a Param object with given attributes. Set defaultValue to null to indicate there's no default value.
Method Detail

clearValue

protected void clearValue()

getName

public java.lang.String getName()
Returns the parameter's name.

getDescription

public java.lang.String getDescription()
Returns the parameter's description.

setDescription

public void setDescription(java.lang.String description)
Sets the parameter's description.

isInput

public boolean isInput()
Returns whether the parameter is an input parameter

isOutput

public boolean isOutput()
Returns whether the parameter is an output parameter

wasAssignedTo

public boolean wasAssignedTo()
Returns whether the parameter was assigned a value. If the parameter has a default value, this method may return false, but getValue will still return a non null object.

hasDefaultValue

public boolean hasDefaultValue()

hasGivenValue

public boolean hasGivenValue()

getTypeBound

public java.lang.Class getTypeBound()
Returns the parameter's type bound. If getValue() returns a valid object (non null), then it is guaranteed to be assignable to a variable of this class.

getValue

public java.lang.Object getValue()
Returns the parameter's current value, or null if no such value exists.

setValue

public void setValue(java.lang.Object value)
              throws JParamException
Sets the parameter's current value. If val is not null, then calls to wasAssignedTo() following this call will return true. If val is null, this removed the parameter's value, and resets wasAssignedTo(), so it will return false.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the parameter's default value, or null if it has none.

setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
                     throws JParamException
Sets the parameter's default value. null removes it. If defaultValue isn't null, it must be compatible with the parameter's typeBound.


Copyright © 2004 SourceForge. All Rights Reserved.