org.springframework.jca.cci.core

Interface RecordExtractor<T>

  • Type Parameters:
    T - the result type
    All Known Implementing Classes:
    MappingRecordOperation.RecordExtractorImpl
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.


    @FunctionalInterface
    public interface RecordExtractor<T>
    Callback interface for extracting a result object from a CCI Record instance.

    Used for output object creation in CciTemplate. Alternatively, output Records can also be returned to client code as-is. In case of a CCI ResultSet as execution result, you will almost always want to implement a RecordExtractor, to be able to read the ResultSet in a managed fashion, with the CCI Connection still open while reading the ResultSet.

    Implementations of this interface perform the actual work of extracting results, but don't need to worry about exception handling. ResourceExceptions will be caught and handled correctly by the CciTemplate class.

    Since:
    1.2
    Author:
    Thierry Templier, Juergen Hoeller
    See Also:
    CciTemplate.execute(javax.resource.cci.InteractionSpec, Record, RecordExtractor), CciTemplate.execute(javax.resource.cci.InteractionSpec, RecordCreator, RecordExtractor), ResultSet
    • Method Detail

      • extractData

        @Nullable
        T extractData(Record record)
                         throws ResourceException,
                                java.sql.SQLException,
                                DataAccessException
        Process the data in the given Record, creating a corresponding result object.
        Parameters:
        record - the Record to extract data from (possibly a CCI ResultSet)
        Returns:
        an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case)
        Throws:
        ResourceException - if thrown by a CCI method, to be auto-converted to a DataAccessException
        java.sql.SQLException - if thrown by a ResultSet method, to be auto-converted to a DataAccessException
        DataAccessException - in case of custom exceptions
        See Also:
        ResultSet