public abstract static class Mapper.Option extends Object
Options can be passed to individual operations:
mapper.save(myObject, Option.ttl(3600));
The mapper can also have defaults, that will apply to all operations that do not override these particular option:
mapper.setDefaultSaveOptions(Option.ttl(3600)); mapper.save(myObject);
See the static methods in this class for available options.
Modifier | Constructor and Description |
---|---|
protected |
Option(com.datastax.driver.mapping.Mapper.Option.Type type) |
Modifier and Type | Method and Description |
---|---|
static Mapper.Option |
consistencyLevel(ConsistencyLevel cl)
Creates a new Option object to add a consistency level value to a mapper operation.
|
com.datastax.driver.mapping.Mapper.Option.Type |
getType()
Deprecated.
This method is public for backward compatibility only. It should not be
accessible since it leaks a package-private type.
|
static Mapper.Option |
ifNotExists(boolean enabled)
Creates a new Option object to specify whether an IF NOT EXISTS clause should be included in
insert queries.
|
static Mapper.Option |
saveNullFields(boolean enabled)
Creates a new Option object to specify whether null entity fields should be included in
insert queries.
|
static Mapper.Option |
timestamp(long timestamp)
Creates a new Option object to add a timestamp to a mapper operation.
|
static Mapper.Option |
tracing(boolean enabled)
Creates a new Option object to enable query tracing for a mapper operation.
|
static Mapper.Option |
ttl(int ttl)
Creates a new Option object to add time-to-live to a mapper operation.
|
public static Mapper.Option ttl(int ttl)
Note that this option is only available if using ProtocolVersion.V2
or above.
ttl
- the TTL (in seconds).public static Mapper.Option timestamp(long timestamp)
Note that this option is only available if using ProtocolVersion.V2
or above.
timestamp
- the timestamp (in microseconds).public static Mapper.Option consistencyLevel(ConsistencyLevel cl)
Note that the consistency level can also be defined at the mapper level, as a parameter of
the Table
annotation (this is redundant for
backward compatibility). This option, whether defined on a specific call or as the default,
will always take precedence over the annotation.
cl
- the ConsistencyLevel
to use for the operation.public static Mapper.Option tracing(boolean enabled)
enabled
- whether to enable tracing.public static Mapper.Option saveNullFields(boolean enabled)
If this option is not specified, it defaults to true
(null fields are saved).
enabled
- whether to include null fields in queries.public static Mapper.Option ifNotExists(boolean enabled)
If this option is not specified, it defaults to false
(IF NOT EXISTS statements
are not used).
enabled
- whether to include an IF NOT EXISTS clause in queries.@Deprecated public com.datastax.driver.mapping.Mapper.Option.Type getType()
Copyright © 2012–2018. All rights reserved.