Class OptionsBuilder

java.lang.Object
org.springframework.data.couchbase.core.query.OptionsBuilder

public class OptionsBuilder extends Object
Methods for building Options objects for Couchbae APIs.
Author:
Michael Reiche, Tigran Babloyan
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A extends Annotation, V>
    A
    annotation(Class<A> annotation, String attributeName, V defaultValue, AnnotatedElement... elements)
    return the first merged annotation which does not have attribute with null/defaultValue from the listed elements.
    static <A extends Annotation, V>
    A
    annotation(Class<A> annotation, V defaultValue, AnnotatedElement[] elements)
     
    static <A extends Annotation, V>
    V
    annotationAttribute(Class<A> annotation, String attributeName, V defaultValue, AnnotatedElement[] elements)
    return the first merged annotation which is not null/defaultValue from the listed elements.
    static <A extends Annotation>
    String
    annotationString(Class<A> annotation, Object defaultValue, AnnotatedElement[] elements)
     
    static <A extends Annotation>
    String
    annotationString(Class<A> annotation, String attributeName, Object defaultValue, AnnotatedElement[] elements)
    return the toString() of the first merged annotation which is not null/defaultValue from the listed elements.
    static com.couchbase.client.java.kv.ExistsOptions
    buildExistsOptions(com.couchbase.client.java.kv.ExistsOptions options)
     
    static com.couchbase.client.java.kv.InsertOptions
    buildInsertOptions(com.couchbase.client.java.kv.InsertOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc)
     
    static Meta
    buildMeta(CouchbaseQueryMethod method, Class<?> typeToRead)
     
    static com.couchbase.client.java.kv.MutateInOptions
    buildMutateInOptions(com.couchbase.client.java.kv.MutateInOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc, Long cas)
     
    static com.couchbase.client.java.kv.RemoveOptions
    buildRemoveOptions(com.couchbase.client.java.kv.RemoveOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Long cas)
     
    static com.couchbase.client.java.kv.ReplaceOptions
    buildReplaceOptions(com.couchbase.client.java.kv.ReplaceOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, Long cas, CouchbaseDocument doc)
     
    static com.couchbase.client.java.kv.ScanOptions
    buildScanOptions(com.couchbase.client.java.kv.ScanOptions options, Object sort, Boolean idsOnly, com.couchbase.client.java.kv.MutationState mutationState, Integer batchByteLimit, Integer batchItemLimit)
     
    static com.couchbase.client.java.transactions.TransactionQueryOptions
    buildTransactionQueryOptions(com.couchbase.client.java.query.QueryOptions options)
     
    static com.couchbase.client.java.kv.UpsertOptions
    buildUpsertOptions(com.couchbase.client.java.kv.UpsertOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc)
     
    static <T> T
    fromFirst(T deflt, Object... choice)
    Get the most-specific
    static String
    getCollectionFrom(Class<?> domainType)
    collection annotation
    static com.couchbase.client.core.msg.kv.DurabilityLevel
    getDurabilityLevel(Class<?> domainType, CouchbaseConverter converter)
     
    static com.couchbase.client.java.kv.PersistTo
    getPersistTo(Class<?> domainType)
     
    static com.couchbase.client.java.json.JsonObject
    getQueryOpts(com.couchbase.client.java.query.QueryOptions.Built optsBuilt)
     
    static com.couchbase.client.java.kv.ReplicateTo
    getReplicateTo(Class<?> domainType)
     
    static String
    getScopeFrom(Class<?> domainType)
    scope annotation
    static com.couchbase.client.core.api.query.CoreQueryContext
    queryContext(String scope, String collection, String bucketName)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OptionsBuilder

      public OptionsBuilder()
  • Method Details

    • buildTransactionQueryOptions

      public static com.couchbase.client.java.transactions.TransactionQueryOptions buildTransactionQueryOptions(com.couchbase.client.java.query.QueryOptions options)
    • buildExistsOptions

      public static com.couchbase.client.java.kv.ExistsOptions buildExistsOptions(com.couchbase.client.java.kv.ExistsOptions options)
    • buildInsertOptions

      public static com.couchbase.client.java.kv.InsertOptions buildInsertOptions(com.couchbase.client.java.kv.InsertOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc)
    • buildUpsertOptions

      public static com.couchbase.client.java.kv.UpsertOptions buildUpsertOptions(com.couchbase.client.java.kv.UpsertOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc)
    • buildMutateInOptions

      public static com.couchbase.client.java.kv.MutateInOptions buildMutateInOptions(com.couchbase.client.java.kv.MutateInOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, CouchbaseDocument doc, Long cas)
    • buildReplaceOptions

      public static com.couchbase.client.java.kv.ReplaceOptions buildReplaceOptions(com.couchbase.client.java.kv.ReplaceOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Duration expiry, Long cas, CouchbaseDocument doc)
    • buildRemoveOptions

      public static com.couchbase.client.java.kv.RemoveOptions buildRemoveOptions(com.couchbase.client.java.kv.RemoveOptions options, com.couchbase.client.java.kv.PersistTo persistTo, com.couchbase.client.java.kv.ReplicateTo replicateTo, com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel, Long cas)
    • getScopeFrom

      public static String getScopeFrom(Class<?> domainType)
      scope annotation
      Parameters:
      domainType -
      Returns:
    • getDurabilityLevel

      public static com.couchbase.client.core.msg.kv.DurabilityLevel getDurabilityLevel(Class<?> domainType, CouchbaseConverter converter)
    • getPersistTo

      public static com.couchbase.client.java.kv.PersistTo getPersistTo(Class<?> domainType)
    • getReplicateTo

      public static com.couchbase.client.java.kv.ReplicateTo getReplicateTo(Class<?> domainType)
    • getCollectionFrom

      public static String getCollectionFrom(Class<?> domainType)
      collection annotation
      Parameters:
      domainType -
      Returns:
    • getQueryOpts

      public static com.couchbase.client.java.json.JsonObject getQueryOpts(com.couchbase.client.java.query.QueryOptions.Built optsBuilt)
    • fromFirst

      public static <T> T fromFirst(T deflt, Object... choice)
      Get the most-specific
      Type Parameters:
      T -
      Parameters:
      deflt - the default value, which we treat as not set
      choice - array of values or Optional<values>, ordered from most to least specific
      Returns:
      the most specific choice
    • buildMeta

      public static Meta buildMeta(CouchbaseQueryMethod method, Class<?> typeToRead)
    • annotation

      public static <A extends Annotation, V> A annotation(Class<A> annotation, String attributeName, V defaultValue, AnnotatedElement... elements)
      return the first merged annotation which does not have attribute with null/defaultValue from the listed elements.
      Type Parameters:
      A -
      Parameters:
      annotation -
      attributeName -
      defaultValue -
      elements -
      Returns:
    • annotation

      public static <A extends Annotation, V> A annotation(Class<A> annotation, V defaultValue, AnnotatedElement[] elements)
    • annotationAttribute

      public static <A extends Annotation, V> V annotationAttribute(Class<A> annotation, String attributeName, V defaultValue, AnnotatedElement[] elements)
      return the first merged annotation which is not null/defaultValue from the listed elements.
      Type Parameters:
      A -
      Parameters:
      annotation -
      defaultValue -
      elements -
      Returns:
    • annotationString

      public static <A extends Annotation> String annotationString(Class<A> annotation, String attributeName, Object defaultValue, AnnotatedElement[] elements)
      return the toString() of the first merged annotation which is not null/defaultValue from the listed elements.
      Type Parameters:
      A -
      Parameters:
      annotation -
      defaultValue -
      elements -
      Returns:
    • annotationString

      public static <A extends Annotation> String annotationString(Class<A> annotation, Object defaultValue, AnnotatedElement[] elements)
    • buildScanOptions

      public static com.couchbase.client.java.kv.ScanOptions buildScanOptions(com.couchbase.client.java.kv.ScanOptions options, Object sort, Boolean idsOnly, com.couchbase.client.java.kv.MutationState mutationState, Integer batchByteLimit, Integer batchItemLimit)
    • queryContext

      public static com.couchbase.client.core.api.query.CoreQueryContext queryContext(String scope, String collection, String bucketName)