public abstract class FeaturesCapable extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<String,Object> |
features |
protected Validation[] |
validations
key = validation id, value = the validation
|
Constructor and Description |
---|
FeaturesCapable()
Create a new FeaturesCapable instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidation(Validation validation)
Add a validation to this
FeaturesCapable . |
<T extends FeaturesCapable> |
copy()
Create a deep copy (copy receiver and copy properties).
|
protected void |
copyInto(FeaturesCapable target)
Copy this
FeaturesCapable into another FeaturesCapable
instance. |
protected ConcurrentMap<String,Object> |
createFeaturesMap()
Create a features map for this
FeaturesCapable object. |
<T> T |
getFeature(String key)
Get the specified feature.
|
<T> T |
getFeature(String key,
T defaultValue)
Get the specified feature, returning
defaultValue if
undeclared. |
Map<String,Object> |
getFeatures()
Get the (live) map of features.
|
Validation[] |
getValidations()
Get any validations set for this
FeaturesCapable . |
boolean |
hasValidation(Validation aValidation)
Search for an equivalent validation among those configured.
|
void |
optimizeRead(boolean fast)
Set whether to optimize read operations by accessing the features map in
an unsynchronized manner.
|
<T> void |
putFeature(String key,
T value)
Convenience method to set a particular feature value.
|
void |
setValidations(Validation[] validations)
Set the validations for this
FeaturesCapable . |
protected ConcurrentMap<String,Object> features
protected Validation[] validations
public void optimizeRead(boolean fast)
fast
- public <T> T getFeature(String key)
T
- key
- public <T> T getFeature(String key, T defaultValue)
defaultValue
if
undeclared.T
- key
- defaultValue
- public <T> void putFeature(String key, T value)
T
- key
- value
- public <T extends FeaturesCapable> T copy()
T
- protected void copyInto(FeaturesCapable target)
FeaturesCapable
into another FeaturesCapable
instance.target
- public Validation[] getValidations()
FeaturesCapable
.public void setValidations(Validation[] validations)
FeaturesCapable
.validations
- public void addValidation(Validation validation)
FeaturesCapable
.validation
- to addpublic boolean hasValidation(Validation aValidation)
aValidation
- protected ConcurrentMap<String,Object> createFeaturesMap()
FeaturesCapable
object.Copyright © 2010–2016 The Apache Software Foundation. All rights reserved.