FileDocCategorySizeDatePackage
EmulatedFieldsForLoading.javaAPI DocAndroid 1.5 API11590Wed May 06 22:41:04 BST 2009java.io

EmulatedFieldsForLoading

public 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
ObjectInputStream.GetField
see
EmulatedFieldsForDumping

Fields Summary
private ObjectStreamClass
streamClass
private EmulatedFields
emulatedFields
Constructors Summary
EmulatedFieldsForLoading(ObjectStreamClass streamClass)
Constructs a new instance of EmulatedFieldsForDumping.

param
streamClass an ObjectStreamClass, defining the class for which to emulate fields.

        super();
        this.streamClass = streamClass;
        emulatedFields = new EmulatedFields(streamClass.getLoadFields(),
                streamClass.fields());
    
Methods Summary
public booleandefaulted(java.lang.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.

param
name A String, the name of the field to test
return
true if the field holds it default value, false otherwise.
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.defaulted(name);
    
EmulatedFieldsemulatedFields()
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.

return
array of ObjectSlot the receiver represents.

        return emulatedFields;
    
public java.lang.Objectget(java.lang.String name, java.lang.Object defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public shortget(java.lang.String name, short defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public booleanget(java.lang.String name, boolean defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public byteget(java.lang.String name, byte defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public charget(java.lang.String name, char defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public doubleget(java.lang.String name, double defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public floatget(java.lang.String name, float defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public intget(java.lang.String name, int defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public longget(java.lang.String name, long defaultValue)
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.

param
name A String, the name of the field to find
param
defaultValue Return value in case the field has not been assigned to yet.
return
the value of the given field if it has been assigned, or the default value otherwise
throws
IOException If an IO error occurs
throws
IllegalArgumentException If the corresponding field can not be found.

        return emulatedFields.get(name, defaultValue);
    
public java.io.ObjectStreamClassgetObjectStreamClass()
Return the class descriptor for which the emulated fields are defined.

return
ObjectStreamClass The class descriptor for which the emulated fields are defined.

        return streamClass;