E - The type of entities stored in the Dataset underlying this
View.@Immutable public abstract class AbstractRefinableView<E> extends Object implements RefinableView<E>
| Modifier and Type | Field and Description |
|---|---|
protected EntityAccessor<E> |
accessor |
protected boolean |
canRead |
protected boolean |
canWrite |
protected MarkerComparator |
comparator |
protected Constraints |
constraints |
protected Dataset<E> |
dataset |
protected com.google.common.base.Predicate<E> |
entityTest |
protected ThreadLocal<StorageKey> |
keys |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRefinableView(AbstractRefinableView<?> view,
Schema schema,
Class<E> type) |
protected |
AbstractRefinableView(AbstractRefinableView<E> view,
Constraints constraints) |
protected |
AbstractRefinableView(Dataset<E> dataset,
Class<E> type) |
| Modifier and Type | Method and Description |
|---|---|
AbstractRefinableView<GenericRecord> |
asSchema(Schema schema)
Creates a copy of this
View that projects entities to the given
Schema. |
<T> View<T> |
asType(Class<T> type)
Creates a copy of this
View that reads and writes entities of the
given type class. |
protected void |
checkSchemaForRead() |
protected void |
checkSchemaForWrite() |
boolean |
deleteAll()
Deletes the entities included in this
View or throws an
UnsupportedOperationException. |
boolean |
equals(Object o) |
protected abstract AbstractRefinableView<E> |
filter(Constraints c) |
AbstractRefinableView<E> |
from(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is greater than or equal to the given value. |
AbstractRefinableView<E> |
fromAfter(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is greater than the given value. |
EntityAccessor<E> |
getAccessor() |
Constraints |
getConstraints() |
Iterable<PartitionView<E>> |
getCoveringPartitions()
|
Dataset<E> |
getDataset()
Returns the underlying
Dataset for the
View. |
protected com.google.common.base.Predicate<StorageKey> |
getKeyPredicate() |
Map<String,Object> |
getProvidedValues() |
Schema |
getSchema()
Get the schema of entities contained in this
View. |
Class<E> |
getType()
Get the runtime type of entities contained in this
View. |
URI |
getUri()
Get a
URI that identifies this View. |
int |
hashCode() |
boolean |
includes(E entity)
|
boolean |
isEmpty()
Check whether this
View contains any records. |
protected abstract <T> AbstractRefinableView<T> |
project(Schema schema,
Class<T> type) |
AbstractRefinableView<E> |
to(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is less than or equal to the given value. |
AbstractRefinableView<E> |
toBefore(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is less than the given value. |
String |
toString() |
AbstractRefinableView<E> |
with(String name,
Object... values)
Creates a sub-
View, restricted to entities whose name
field is equal to any of the given values. |
protected final MarkerComparator comparator
protected final Constraints constraints
protected final EntityAccessor<E> accessor
protected final com.google.common.base.Predicate<E> entityTest
protected final boolean canRead
protected final boolean canWrite
protected final ThreadLocal<StorageKey> keys
protected AbstractRefinableView(AbstractRefinableView<?> view, Schema schema, Class<E> type)
protected AbstractRefinableView(AbstractRefinableView<E> view, Constraints constraints)
public Constraints getConstraints()
protected abstract AbstractRefinableView<E> filter(Constraints c)
protected abstract <T> AbstractRefinableView<T> project(Schema schema, Class<T> type)
public Dataset<E> getDataset()
ViewDataset for the
View.getDataset in interface View<E>Datasetpublic boolean deleteAll()
ViewView or throws an
UnsupportedOperationException.
Implementations are allowed to throw UnsupportedOperationException
if the View could require additional work to delete. For example,
if some but not all of the data in an underlying data file must be removed,
then the implementation is allowed to reject the deletion rather than
copy the remaining records to a new file. Implementations must document
what deletes are supported and under what conditions deletes are rejected.public Class<E> getType()
ViewView.public Schema getSchema()
ViewView.public EntityAccessor<E> getAccessor()
public Iterable<PartitionView<E>> getCoveringPartitions()
ViewIterable of non-overlapping View objects that
partition the underlying Dataset and cover this View.
The returned View objects are implementation-specific, but should
represent reasonable partitions of the underlying Dataset based on
its layout.
The data contained by the union of each View in the
Iterable must be a super-set of this View.
Note that partitions are actual partitions under which data is stored.
Implementations should omit any View that is empty.getCoveringPartitions in interface View<E>View that cover this View.public AbstractRefinableView<E> with(String name, Object... values)
RefinableViewView, restricted to entities whose name
field is equal to any of the given values. If you specify no
values, the view is restricted to entities whose
name field is non-null.with in interface RefinableView<E>name - the field name of the entitypublic AbstractRefinableView<E> from(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is greater than or equal to the given value.from in interface RefinableView<E>name - the field name of the entitypublic AbstractRefinableView<E> fromAfter(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is greater than the given value.fromAfter in interface RefinableView<E>name - the field name of the entitypublic AbstractRefinableView<E> to(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is less than or equal to the given value.to in interface RefinableView<E>name - the field name of the entitypublic AbstractRefinableView<E> toBefore(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is less than the given value.toBefore in interface RefinableView<E>name - the field name of the entitypublic AbstractRefinableView<GenericRecord> asSchema(Schema schema)
ViewView that projects entities to the given
Schema.
This method always returns a View with type GenericRecord.
public <T> View<T> asType(Class<T> type)
ViewView that reads and writes entities of the
given type class.public boolean isEmpty()
ViewView contains any records.
Implementations should return once a single record in this view is found.
But this might require scanning through large amounts of data sequentially
to determine if there are any records.public URI getUri()
ViewURI that identifies this View.protected com.google.common.base.Predicate<StorageKey> getKeyPredicate()
protected void checkSchemaForWrite()
protected void checkSchemaForRead()
Copyright © 2013–2015. All rights reserved.