public static class ColumnMapping.Builder extends Object
ColumnMapping
.Constructor and Description |
---|
ColumnMapping.Builder() |
Modifier and Type | Method and Description |
---|---|
ColumnMapping |
build()
Builds and returns a
ColumnMapping from the fields
mappings added to this builder. |
ColumnMapping.Builder |
column(String name,
String family,
String qualifier)
Adds a mapping to store the record field
name in a column using
the family and qualifier . |
ColumnMapping.Builder |
counter(String name,
String family,
String qualifier)
Adds a counter mapping to store record field
name in a column
using the family and qualifier . |
ColumnMapping.Builder |
fieldMapping(FieldMapping fieldMapping)
Adds a
FieldMapping . |
ColumnMapping.Builder |
fieldMappings(Collection<FieldMapping> fieldMappings)
Adds each
FieldMapping from a collection. |
ColumnMapping.Builder |
key(String name)
Adds a mapping to store the record field
name in the record key. |
ColumnMapping.Builder |
keyAsColumn(String name,
String family)
Adds a key-as-column mapping to store the record field
name in
the given family , using its keys or fields as column qualifiers. |
ColumnMapping.Builder |
keyAsColumn(String name,
String family,
String qualifierPrefix)
Adds a key-as-column mapping to store the record field
name in
the given family , using column qualifiers built from its keys or
field names appended to the qualifierPrefix . |
ColumnMapping.Builder |
occ(String name)
Adds an OCC version mapping for the record field
name . |
ColumnMapping.Builder |
version(String name)
Adds an OCC version mapping for the record field
name . |
public ColumnMapping.Builder key(String name)
name
in the record key.
The underlying dataset's PartitionStrategy
must have an identity
partitioner for the record field name
so that the value can be
recovered.name
- The name of a record fieldpublic ColumnMapping.Builder column(String name, String family, String qualifier)
name
in a column using
the family
and qualifier
.name
- The name of a record fieldfamily
- The column family for storing the record field valuequalifier
- The column qualifier for storing the record field valuepublic ColumnMapping.Builder keyAsColumn(String name, String family)
name
in
the given family
, using its keys or fields as column qualifiers.
The record field must be a map or a record.name
- The name of a record fieldfamily
- The column family for storing the map or record valuespublic ColumnMapping.Builder keyAsColumn(String name, String family, String qualifierPrefix)
name
in
the given family
, using column qualifiers built from its keys or
field names appended to the qualifierPrefix
.
The record field must be a map or a record.name
- The name of a record fieldfamily
- The column family for storing the map or record valuesqualifierPrefix
- A prefix to add when building column qualifierspublic ColumnMapping.Builder counter(String name, String family, String qualifier)
name
in a column
using the family
and qualifier
. The record field can be
updated atomically using
RandomAccessDataset.increment(Key, String, long)
The record field must be an int or a long.
Counters cannot be used in combination with optimistic concurrency (OCC).name
- The name of a record fieldfamily
- The column family for storing the record counter valuequalifier
- The column qualifier for storing the record field valuepublic ColumnMapping.Builder occ(String name)
name
. The
record field will contain the current version number of the record.
Using this mapping enables optimistic concurrency (OCC), where the
underlying RandomAccessDataset
will only persist changes to a
record if it has not changed by another process.
The record field must be an int or a long.
Optimistic concurrency (OCC) cannot be used in combination with counters.name
- The name of a record field to use for an OCC versionpublic ColumnMapping.Builder version(String name)
name
. The
record field will contain the current version number of the record.
Using this mapping enables optimistic concurrency (OCC), where the
underlying RandomAccessDataset
will only persist changes to a
record if it has not changed by another process.
The record field must be an int or a long.
Optimistic concurrency (OCC) cannot be used in combination with counters.name
- The name of a record field to use for an OCC versionpublic ColumnMapping.Builder fieldMapping(FieldMapping fieldMapping)
FieldMapping
.fieldMapping
- A FieldMapping
public ColumnMapping.Builder fieldMappings(Collection<FieldMapping> fieldMappings)
FieldMapping
from a collection.fieldMappings
- A collection of FieldMapping
objectspublic ColumnMapping build()
ColumnMapping
from the fields
mappings added to this builder.Copyright © 2013–2014. All rights reserved.