public class IlvValueBehavior extends IlvSingleBehavior
IlvValueBehavior
is used to store a value. When the
property handled by this behavior object is set, the specified value is
stored without any side effects. When the value is read, the last value
stored is returned.
This class is useful to store values that are used as parameters of other behavior objects.
Note that certain behavior classes do not store values. For example, the
class IlvConditionBehavior
tests a value, but does not store it.
Calling the get
method for this value will return
null
. Therefore, if you want to be able to read the value later,
you should attach an IlvValueBehavior
object to your prototype
in addition to the IlvConditionBehavior
object.
IlvConditionBehavior
,
IlvMultiRepBehavior
,
Serialized FormConstructor and Description |
---|
IlvValueBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvValueBehavior(IlvValueBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvValueBehavior(String name,
Class typeClass)
Creates a new value behavior.
|
Modifier and Type | Method and Description |
---|---|
IlvBehavior |
copy()
Returns a copy of the behavior.
|
protected Object |
get(IlvGroup group,
String name)
Returns the last value stored by this behavior object.
|
String |
getType()
Returns the class name of the current value stored by this behavior object.
|
protected void |
set(IlvGroup group,
String name,
Object value)
Sets the value stored by this behavior object to a new value.
|
void |
setType(String type)
Sets the type of the value stored by this behavior object.
|
String |
toString()
Returns a short text describing this behavior object.
|
void |
write(IlvOutputStream out)
Writes the behavior to an
IlvOutputStream . |
get, getName, getValueNames, set, setName
attach, detach, getParameter, isOutput, isReadable, isWritable
public IlvValueBehavior(String name, Class typeClass)
name
- the name of this behavior object.typeClass
- the class of the valuepublic IlvValueBehavior(IlvValueBehavior source)
source
- the behavior object to be copied.public IlvValueBehavior(IlvInputStream in) throws IlvReadFileException
IlvInputStream
stream. This
constructor must be called by the input constructors of subclasses.in
- The input stream.IlvReadFileException
- if the stream format is not correct.public void write(IlvOutputStream out) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
write
in class IlvSingleBehavior
out
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public IlvBehavior copy()
copy
in class IlvBehavior
protected void set(IlvGroup group, String name, Object value) throws IlvValueException
set
in class IlvSingleBehavior
group
- the group to which this behavior object is attached.name
- the name of this behavior object.value
- the new value to be stored.IlvValueException
- if an error occurred while setting a property.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
protected Object get(IlvGroup group, String name) throws IlvValueException
get
in class IlvSingleBehavior
group
- the group to which this behavior object is attached.name
- the name of this behavior object.IlvValueException
- if an error occurred while reading a property.IlvSingleBehavior.get(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
public String toString()
toString
in class IlvBehavior
public String getType()
"java.lang.Integer"
,
or the String "untyped"
if the value is
null
.public void setType(String type)
type
- the new value's class name, for example
"java.lang.Integer"
.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.