Class AeroMapper

java.lang.Object
com.aerospike.mapper.tools.AeroMapper
All Implemented Interfaces:
IAeroMapper, IBaseAeroMapper

public class AeroMapper
extends Object
implements IAeroMapper
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  AeroMapper.Builder  
  • Method Summary

    Modifier and Type Method Description
    <T> VirtualList<T> asBackedList​(@NotNull Class<?> owningClazz, @NotNull Object key, @NotNull String binName, Class<T> elementClazz)
    Create a virtual list against an attribute on a class.
    <T> VirtualList<T> asBackedList​(@NotNull Object object, @NotNull String binName, Class<T> elementClazz)
    Create a virtual list against an attribute on a class.
    IAeroMapper asMapper()  
    <T> boolean delete​(@NotNull Class<T> clazz, @NotNull Object userKey)
    Delete a record by specifying a class and a user key.
    boolean delete​(@NotNull Object object)
    Delete a record by specifying an object.
    <T> boolean delete​(com.aerospike.client.policy.WritePolicy writePolicy, @NotNull Class<T> clazz, @NotNull Object userKey)
    Delete a record by specifying a write policy, a class and a user key.
    boolean delete​(com.aerospike.client.policy.WritePolicy writePolicy, @NotNull Object object)
    Delete a record by specifying a write policy and an object.
    <T> void find​(@NotNull Class<T> clazz, Function<T,​Boolean> function)
    Find a record by specifying a class and a Boolean function.
    com.aerospike.client.policy.BatchPolicy getBatchPolicy​(Class<?> clazz)
    Return the batch policy to be used for the passed class.
    com.aerospike.client.IAerospikeClient getClient()  
    MappingConverter getMappingConverter()  
    com.aerospike.client.policy.QueryPolicy getQueryPolicy​(Class<?> clazz)
    Return the query policy to be used for the passed class.
    com.aerospike.client.policy.Policy getReadPolicy​(Class<?> clazz)
    Return the read policy to be used for the passed class.
    com.aerospike.client.policy.ScanPolicy getScanPolicy​(Class<?> clazz)
    Return the scan policy to be used for the passed class.
    com.aerospike.client.policy.WritePolicy getWritePolicy​(Class<?> clazz)
    Return the write policy to be used for the passed class.
    <T> void query​(@NotNull Class<T> clazz, @NotNull Processor<T> processor, com.aerospike.client.query.Filter filter)
    Perform a secondary index query with the specified query policy.
    <T> void query​(com.aerospike.client.policy.QueryPolicy policy, @NotNull Class<T> clazz, @NotNull Processor<T> processor, com.aerospike.client.query.Filter filter)
    Perform a secondary index query with the specified query policy.
    <T> List<T> query​(com.aerospike.client.policy.QueryPolicy policy, Class<T> clazz, com.aerospike.client.query.Filter filter)
    Perform a secondary index query with the specified query policy and returns the list of records converted to the appropriate class.
    <T> List<T> query​(Class<T> clazz, com.aerospike.client.query.Filter filter)
    Perform a secondary index query with the specified query policy and returns the list of records converted to the appropriate class.
    <T> T read​(@NotNull Class<T> clazz, @NotNull Object userKey)
    Read a record from the repository and map it to an instance of the passed class.
    <T> T[] read​(@NotNull Class<T> clazz, @NotNull Object[] userKeys)
    Read a batch of records from the repository and map them to an instance of the passed class.
    <T> T[] read​(@NotNull Class<T> clazz, @NotNull Object[] userKeys, com.aerospike.client.Operation... operations)
    Read a batch of records from the repository using read operations in one batch call and map them to an instance of the passed class.
    <T> T read​(@NotNull Class<T> clazz, @NotNull Object userKey, boolean resolveDependencies)
    This method should not be used: It is used by mappers to correctly resolved dependencies.
    <T> T[] read​(com.aerospike.client.policy.BatchPolicy batchPolicy, @NotNull Class<T> clazz, @NotNull Object[] userKeys)
    Read a batch of records from the repository and map them to an instance of the passed class.
    <T> T[] read​(com.aerospike.client.policy.BatchPolicy batchPolicy, @NotNull Class<T> clazz, @NotNull Object[] userKeys, com.aerospike.client.Operation... operations)
    Read a batch of records from the repository using read operations in one batch call and map them to an instance of the passed class.
    <T> T read​(com.aerospike.client.policy.Policy readPolicy, @NotNull Class<T> clazz, @NotNull Object userKey)
    Read a record from the repository and map it to an instance of the passed class.
    <T> T read​(com.aerospike.client.policy.Policy readPolicy, @NotNull Class<T> clazz, @NotNull Object userKey, boolean resolveDependencies)
    This method should not be used: It is used by mappers to correctly resolved dependencies.
    <T> T readFromDigest​(@NotNull Class<T> clazz, @javax.validation.constraints.NotNull byte[] digest)
    Read a record from the repository and map it to an instance of the passed class, by providing a digest.
    <T> T readFromDigest​(@NotNull Class<T> clazz, @javax.validation.constraints.NotNull byte[] digest, boolean resolveDependencies)
    This method should not be used: It is used by mappers to correctly resolved dependencies.
    <T> T readFromDigest​(com.aerospike.client.policy.Policy readPolicy, @NotNull Class<T> clazz, @javax.validation.constraints.NotNull byte[] digest)
    Read a record from the repository and map it to an instance of the passed class, by providing a digest.
    <T> T readFromDigest​(com.aerospike.client.policy.Policy readPolicy, @NotNull Class<T> clazz, @javax.validation.constraints.NotNull byte[] digest, boolean resolveDependencies)
    This method should not be used: It is used by mappers to correctly resolved dependencies.
    void save​(@NotNull com.aerospike.client.policy.WritePolicy writePolicy, @NotNull Object object, String... binNames)
    Save an object in the database with the given WritePolicy.
    void save​(@NotNull Object... objects)
    Save each object in the database.
    void save​(@NotNull Object object, String... binNames)
    Save an object in the database.
    <T> List<T> scan​(@NotNull Class<T> clazz)
    Scan every record in the set associated with the passed class and returns the list of records converted to the appropriate class.
    <T> void scan​(@NotNull Class<T> clazz, @NotNull Processor<T> processor)
    Scan every record in the set associated with the passed class.
    <T> void scan​(@NotNull Class<T> clazz, @NotNull Processor<T> processor, int recordsPerSecond)
    Scan every record in the set associated with the passed class, limiting the throughput to the specified recordsPerSecond.
    <T> List<T> scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull Class<T> clazz)
    Scan every record in the set associated with the passed class using a provided ScanPolicy and returns the list of records converted to the appropriate class.
    <T> void scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull Class<T> clazz, @NotNull Processor<T> processor)
    Scan every record in the set associated with the passed class.
    <T> void scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull Class<T> clazz, @NotNull Processor<T> processor, int recordsPerSecond)
    Scan every record in the set associated with the passed class.
    void update​(@NotNull Object object, String... binNames)
    Updates the object in the database, merging the record with the existing record.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • save

      public void save​(@NotNull @NotNull Object... objects) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Save each object in the database. This method will perform a REPLACE on the existing record so any existing data will be overwritten by the data in the passed object. This is a convenience method for
       save(A);
       save(B);
       save(C);
       
      Not that no transactionality is implied by this method -- if any of the save methods fail, the exception will be thrown without trying the other objects, nor attempting to roll back previously saved objects
      Specified by:
      save in interface IAeroMapper
      Parameters:
      objects - One or two objects to save.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • save

      public void save​(@NotNull @NotNull Object object, String... binNames) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Save an object in the database. This method will perform a REPLACE on the existing record so any existing data will be overwritten by the data in the passed object
      Specified by:
      save in interface IAeroMapper
      Parameters:
      object - The object to save.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • save

      public void save​(@NotNull @NotNull com.aerospike.client.policy.WritePolicy writePolicy, @NotNull @NotNull Object object, String... binNames) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Save an object in the database with the given WritePolicy. This write policy will override any other set writePolicy so is effectively an upsert operation
      Specified by:
      save in interface IAeroMapper
      Parameters:
      writePolicy - The write policy for the save operation.
      object - The object to save.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • update

      public void update​(@NotNull @NotNull Object object, String... binNames) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Updates the object in the database, merging the record with the existing record. This uses the RecordExistsAction of UPDATE. If bins are specified, only bins with the passed names will be updated (or all of them if null is passed)
      Specified by:
      update in interface IAeroMapper
      Parameters:
      object - The object to update.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • readFromDigest

      public <T> T readFromDigest​(@NotNull @NotNull Class<T> clazz, @NotNull @javax.validation.constraints.NotNull byte[] digest) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a record from the repository and map it to an instance of the passed class, by providing a digest.
      Specified by:
      readFromDigest in interface IAeroMapper
      Parameters:
      clazz - - The type of the record.
      digest - - The Aerospike digest (Unique server hash value generated from set name and user key).
      Returns:
      The returned mapped record.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • readFromDigest

      public <T> T readFromDigest​(@NotNull @NotNull Class<T> clazz, @NotNull @javax.validation.constraints.NotNull byte[] digest, boolean resolveDependencies) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      This method should not be used: It is used by mappers to correctly resolved dependencies.
      Specified by:
      readFromDigest in interface IAeroMapper
      Throws:
      com.aerospike.client.AerospikeException
    • readFromDigest

      public <T> T readFromDigest​(com.aerospike.client.policy.Policy readPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @javax.validation.constraints.NotNull byte[] digest) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a record from the repository and map it to an instance of the passed class, by providing a digest.
      Specified by:
      readFromDigest in interface IAeroMapper
      Parameters:
      readPolicy - - The read policy for the read operation.
      clazz - - The type of the record.
      digest - - The Aerospike digest (Unique server hash value generated from set name and user key).
      Returns:
      The returned mapped record.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • readFromDigest

      public <T> T readFromDigest​(com.aerospike.client.policy.Policy readPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @javax.validation.constraints.NotNull byte[] digest, boolean resolveDependencies) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      This method should not be used: It is used by mappers to correctly resolved dependencies.
      Specified by:
      readFromDigest in interface IAeroMapper
      Throws:
      com.aerospike.client.AerospikeException
    • read

      public <T> T read​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a record from the repository and map it to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      clazz - - The type of be returned.
      userKey - - The key of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      The returned mapped record.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • read

      public <T> T read​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey, boolean resolveDependencies) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      This method should not be used: It is used by mappers to correctly resolved dependencies.
      Specified by:
      read in interface IAeroMapper
      Throws:
      com.aerospike.client.AerospikeException
    • read

      public <T> T read​(com.aerospike.client.policy.Policy readPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a record from the repository and map it to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      readPolicy - - The read policy for the read operation.
      clazz - - The type of be returned.
      userKey - - The key of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      The returned mapped record.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • read

      public <T> T read​(com.aerospike.client.policy.Policy readPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey, boolean resolveDependencies) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      This method should not be used: It is used by mappers to correctly resolved dependencies.
      Specified by:
      read in interface IAeroMapper
      Throws:
      com.aerospike.client.AerospikeException
    • read

      public <T> T[] read​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object[] userKeys) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a batch of records from the repository and map them to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      clazz - - The type of be returned.
      userKeys - - The keys of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      The returned mapped records.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • read

      public <T> T[] read​(com.aerospike.client.policy.BatchPolicy batchPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object[] userKeys) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Read a batch of records from the repository and map them to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      batchPolicy - A given batch policy.
      clazz - - The type of be returned.
      userKeys - - The keys of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      The returned mapped records.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • read

      public <T> T[] read​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object[] userKeys, com.aerospike.client.Operation... operations)
      Description copied from interface: IAeroMapper
      Read a batch of records from the repository using read operations in one batch call and map them to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      clazz - - The type of be returned.
      userKeys - - The keys of the record. The namespace and set will be derived from the values specified on the passed class.
      operations - - array of read operations on record.
      Returns:
      The returned mapped records.
    • read

      public <T> T[] read​(com.aerospike.client.policy.BatchPolicy batchPolicy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object[] userKeys, com.aerospike.client.Operation... operations)
      Description copied from interface: IAeroMapper
      Read a batch of records from the repository using read operations in one batch call and map them to an instance of the passed class.
      Specified by:
      read in interface IAeroMapper
      Parameters:
      batchPolicy - A given batch policy.
      clazz - - The type of be returned.
      userKeys - - The keys of the record. The namespace and set will be derived from the values specified on the passed class.
      operations - - array of read operations on record.
      Returns:
      The returned mapped records.
    • delete

      public <T> boolean delete​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Delete a record by specifying a class and a user key.
      Specified by:
      delete in interface IAeroMapper
      Parameters:
      clazz - - The type of the record.
      userKey - - The key of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      whether record existed on server before deletion
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • delete

      public <T> boolean delete​(com.aerospike.client.policy.WritePolicy writePolicy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Object userKey) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Delete a record by specifying a write policy, a class and a user key.
      Specified by:
      delete in interface IAeroMapper
      Parameters:
      writePolicy - - The write policy for the delete operation.
      clazz - - The type of the record.
      userKey - - The key of the record. The namespace and set will be derived from the values specified on the passed class.
      Returns:
      whether record existed on server before deletion
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • delete

      public boolean delete​(@NotNull @NotNull Object object) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Delete a record by specifying an object.
      Specified by:
      delete in interface IAeroMapper
      Parameters:
      object - The object to delete.
      Returns:
      whether record existed on server before deletion
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • delete

      public boolean delete​(com.aerospike.client.policy.WritePolicy writePolicy, @NotNull @NotNull Object object) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Delete a record by specifying a write policy and an object.
      Specified by:
      delete in interface IAeroMapper
      Parameters:
      writePolicy - - The write policy for the delete operation.
      object - The object to delete.
      Returns:
      whether record existed on server before deletion
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • find

      public <T> void find​(@NotNull @NotNull Class<T> clazz, Function<T,​Boolean> function) throws com.aerospike.client.AerospikeException
      Description copied from interface: IAeroMapper
      Find a record by specifying a class and a Boolean function.
      Specified by:
      find in interface IAeroMapper
      Parameters:
      clazz - - The type of the record.
      function - a Boolean function.
      Throws:
      com.aerospike.client.AerospikeException - an AerospikeException will be thrown in case of an error.
    • scan

      public <T> void scan​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class. Each record will be converted to the appropriate class then passed to the processor. If the processor returns true, more records will be processed and if the processor returns false, the scan is aborted.

      Depending on the ScanPolicy set up for this class, it is possible for the processor to be called by multiple different threads concurrently, so the processor should be thread-safe

      Specified by:
      scan in interface IAeroMapper
      Parameters:
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
    • scan

      public <T> void scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class. Each record will be converted to the appropriate class then passed to the processor. If the processor returns true, more records will be processed and if the processor returns false, the scan is aborted.

      Depending on the policy passed or set as the ScanPolicy for this class, it is possible for the processor to be called by multiple different threads concurrently, so the processor should be thread-safe. Note that as a consequence of this, if the processor returns false to abort the scan there is a chance that records are being concurrently processed in other threads and this processing will not be interrupted.

      Specified by:
      scan in interface IAeroMapper
      Parameters:
      policy - - the scan policy to use. If this is null, the default scan policy of the passed class will be used.
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
    • scan

      public <T> void scan​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor, int recordsPerSecond)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class, limiting the throughput to the specified recordsPerSecond. Each record will be converted to the appropriate class then passed to the processor. If the processor returns true, more records will be processed and if the processor returns false, the scan is aborted.

      Depending on the ScanPolicy set up for this class, it is possible for the processor to be called by multiple different threads concurrently, so the processor should be thread-safe

      Specified by:
      scan in interface IAeroMapper
      Parameters:
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
      recordsPerSecond - - the maximum number of records to be processed every second.
    • scan

      public <T> void scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor, int recordsPerSecond)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class. Each record will be converted to the appropriate class then passed to the processor. If the processor returns true, more records will be processed and if the processor returns false, the scan is aborted.

      Depending on the policy passed or set as the ScanPolicy for this class, it is possible for the processor to be called by multiple different threads concurrently, so the processor should be thread-safe. Note that as a consequence of this, if the processor returns false to abort the scan there is a chance that records are being concurrently processed in other threads and this processing will not be interrupted.

      Specified by:
      scan in interface IAeroMapper
      Parameters:
      policy - - the scan policy to use. If this is null, the default scan policy of the passed class will be used.
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
      recordsPerSecond - - the number of records to process per second. Set to 0 for unlimited, > 0 for a finite rate, < 0 for no change (use the value from the passed policy)
    • scan

      public <T> List<T> scan​(@NotNull @NotNull Class<T> clazz)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class and returns the list of records converted to the appropriate class.
      Specified by:
      scan in interface IAeroMapper
      Parameters:
      clazz - - the class used to determine which set to scan and to convert the returned records to.
    • scan

      public <T> List<T> scan​(com.aerospike.client.policy.ScanPolicy policy, @NotNull @NotNull Class<T> clazz)
      Description copied from interface: IAeroMapper
      Scan every record in the set associated with the passed class using a provided ScanPolicy and returns the list of records converted to the appropriate class.
      Specified by:
      scan in interface IAeroMapper
      Parameters:
      policy - - the scan policy to use. If this is null, the default scan policy of the passed class will be used.
      clazz - - the class used to determine which set to scan and to convert the returned records to.
    • query

      public <T> void query​(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor, com.aerospike.client.query.Filter filter)
      Description copied from interface: IAeroMapper
      Perform a secondary index query with the specified query policy. Each record will be converted to the appropriate class then passed to the processor. If the processor returns false the query is aborted whereas if the processor returns true subsequent records (if any) are processed.

      The query policy used will be the one associated with the passed classtype.

      Specified by:
      query in interface IAeroMapper
      Parameters:
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
      filter - - the filter used to determine which secondary index to use. If this filter is null, every record in the set associated with the passed classtype will be scanned, effectively turning the query into a scan
    • query

      public <T> void query​(com.aerospike.client.policy.QueryPolicy policy, @NotNull @NotNull Class<T> clazz, @NotNull @NotNull Processor<T> processor, com.aerospike.client.query.Filter filter)
      Description copied from interface: IAeroMapper
      Perform a secondary index query with the specified query policy. Each record will be converted to the appropriate class then passed to the processor. If the processor returns false the query is aborted whereas if the processor returns true subsequent records (if any) are processed.
      Specified by:
      query in interface IAeroMapper
      Parameters:
      policy - - The query policy to use. If this parameter is not passed, the query policy associated with the passed classtype will be used
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      processor - - the Processor used to process each record
      filter - - the filter used to determine which secondary index to use. If this filter is null, every record in the set associated with the passed classtype will be scanned, effectively turning the query into a scan
    • query

      public <T> List<T> query​(Class<T> clazz, com.aerospike.client.query.Filter filter)
      Description copied from interface: IAeroMapper
      Perform a secondary index query with the specified query policy and returns the list of records converted to the appropriate class.

      The query policy used will be the one associated with the passed classtype.

      Specified by:
      query in interface IAeroMapper
      Parameters:
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      filter - - the filter used to determine which secondary index to use. If this filter is null, every record in the set associated with the passed classtype will be scanned, effectively turning the query into a scan
      Returns:
      List of records converted to the appropriate class
    • query

      public <T> List<T> query​(com.aerospike.client.policy.QueryPolicy policy, Class<T> clazz, com.aerospike.client.query.Filter filter)
      Description copied from interface: IAeroMapper
      Perform a secondary index query with the specified query policy and returns the list of records converted to the appropriate class.
      Specified by:
      query in interface IAeroMapper
      Parameters:
      policy - - The query policy to use. If this parameter is not passed, the query policy associated with the passed classtype will be used
      clazz - - the class used to determine which set to scan and to convert the returned records to.
      filter - - the filter used to determine which secondary index to use. If this filter is null, every record in the set associated with the passed classtype will be scanned, effectively turning the query into a scan
      Returns:
      List of records converted to the appropriate class
    • asBackedList

      public <T> VirtualList<T> asBackedList​(@NotNull @NotNull Object object, @NotNull @NotNull String binName, Class<T> elementClazz)
      Description copied from interface: IAeroMapper
      Create a virtual list against an attribute on a class. The list does all operations to the database and does not affect the underlying class, and is useful for situation when operations are needed to affect the database without having to return all the elements on the list each time.

      For example, consider a set of transactions associated with a credit card. Common operations might be

      • Return the last N transactions
      • insert a new transaction into the list
      These operation can all be done without having the full set of transactions
      Specified by:
      asBackedList in interface IAeroMapper
      Type Parameters:
      T - the type of the elements in the list.
      Parameters:
      object - The object that will use as a base for the virtual list.
      binName - The Aerospike bin name.
      elementClazz - The class of the elements in the list.
      Returns:
      A virtual list.
    • asBackedList

      public <T> VirtualList<T> asBackedList​(@NotNull @NotNull Class<?> owningClazz, @NotNull @NotNull Object key, @NotNull @NotNull String binName, Class<T> elementClazz)
      Description copied from interface: IAeroMapper
      Create a virtual list against an attribute on a class. The list does all operations to the database and does not affect the underlying class, and is useful for situation when operations are needed to affect the database without having to return all the elements on the list each time.

      Note that the object being mapped does not need to actually exist in this case. The owning class is used purely for the definitions of how to map the list elements (are they to be mapped in the database as a list or a map, is each element a list or a map, etc), as well as using the namespace / set definition for the location to map into the database. The passed key is used to map the object to the database.

      For example, consider a set of transactions associated with a credit card. Common operations might be

      • Return the last N transactions
      • insert a new transaction into the list
      These operation can all be done without having the full set of transactions
      Specified by:
      asBackedList in interface IAeroMapper
      Type Parameters:
      T - the type of the elements in the list.
      Parameters:
      owningClazz - Used for the definitions of how to map the list elements.
      key - The key to map the object to the database.
      binName - The Aerospike bin name.
      elementClazz - The class of the elements in the list.
      Returns:
      A virtual list.
    • getClient

      public com.aerospike.client.IAerospikeClient getClient()
      Specified by:
      getClient in interface IAeroMapper
    • getMappingConverter

      public MappingConverter getMappingConverter()
      Specified by:
      getMappingConverter in interface IBaseAeroMapper
    • asMapper

      public IAeroMapper asMapper()
      Specified by:
      asMapper in interface IBaseAeroMapper
    • getReadPolicy

      public com.aerospike.client.policy.Policy getReadPolicy​(Class<?> clazz)
      Description copied from interface: IBaseAeroMapper
      Return the read policy to be used for the passed class. This is a convenience method only and should rarely be needed
      Specified by:
      getReadPolicy in interface IBaseAeroMapper
      Parameters:
      clazz - - the class to return the read policy for.
      Returns:
      - the appropriate read policy. If none is set, the client's readPolicyDefault is returned.
    • getWritePolicy

      public com.aerospike.client.policy.WritePolicy getWritePolicy​(Class<?> clazz)
      Description copied from interface: IBaseAeroMapper
      Return the write policy to be used for the passed class. This is a convenience method only and should rarely be needed
      Specified by:
      getWritePolicy in interface IBaseAeroMapper
      Parameters:
      clazz - - the class to return the write policy for.
      Returns:
      - the appropriate write policy. If none is set, the client's writePolicyDefault is returned.
    • getBatchPolicy

      public com.aerospike.client.policy.BatchPolicy getBatchPolicy​(Class<?> clazz)
      Description copied from interface: IBaseAeroMapper
      Return the batch policy to be used for the passed class. This is a convenience method only and should rarely be needed
      Specified by:
      getBatchPolicy in interface IBaseAeroMapper
      Parameters:
      clazz - - the class to return the batch policy for.
      Returns:
      - the appropriate batch policy. If none is set, the client's batchPolicyDefault is returned.
    • getScanPolicy

      public com.aerospike.client.policy.ScanPolicy getScanPolicy​(Class<?> clazz)
      Description copied from interface: IBaseAeroMapper
      Return the scan policy to be used for the passed class. This is a convenience method only and should rarely be needed
      Specified by:
      getScanPolicy in interface IBaseAeroMapper
      Parameters:
      clazz - - the class to return the scan policy for.
      Returns:
      - the appropriate scan policy. If none is set, the client's scanPolicyDefault is returned.
    • getQueryPolicy

      public com.aerospike.client.policy.QueryPolicy getQueryPolicy​(Class<?> clazz)
      Description copied from interface: IBaseAeroMapper
      Return the query policy to be used for the passed class. This is a convenience method only and should rarely be needed
      Specified by:
      getQueryPolicy in interface IBaseAeroMapper
      Parameters:
      clazz - - the class to return the query policy for.
      Returns:
      - the appropriate query policy. If none is set, the client's queryPolicyDefault is returned.