org.apache.bval.model
Class MetaBean

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

public class MetaBean
extends FeaturesCapable
implements Cloneable, Features.Bean

Description: the meta description of a bean or class. the class/bean itself can have a map of features and an array of metaproperties.

See Also:
MetaProperty, Serialized Form

Field Summary
 
Fields inherited from interface org.apache.bval.model.Features.Bean
DOMAIN, MAIN_KEY, UNIQUE_KEY
 
Constructor Summary
MetaBean()
           
 
Method Summary
protected
<T extends FeaturesCapable>
void
copyInto(T target)
          Copy this FeaturesCapable into another FeaturesCapable instance.
 Class<?> getBeanClass()
          Get the beanClass.
 String getId()
          Get the id.
 String getName()
          Get the name.
 MetaProperty[] getProperties()
          Get the properties.
 MetaProperty getProperty(String name)
          Get the specified MetaProperty.
 boolean hasProperties()
          Learn whether there are any known properties.
 boolean hasRelationships()
          Learn whether any known property is a relationship.
 void putProperty(String name, MetaProperty property)
          bidirectional - set the relationship between a MetaProperty and its parentMetaBean
 MetaBean resolveMetaBean(Object bean)
           If this MetaBean is compatible with bean, return this, else null.
 void setBeanClass(Class<?> beanClass)
          Set the beanClass.
 void setId(String id)
          Set the id.
 void setName(String name)
          Set the name.
 void setProperties(MetaProperty[] properties)
          Set the properties.
 String toString()
          
 
Methods inherited from class org.apache.bval.model.FeaturesCapable
addValidation, copy, createFeaturesMap, getFeature, getFeature, getFeatures, getValidations, hasValidation, optimizeRead, putFeature, setValidations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaBean

public MetaBean()
Method Detail

getId

public String getId()
Get the id.

Returns:
String

setId

public void setId(String id)
Set the id.

Parameters:
id - the String to set

getName

public String getName()
Get the name.

Returns:
String

setName

public void setName(String name)
Set the name.

Parameters:
name - the String to set

getBeanClass

public Class<?> getBeanClass()
Get the beanClass.

Returns:
Class

setBeanClass

public void setBeanClass(Class<?> beanClass)
Set the beanClass.

Parameters:
beanClass - the Class to set

getProperties

public MetaProperty[] getProperties()
Get the properties.

Returns:
MetaProperty[]

setProperties

public void setProperties(MetaProperty[] properties)
Set the properties.

Parameters:
properties - the MetaProperty[] to set

getProperty

public MetaProperty getProperty(String name)
Get the specified MetaProperty.

Parameters:
name -
Returns:
MetaProperty found or null

hasRelationships

public boolean hasRelationships()
Learn whether any known property is a relationship.

Returns:
true when at least one of the properties is a relationship
See Also:
MetaProperty.isRelationship()

hasProperties

public boolean hasProperties()
Learn whether there are any known properties.

Returns:
boolean

putProperty

public void putProperty(String name,
                        MetaProperty property)
bidirectional - set the relationship between a MetaProperty and its parentMetaBean

Parameters:
name -
property - if null, remove

toString

public String toString()

Overrides:
toString in class Object

copyInto

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

Overrides:
copyInto in class FeaturesCapable

resolveMetaBean

public MetaBean resolveMetaBean(Object bean)

If this MetaBean is compatible with bean, return this, else null.

Compatibility is satisfied in one of the following ways:

Parameters:
bean -
Returns:
this or null


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