public class ObjectPdxInstanceAdapter
extends java.lang.Object
implements org.apache.geode.pdx.PdxInstance
PdxInstance
implementation that adapts (wraps) a non-null Object
as a PdxInstance
.PropertyDescriptor
,
Field
,
PdxInstance
,
WritablePdxInstance
,
BeanWrapper
,
PropertyAccessor
,
PropertyAccessorFactory
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CLASS_PROPERTY_NAME |
protected static java.lang.String |
ID_PROPERTY_NAME |
Constructor and Description |
---|
ObjectPdxInstanceAdapter(java.lang.Object target)
Constructs a new instance of
ObjectPdxInstanceAdapter initialized with the given Object . |
Modifier and Type | Method and Description |
---|---|
org.apache.geode.pdx.WritablePdxInstance |
createWriter() |
static ObjectPdxInstanceAdapter |
from(java.lang.Object target)
Factory method used to construct a new instance of the
ObjectPdxInstanceAdapter from
the given target Object . |
protected org.springframework.beans.BeanWrapper |
getBeanWrapper()
Returns a
BeanWrapper wrapping the target Object in order to access the Object
as a Java bean using JavaBeans conventions. |
java.lang.String |
getClassName()
Returns the
Class.getName() of the underlying, target Object . |
java.lang.Object |
getField(java.lang.String fieldName)
Returns the
value for the property identified by
the given field name on the underlying, target Object . |
java.util.List<java.lang.String> |
getFieldNames()
Returns a
List of field names based on the propeties
from the underlying, target Object . |
java.lang.Object |
getObject()
Returns the target
Object being adapted by this PdxInstance . |
boolean |
hasField(java.lang.String fieldName)
Determines whether the given
field name is a property
on the underlying, target Object . |
boolean |
isDeserializable()
Determines whether this
PdxInstance can be deserialized back into an Object . |
boolean |
isEnum()
Determines whether the underlying, target
Object is an enumerated value type . |
boolean |
isIdentityField(java.lang.String fieldName)
Determines whether the given
field name is an identifier for this PdxInstance . |
static java.lang.Object |
unwrap(org.apache.geode.pdx.PdxInstance pdxInstance)
Null-safe factory method used to unwrap the given
PdxInstance , returning the underlying, target
Object upon which this PdxInstance is based. |
protected static final java.lang.String CLASS_PROPERTY_NAME
protected static final java.lang.String ID_PROPERTY_NAME
public ObjectPdxInstanceAdapter(java.lang.Object target)
ObjectPdxInstanceAdapter
initialized with the given Object
.target
- Object
to adapt as a PdxInstance
; must not be null.java.lang.IllegalArgumentException
- if Object
is null.Object
public static ObjectPdxInstanceAdapter from(@NonNull java.lang.Object target)
ObjectPdxInstanceAdapter
from
the given target Object
.target
- Object
to adapt as a PdxInstance
; must not be null.ObjectPdxInstanceAdapter
.java.lang.IllegalArgumentException
- if Object
is null.ObjectPdxInstanceAdapter(Object)
@Nullable public static java.lang.Object unwrap(@Nullable org.apache.geode.pdx.PdxInstance pdxInstance)
PdxInstance
, returning the underlying, target
Object
upon which this PdxInstance
is based.pdxInstance
- PdxInstance
to unwrap.Object
from the given PdxInstance
.PdxInstance
@NonNull protected org.springframework.beans.BeanWrapper getBeanWrapper()
BeanWrapper
wrapping the target Object
in order to access the Object
as a Java bean using JavaBeans conventions.BeanWrapper
for the target Object
; never null.BeanWrapper
public java.lang.String getClassName()
Class.getName()
of the underlying, target Object
.getClassName
in interface org.apache.geode.pdx.PdxInstance
Class.getName()
of the underlying, target Object
.Object.getClass()
,
Class.getName()
,
getObject()
public boolean isDeserializable()
PdxInstance
can be deserialized back into an Object
.
This method effectively returns true since this PdxInstance
implementation is an adapter
for an underlying, target Object
in the first place.isDeserializable
in interface org.apache.geode.pdx.PdxInstance
PdxInstance
can be deserialized
back into an Object
.getObject()
public boolean isEnum()
Object
is an enumerated value
type
.isEnum
in interface org.apache.geode.pdx.PdxInstance
Object
is an enumerated value
type
.Object.getClass()
,
Class.isEnum()
,
getObject()
public java.lang.Object getField(java.lang.String fieldName)
value
for the property
identified by
the given field name
on the underlying, target Object
.getField
in interface org.apache.geode.pdx.PdxInstance
fieldName
- String
containing the name of the field to get the value
for.value
for the property
identified by
the given field name
on the underlying, target Object
.PropertyAccessor.getPropertyValue(String)
,
getBeanWrapper()
public java.util.List<java.lang.String> getFieldNames()
List
of field names
based on the propeties
from the underlying, target Object
.getFieldNames
in interface org.apache.geode.pdx.PdxInstance
List
of field names
/ properties
serialized
in the PDX bytes for the underlying, target Object
.BeanWrapper.getPropertyDescriptors()
,
PropertyDescriptor
,
getBeanWrapper()
public boolean isIdentityField(java.lang.String fieldName)
field name
is an identifier for this PdxInstance
.isIdentityField
in interface org.apache.geode.pdx.PdxInstance
fieldName
- String
containing the name of the field to evaluate.field name
is an identifier for
this PdxInstance
.resolveIdentityFieldNameFromProperty(BeanWrapper)
public java.lang.Object getObject()
Object
being adapted by this PdxInstance
.getObject
in interface org.apache.geode.pdx.PdxInstance
Object
being adapted by this PdxInstance
; never null.Object
public org.apache.geode.pdx.WritablePdxInstance createWriter()
createWriter
in interface org.apache.geode.pdx.PdxInstance
public boolean hasField(java.lang.String fieldName)
field name
is a property
on the underlying, target Object
.hasField
in interface org.apache.geode.pdx.PdxInstance
fieldName
- String
containing the name of the field to match against
a property
from the underlying, target Object
.field name
is a property
on the underlying, target Object
.getFieldNames()