Class ObjectPdxInstanceAdapter

java.lang.Object
org.springframework.geode.pdx.ObjectPdxInstanceAdapter
All Implemented Interfaces:
Serializable, org.apache.geode.pdx.PdxInstance

public class ObjectPdxInstanceAdapter extends Object implements org.apache.geode.pdx.PdxInstance
A PdxInstance implementation that adapts (wraps) a non-null Object as a PdxInstance.
Since:
1.3.0
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • from

      public static ObjectPdxInstanceAdapter from(@NonNull Object target)
      Factory method used to construct a new instance of the ObjectPdxInstanceAdapter from the given target Object.
      Parameters:
      target - Object to adapt as a PdxInstance; must not be null.
      Returns:
      a new instance of ObjectPdxInstanceAdapter.
      Throws:
      IllegalArgumentException - if Object is null.
      See Also:
    • unwrap

      @Nullable public static Object unwrap(@Nullable 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.
      Parameters:
      pdxInstance - PdxInstance to unwrap.
      Returns:
      the underlying, target Object from the given PdxInstance.
      See Also:
      • PdxInstance
    • getBeanWrapper

      @NonNull 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.
      Returns:
      a BeanWrapper for the target Object; never null.
      See Also:
      • BeanWrapper
    • getClassName

      public String getClassName()
      Returns the Class.getName() of the underlying, target Object.
      Specified by:
      getClassName in interface org.apache.geode.pdx.PdxInstance
      Returns:
      the Class.getName() of the underlying, target Object.
      See Also:
    • isDeserializable

      public boolean isDeserializable()
      Determines whether this 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.
      Specified by:
      isDeserializable in interface org.apache.geode.pdx.PdxInstance
      Returns:
      a boolean value indicating whether this PdxInstance can be deserialized back into an Object.
      See Also:
    • isEnum

      public boolean isEnum()
      Determines whether the underlying, target Object is an enumerated value type.
      Specified by:
      isEnum in interface org.apache.geode.pdx.PdxInstance
      Returns:
      a boolean value indicating whether the underlying, target Object is an enumerated value type.
      See Also:
    • getField

      public Object getField(String fieldName)
      Returns the value for the property identified by the given field name on the underlying, target Object.
      Specified by:
      getField in interface org.apache.geode.pdx.PdxInstance
      Parameters:
      fieldName - String containing the name of the field to get the value for.
      Returns:
      the value for the property identified by the given field name on the underlying, target Object.
      See Also:
    • getFieldNames

      public List<String> getFieldNames()
      Returns a List of field names based on the propeties from the underlying, target Object.
      Specified by:
      getFieldNames in interface org.apache.geode.pdx.PdxInstance
      Returns:
      a List of field names / properties serialized in the PDX bytes for the underlying, target Object.
      See Also:
    • isIdentityField

      public boolean isIdentityField(String fieldName)
      Determines whether the given field name is an identifier for this PdxInstance.
      Specified by:
      isIdentityField in interface org.apache.geode.pdx.PdxInstance
      Parameters:
      fieldName - String containing the name of the field to evaluate.
      Returns:
      a boolean value indicating whether the given field name is an identifier for this PdxInstance.
      See Also:
      • resolveIdentityFieldNameFromProperty(BeanWrapper)
    • getObject

      public Object getObject()
      Returns the target Object being adapted by this PdxInstance.
      Specified by:
      getObject in interface org.apache.geode.pdx.PdxInstance
      Returns:
      the target Object being adapted by this PdxInstance; never null.
      See Also:
    • createWriter

      public org.apache.geode.pdx.WritablePdxInstance createWriter()
      Specified by:
      createWriter in interface org.apache.geode.pdx.PdxInstance
    • hasField

      public boolean hasField(String fieldName)
      Determines whether the given field name is a property on the underlying, target Object.
      Specified by:
      hasField in interface org.apache.geode.pdx.PdxInstance
      Parameters:
      fieldName - String containing the name of the field to match against a property from the underlying, target Object.
      Returns:
      a boolean value that determines whether the given field name is a property on the underlying, target Object.
      See Also: