ilog.server.jcomp
Class MvValue

java.lang.Object
  |
  +--ilog.server.jcomp.MvValue
All Implemented Interfaces:
ilog.server.jcomp.Streamable

public class MvValue
extends java.lang.Object
implements ilog.server.jcomp.Streamable

This class encapsulates the value of the runtime attributes attached to representation objects. The Rogue Wave Server internal protocol uses this class to transmit attribute values between an object server and an application component.

Conversion: Conversion functions take the following form:

Type asType(boolean direct, Type default)

If the requested type is exactly the same as that of the stored value, the value is returned. Otherwise, default is returned.


Inner Class Summary
 class MvValue.Visitor
           
 
Constructor Summary
MvValue()
           
MvValue(MvValue v)
           
MvValue(java.lang.Object v)
           
MvValue(java.lang.Object v, int k)
           
MvValue(java.lang.Object v, MvDataType t)
           
 
Method Summary
 Any asAny()
          Equivalent to asAny(false).
 Any asAny(boolean direct)
          Equivalent to asAny(direct, null).
 Any asAny(boolean direct, Any def)
           
 boolean asBoolean()
          Equivalent to asBoolean(false).
 boolean asBoolean(boolean direct)
          Equivalent to asBoolean(direct,false).
 boolean asBoolean(boolean direct, boolean def)
           
 char asChar()
          Equivalent to asChar(false).
 char asChar(boolean direct)
          Equivalent to asChar(direct,'\0').
 char asChar(boolean direct, char def)
           
 double asDouble()
          Equivalent to asDouble(false).
 double asDouble(boolean direct)
          Equivalent to asDouble(direct, (double) 0.0 ).
 double asDouble(boolean direct, double defaultVal)
           
 MvFile asFile()
          Equivalent to asFile(false).
 MvFile asFile(boolean direct)
          Equivalent to asFile(direct, null).
 MvFile asFile(boolean direct, MvFile def)
           
 float asFloat()
          Equivalent to asFloat(false).
 float asFloat(boolean direct)
          Equivalent to asFloat(direct, (float) 0.0).
 float asFloat(boolean dir, float defl)
           
 HRef asHRef()
          Equivalent to asHRef(false).
 HRef asHRef(boolean direct)
          Equivalent to asHRef(direct, null).
 HRef asHRef(boolean direct, HRef def)
           
 int asInt()
          Equivalent to asInt(false).
 int asInt(boolean direct)
          Equivalent to (int) asLong(direct).
 long asLong()
          Equivalent to asLong(false).
 long asLong(boolean direct)
          Equivalent to asLong(direct, 0).
 long asLong(boolean direct, long def)
           
 MvRef asRef()
          Equivalent to asRef(false).
 MvRef asRef(boolean direct)
          Equivalent to asRef(direct, null).
 MvRef asRef(boolean direct, MvRef def)
           
 java.lang.String asString()
          Equivalent to asString(false).
 java.lang.String asString(boolean direct)
          Equivalent to asString(direct, "").
 java.lang.String asString(boolean direct, java.lang.String def)
           
 MvUserType asUserValue()
          Equivalent to asUserValue(null).
 MvUserType asUserValue(java.lang.Class type)
          Equivalent to asUserValue(type, null).
 MvUserType asUserValue(java.lang.Class type, MvUserType def)
           
 int getKind()
           
 java.lang.Object getValue()
           
 void set(MvValue v)
           
 MvMessage stream(MvMessage msg)
           
 java.lang.String stringValue(MvComponent c)
           
 java.lang.String toString()
           
 java.lang.String toString(boolean full)
           
