Class AbstractCpoMetaAdapter

java.lang.Object
org.synchronoss.cpo.core.meta.AbstractCpoMetaAdapter
All Implemented Interfaces:
CpoMetaAdapter
Direct Known Subclasses:
CassandraCpoMetaAdapter, JdbcCpoMetaAdapter

public abstract class AbstractCpoMetaAdapter extends Object implements CpoMetaAdapter
Base CpoMetaAdapter implementation that maintains the in-memory map of loaded CpoClass metadata and the shared logic for loading that metadata from the JAXB-bound Ct* classes produced by unmarshalling a CPO meta XML document. Datastore-specific subclasses supply the DataTypeMapper and the concrete CpoClass/CpoAttribute/CpoFunctionGroup/CpoFunction/CpoArgument factory methods.
Author:
dberry
  • Method Details

    • getMetaClass

      public <T> CpoClass getMetaClass(T bean) throws CpoException
      Returns the metadata for the class that is contained within the metadata source

      Looks up the metadata by bean's exact class name first, then walks up the superclass/interface hierarchy until a match is found.

      Specified by:
      getMetaClass in interface CpoMetaAdapter
      Type Parameters:
      T - The bean Type
      Parameters:
      bean - The java bean whose metaclass is needed
      Returns:
      the CpoClass metadata for bean's class
      Throws:
      CpoException - Thrown if there are errors accessing the datasource
    • getCpoClasses

      public List<CpoClass> getCpoClasses()
      Returns a list of the cpo class objects that the meta adapter is aware of.
      Specified by:
      getCpoClasses in interface CpoMetaAdapter
      Returns:
      java.util.List of CpoClass
    • getDataTypeName

      public String getDataTypeName(CpoAttribute attribute)
      Gets the Java class name that the given attribute's native data type maps to.
      Specified by:
      getDataTypeName in interface CpoMetaAdapter
      Parameters:
      attribute - the attribute whose data type is being resolved
      Returns:
      the fully-qualified Java class name (array types are reported as byte[] or char[])
    • getDataTypeJavaClass

      public Class<?> getDataTypeJavaClass(CpoAttribute attribute)
      Gets the Java class that the given attribute's native data type maps to.
      Specified by:
      getDataTypeJavaClass in interface CpoMetaAdapter
      Parameters:
      attribute - the attribute whose data type is being resolved
      Returns:
      the Java class the attribute's value is represented as
    • getDataTypeInt

      public int getDataTypeInt(String dataTypeName) throws CpoException
      Gets the integer identifier for a named native data type.
      Specified by:
      getDataTypeInt in interface CpoMetaAdapter
      Parameters:
      dataTypeName - the native data type name
      Returns:
      the integer identifier registered for dataTypeName
      Throws:
      CpoException - if the data type name is not recognized
    • getDataTypeMapEntry

      public DataTypeMapEntry<?> getDataTypeMapEntry(int dataTypeInt) throws CpoException
      Gets the full data type mapping entry for a given native data type identifier.
      Specified by:
      getDataTypeMapEntry in interface CpoMetaAdapter
      Parameters:
      dataTypeInt - the integer identifier of the native data type
      Returns:
      the DataTypeMapEntry registered for dataTypeInt
      Throws:
      CpoException - if the data type identifier is not recognized
    • getAllowableDataTypes

      public List<String> getAllowableDataTypes() throws CpoException
      Gets the names of all native data types this meta adapter knows how to map.
      Specified by:
      getAllowableDataTypes in interface CpoMetaAdapter
      Returns:
      the list of allowable native data type names
      Throws:
      CpoException - if the data types cannot be retrieved