org.apache.bval.model
Class FeaturesCapable

java.lang.Object
  extended by org.apache.bval.model.FeaturesCapable
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MetaBean, MetaProperty

public abstract class FeaturesCapable
extends Object
implements Serializable

Description: abstract superclass of meta objects that support a map of features.

See Also:
Serialized Form

Constructor Summary
FeaturesCapable()
          Create a new FeaturesCapable instance.
 
Method Summary
 void addValidation(Validation validation)
          Add a validation to this FeaturesCapable.
<T extends FeaturesCapable>
T
copy()
          Create a deep copy (copy receiver and copy properties).
protected
<T extends FeaturesCapable>
void
copyInto(T 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeaturesCapable

public FeaturesCapable()
Create a new FeaturesCapable instance.

Method Detail

getFeatures

public Map<String,Object> getFeatures()
Get the (live) map of features.

Returns:
Map

optimizeRead

public void optimizeRead(boolean fast)
Set whether to optimize read operations by accessing the features map in an unsynchronized manner.

Parameters:
fast -

getFeature

public <T> T getFeature(String key)
Get the specified feature.

Type Parameters:
T -
Parameters:
key -
Returns:
T

getFeature

public <T> T getFeature(String key,
                        T defaultValue)
Get the specified feature, returning defaultValue if undeclared.

Type Parameters:
T -
Parameters:
key -
defaultValue -
Returns:
T

putFeature

public <T> void putFeature(String key,
                           T value)
Convenience method to set a particular feature value.

Type Parameters:
T -
Parameters:
key -
value -

copy

public <T extends FeaturesCapable> T copy()
Create a deep copy (copy receiver and copy properties).

Type Parameters:
T -
Returns:
new T instance

copyInto

protected <T extends FeaturesCapable> void copyInto(T target)
Copy this FeaturesCapable into another FeaturesCapable instance.

Type Parameters:
T -
Parameters:
target -

getValidations

public Validation[] getValidations()
Get any validations set for this FeaturesCapable.

Returns:
Validation array

setValidations

public void setValidations(Validation[] validations)
Set the validations for this FeaturesCapable.

Parameters:
validations -

addValidation

public void addValidation(Validation validation)
Add a validation to this FeaturesCapable.

Parameters:
validation - to add

hasValidation

public boolean hasValidation(Validation aValidation)
Search for an equivalent validation among those configured.

Parameters:
aValidation -
Returns:
true if found

createFeaturesMap

protected ConcurrentMap<String,Object> createFeaturesMap()
Create a features map for this FeaturesCapable object.

Returns:
ConcurrentMap


Copyright © 2010-2012 Apache Software Foundation. All Rights Reserved.