org.lsst.ccs.bus
Class ObjectNType

java.lang.Object
  extended by org.lsst.ccs.bus.ObjectNType
All Implemented Interfaces:
Serializable

public class ObjectNType
extends Object
implements Serializable

This class contains information about an object and it class. this information can be used in different ways:

Beware: the name of the class does not guarantees that the "frozen" object can be deserialized since the version of the class can differ.

Author:
bamade
See Also:
Serialized Form

Field Summary
static Class[] WELL_KNOWN_TYPES
           
 
Constructor Summary
ObjectNType(char value)
           
ObjectNType(Class clazz, Serializable value)
          keeps an object in a serialization-safe manner.
ObjectNType(double value)
           
ObjectNType(float value)
           
ObjectNType(int value)
           
ObjectNType(long value)
           
ObjectNType(Serializable value)
          general constructor to keep an object safely
 
Method Summary
 String getClassName()
          the name of the class of the contained Object.
 Object getData()
          return the data contained in a safe way: if the class of the stored Object is not in the ClassPath an Exception is thrown
 Object getRawData()
          gets the content "as is" (without deserializing)
 boolean isOfPrimitiveType()
          is the data to be considered of a primitive type
 boolean isOfWellKnownType()
          being of a "well known type" means that the data has not been "safely" Serialized
static boolean isWellKnownType(Class clazz)
          is the class a "well known type" (primitive or defined in the constant array WELL_KNOWN_TYPES)
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WELL_KNOWN_TYPES

public static final Class[] WELL_KNOWN_TYPES
Constructor Detail

ObjectNType

public ObjectNType(Class clazz,
                   Serializable value)
keeps an object in a serialization-safe manner.

Parameters:
clazz - mostly used to note an object of a primitive type (e.g. Integer.TYPE)
value - can be null

ObjectNType

public ObjectNType(Serializable value)
general constructor to keep an object safely

Parameters:
value -

ObjectNType

public ObjectNType(int value)

ObjectNType

public ObjectNType(long value)

ObjectNType

public ObjectNType(float value)

ObjectNType

public ObjectNType(double value)

ObjectNType

public ObjectNType(char value)
Method Detail

isWellKnownType

public static boolean isWellKnownType(Class clazz)
is the class a "well known type" (primitive or defined in the constant array WELL_KNOWN_TYPES)

Parameters:
clazz -
Returns:

getClassName

public String getClassName()
the name of the class of the contained Object.

Returns:
can be null!

isOfPrimitiveType

public boolean isOfPrimitiveType()
is the data to be considered of a primitive type

Returns:

isOfWellKnownType

public boolean isOfWellKnownType()
being of a "well known type" means that the data has not been "safely" Serialized

Returns:

getData

public Object getData()
               throws ClassNotFoundException
return the data contained in a safe way: if the class of the stored Object is not in the ClassPath an Exception is thrown

Returns:
Throws:
ClassNotFoundException

getRawData

public Object getRawData()
gets the content "as is" (without deserializing)

Returns:

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 LSST. All Rights Reserved.