static MvValue Unstream(MvMessage msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MvValue

public MvValue(java.lang.Object v,
               MvDataType t)
Parameters:
v - The value.

MvValue

public MvValue(java.lang.Object v,
               int k)

MvValue

public MvValue(java.lang.Object v)

MvValue

public MvValue()

MvValue

public MvValue(MvValue v)
Method Detail

getValue

public final java.lang.Object getValue()
Returns:
The value.

set

public void set(MvValue v)

getKind

public final int getKind()
Returns:
the kind.
See Also:
MvDataType

Unstream

public static MvValue Unstream(MvMessage msg)
                        throws ilog.server.jcomp.MvUserType.UnstreamException

stream

public MvMessage stream(MvMessage msg)
Specified by:
stream in interface ilog.server.jcomp.Streamable

asBoolean

public final boolean asBoolean(boolean direct)
Equivalent to asBoolean(direct,false).

asBoolean

public final boolean asBoolean()
Equivalent to asBoolean(false).

asChar

public final char asChar(boolean direct)
Equivalent to asChar(direct,'\0').

asChar

public final char asChar()
Equivalent to asChar(false).

asInt

public final int asInt(boolean direct)
Equivalent to (int) asLong(direct).

asInt

public final int asInt()
Equivalent to asInt(false).

asLong

public final long asLong(boolean direct)
Equivalent to asLong(direct, 0).

asLong

public final long asLong()
Equivalent to asLong(false).

asFloat

public final float asFloat(boolean direct)
Equivalent to asFloat(direct, (float) 0.0).

asFloat

public final float asFloat()
Equivalent to asFloat(false).

asDouble

public final double asDouble(boolean direct)
Equivalent to asDouble(direct, (double) 0.0 ).

asDouble

public final double asDouble()
Equivalent to asDouble(false).

asString

public final java.lang.String asString(boolean direct)
Equivalent to asString(direct, "").

asString

public final java.lang.String asString()
Equivalent to asString(false).

asAny

public final Any asAny(boolean direct)
Equivalent to asAny(direct, null).

asAny

public final Any asAny()
Equivalent to asAny(false).

asHRef

public final HRef asHRef(boolean direct)
Equivalent to asHRef(direct, null).

asHRef

public final HRef asHRef()
Equivalent to asHRef(false).

asRef

public final MvRef asRef(boolean direct)
Equivalent to asRef(direct, null).

asRef

public final MvRef asRef()
Equivalent to asRef(false).

asUserValue

public final MvUserType asUserValue(java.lang.Class type)
Equivalent to asUserValue(type, null).

asUserValue

public final MvUserType asUserValue()
Equivalent to asUserValue(null).

asFile

public final MvFile asFile(boolean direct)
Equivalent to asFile(direct, null).

asFile

public final MvFile asFile()
Equivalent to asFile(false).

asBoolean

public boolean asBoolean(boolean direct,
                         boolean def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asBoolean(def).
  • If the type is numeric (including char), true if different from 0), false otherwise.
  • Otherwise, true if the value is not null, false otherwise.

asChar

public char asChar(boolean direct,
                   char def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asChar(def).
  • If the type is numeric (including char), true if different from 0), false otherwise.
  • Otherwise, true if the value is not null, false otherwise.

asLong

public long asLong(boolean direct,
                   long def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asLong(def).
  • If the type is numeric (including char), the value converted to long.
  • If the type is boolean, 1 if true, 0 if false.
  • if the type is String, try to parse it as a long.

asFloat

public float asFloat(boolean dir,
                     float defl)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asFloat(def).
  • If the type is numeric (including char), the value converted to float.
  • If the type is boolean, 1.0 if true, 0.0 if false.
  • if the type is String, try to parse it as a float.

asDouble

public double asDouble(boolean direct,
                       double defaultVal)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asDouble(def).
  • If the type is numeric (including char), the value converted to double.
  • If the type is boolean, 1.0 if true, 0.0 if false.
  • if the type is String, try to parse it as a double.

asString

public java.lang.String asString(boolean direct,
                                 java.lang.String def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asString(def).
  • The value converted to String.

asAny

public Any asAny(boolean direct,
                 Any def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asAny(def).

asHRef

public HRef asHRef(boolean direct,
                   HRef def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value.

asRef

public MvRef asRef(boolean direct,
                   MvRef def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asRef(def).

asUserValue

public MvUserType asUserValue(java.lang.Class type,
                              MvUserType def)
Parameters:
type - The requested type.
def - The default result.
Returns:
If the match is precise, the contained value. Otherwise, and if an exact type match is not required:
  • If the type is user-defined, the result of asUserValue.asValue(type,def).

asFile

public MvFile asFile(boolean direct,
                     MvFile def)
Parameters:
direct - If true, an exact type match is required.
def - The default result.
Returns:
If the match is exact, the contained value. Otherwise, and if an exact type match is not required:
  • if the value contained is a string, an new MvFile with the string contents as name, and a null contents.
  • the default value in all other cases.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean full)

stringValue

public java.lang.String stringValue(MvComponent c)