org.jboss.mx.metadata
Class AbstractBuilder

java.lang.Object
  extended byorg.jboss.mx.metadata.AbstractBuilder
All Implemented Interfaces:
MetaDataBuilder (src)
Direct Known Subclasses:
JBossXMBean10 (src) , StandardMetaData (src) , XMLMetaData (src)

public abstract class AbstractBuilder
extends java.lang.Object
implements MetaDataBuilder (src)

Abstract helper class for builder implementations. Includes accessors for property values that can deal with either string values or equivalent object types (such as string "true" or Boolean(true)).

See Also:
MetaDataBuilder (src)

Field Summary
protected  java.util.Map properties
          Configuration properties.
 
Constructor Summary
AbstractBuilder()
          Default constructor.
AbstractBuilder(java.util.Map properties)
           
 
Method Summary
abstract  MBeanInfo (src) build()
          Constructs the Model MBean metadata.
 boolean getBooleanProperty(java.lang.String key)
          Returns true for Boolean(true) and strings "true" and "T" (case insensitive).
protected  java.util.Map getProperties()
          Returns the property map of this builder instance.
 java.lang.Object getProperty(java.lang.String key)
          Returns the value of a given configuration property.
 java.lang.String getStringProperty(java.lang.String key)
          Returns a string property or null if key does not exist.
protected  void setProperties(java.util.Map properties)
          Sets a copy of a properties map to this builder instance.
 void setProperty(java.lang.String key, java.lang.Object value)
          Sets a builder configuration property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

protected java.util.Map properties
Configuration properties.

Constructor Detail

AbstractBuilder

public AbstractBuilder()
Default constructor.


AbstractBuilder

public AbstractBuilder(java.util.Map properties)
Method Detail

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key)
                           throws IllegalPropertyException (src) 
Returns true for Boolean(true) and strings "true" and "T" (case insensitive). Returns false for Boolean(false) and strings "false" and "F".

Parameters:
key - to lookup
Returns:
true or false
Throws:
IllegalPropertyException (src) - if property value is not either Boolean or String type or they key value is null or a string contained an unknown value

getStringProperty

public java.lang.String getStringProperty(java.lang.String key)
Returns a string property or null if key does not exist.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Sets a builder configuration property.

Specified by:
setProperty in interface MetaDataBuilder (src)
Parameters:
key - unique string key for a property
value - property value

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns the value of a given configuration property.

Specified by:
getProperty in interface MetaDataBuilder (src)
Parameters:
key - property key string
Returns:
property value

build

public abstract MBeanInfo (src)  build()
                         throws NotCompliantMBeanException (src) 
Description copied from interface: MetaDataBuilder (src)
Constructs the Model MBean metadata.

Specified by:
build in interface MetaDataBuilder (src)
Returns:
initialized MBean info
Throws:
NotCompliantMBeanException (src) - if there were errors building the MBean info from the given data source

setProperties

protected void setProperties(java.util.Map properties)
Sets a copy of a properties map to this builder instance.

Parameters:
properties - configuration properties

getProperties

protected java.util.Map getProperties()
Returns the property map of this builder instance.