Package org.synchronoss.cpo.core.meta
Class ResultSetCpoData
java.lang.Object
org.synchronoss.cpo.core.AbstractCpoData
org.synchronoss.cpo.core.meta.AbstractBindableCpoData
org.synchronoss.cpo.core.meta.ResultSetCpoData
- All Implemented Interfaces:
CpoData
- Direct Known Subclasses:
CassandraResultSetCpoData,JdbcResultSetCpoData
Base
CpoData implementation for reading a bound attribute's
value out of a datastore result row (e.g. a JDBC ResultSet or Cassandra Row).
Resolves the appropriate MethodMapEntry for the attribute's data type on first use and
caches it, since it cannot change across invocations of the same bound instance; datastore
implementations supply the actual reflective invocation via invokeGetterImpl(org.synchronoss.cpo.core.meta.domain.CpoAttribute, org.synchronoss.cpo.core.meta.MethodMapEntry<?, ?>).- Author:
- dberry
-
Constructor Summary
ConstructorsConstructorDescriptionResultSetCpoData(MethodMapper<?> methodMapper, Object rs, CpoAttribute cpoAttribute, int index) Creates an instance bound to a single column/attribute of the given result row. -
Method Summary
Modifier and TypeMethodDescriptiongetRs()Gets the datastore-specific result row object this instance reads from.Invokes the bean's getter for the bound attribute.Methods inherited from class org.synchronoss.cpo.core.meta.AbstractBindableCpoData
getIndexMethods inherited from class org.synchronoss.cpo.core.AbstractCpoData
getCpoAttribute, getDataGetterReturnType, getDataSetterParamType, invokeSetter, setCpoAttribute, transformIn, transformOut
-
Constructor Details
-
ResultSetCpoData
public ResultSetCpoData(MethodMapper<?> methodMapper, Object rs, CpoAttribute cpoAttribute, int index) Creates an instance bound to a single column/attribute of the given result row.- Parameters:
methodMapper- the mapper used to resolve the getter method for the attribute's data typers- the datastore-specific result row object (e.g.ResultSetorRow)cpoAttribute- the attribute this instance readsindex- the positional index (e.g. column index) of this binding
-
-
Method Details
-
getRs
Gets the datastore-specific result row object this instance reads from.- Returns:
- the result row object (e.g.
ResultSetorRow)
-
invokeGetter
Invokes the bean's getter for the bound attribute.Not implemented by this base class; subclasses that support reflective getter invocation must override this method.
Resolves (and caches) the
MethodMapEntryfor the attribute's data getter return type, invokes the datastore-specific getter viainvokeGetterImpl(org.synchronoss.cpo.core.meta.domain.CpoAttribute, org.synchronoss.cpo.core.meta.MethodMapEntry<?, ?>), and applies the attribute's transform.- Specified by:
invokeGetterin interfaceCpoData- Overrides:
invokeGetterin classAbstractCpoData- Returns:
- the value returned by the attribute's getter
- Throws:
CpoException- if the getter cannot be invoked
-