Build 1.0_r1(from source)

java.io
Class EmulatedFieldsForLoading

java.lang.Object
  extended by java.io.ObjectInputStream.GetField
      extended by java.io.EmulatedFieldsForLoading

 class EmulatedFieldsForLoading
extends ObjectInputStream.GetField

An EmulatedFieldsForLoading is an object that represents a set of emulated fields for an object being loaded. It is a concrete implementation for ObjectInputStream.GetField

See Also:
ObjectInputStream.GetField, EmulatedFieldsForDumping

Constructor Summary
EmulatedFieldsForLoading(ObjectStreamClass streamClass)
          Constructs a new instance of EmulatedFieldsForDumping.
 
Method Summary
 boolean defaulted(String name)
          Return a boolean indicating if the field named name has been assigned a value explicitly (false) or if it still holds a default value for the type (true) because it hasn't been assigned to yet.
(package private)  EmulatedFields emulatedFields()
          Return the actual EmulatedFields instance used by the receiver.
 boolean get(String name, boolean defaultValue)
          Find and return the boolean value of a given field named name in the receiver.
 byte get(String name, byte defaultValue)
          Find and return the byte value of a given field named name in the receiver.
 char get(String name, char defaultValue)
          Find and return the char value of a given field named name in the receiver.
 double get(String name, double defaultValue)
          Find and return the double value of a given field named name in the receiver.
 float get(String name, float defaultValue)
          Find and return the float value of a given field named name in the receiver.
 int get(String name, int defaultValue)
          Find and return the int value of a given field named name in the receiver.
 long get(String name, long defaultValue)
          Find and return the long value of a given field named name in the receiver.
 Object get(String name, Object defaultValue)
          Find and return the Object value of a given field named name in the receiver.
 short get(String name, short defaultValue)
          Find and return the short value of a given field named name in the receiver.
 ObjectStreamClass getObjectStreamClass()
          Return the class descriptor for which the emulated fields are defined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmulatedFieldsForLoading

EmulatedFieldsForLoading(ObjectStreamClass streamClass)
Constructs a new instance of EmulatedFieldsForDumping.

Parameters:
streamClass - an ObjectStreamClass, defining the class for which to emulate fields.
Method Detail

defaulted

public boolean defaulted(String name)
                  throws IOException,
                         IllegalArgumentException
Return a boolean indicating if the field named name has been assigned a value explicitly (false) or if it still holds a default value for the type (true) because it hasn't been assigned to yet.

Specified by:
defaulted in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to test
Returns:
true if the field holds it default value, false otherwise.
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

emulatedFields

EmulatedFields emulatedFields()
Return the actual EmulatedFields instance used by the receiver. We have the actual work in a separate class so that the code can be shared. The receiver has to be of a subclass of GetField.

Returns:
array of ObjectSlot the receiver represents.

get

public byte get(String name,
                byte defaultValue)
         throws IOException,
                IllegalArgumentException
Find and return the byte value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public char get(String name,
                char defaultValue)
         throws IOException,
                IllegalArgumentException
Find and return the char value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public double get(String name,
                  double defaultValue)
           throws IOException,
                  IllegalArgumentException
Find and return the double value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public float get(String name,
                 float defaultValue)
          throws IOException,
                 IllegalArgumentException
Find and return the float value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public int get(String name,
               int defaultValue)
        throws IOException,
               IllegalArgumentException
Find and return the int value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public long get(String name,
                long defaultValue)
         throws IOException,
                IllegalArgumentException
Find and return the long value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public Object get(String name,
                  Object defaultValue)
           throws IOException,
                  IllegalArgumentException
Find and return the Object value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public short get(String name,
                 short defaultValue)
          throws IOException,
                 IllegalArgumentException
Find and return the short value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

get

public boolean get(String name,
                   boolean defaultValue)
            throws IOException,
                   IllegalArgumentException
Find and return the boolean value of a given field named name in the receiver. If the field has not been assigned any value yet, the default value defaultValue is returned instead.

Specified by:
get in class ObjectInputStream.GetField
Parameters:
name - A String, the name of the field to find
defaultValue - Return value in case the field has not been assigned to yet.
Returns:
the value of the given field if it has been assigned, or the default value otherwise
Throws:
IOException - If an IO error occurs
IllegalArgumentException - If the corresponding field can not be found.

getObjectStreamClass

public ObjectStreamClass getObjectStreamClass()
Return the class descriptor for which the emulated fields are defined.

Specified by:
getObjectStreamClass in class ObjectInputStream.GetField
Returns:
ObjectStreamClass The class descriptor for which the emulated fields are defined.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature