org.modeshape.common.component
Class ComponentConfig

java.lang.Object
  extended by org.modeshape.common.component.ComponentConfig
All Implemented Interfaces:
Comparable<ComponentConfig>
Direct Known Subclasses:
DdlParserConfig, MimeTypeDetectorConfig

@Immutable
public class ComponentConfig
extends Object
implements Comparable<ComponentConfig>

An immutable configuration for a Component.


Constructor Summary
ComponentConfig(String name, String description, long timestamp, Map<String,Object> properties, String classname, String... classpath)
          Create a component configuration.
ComponentConfig(String name, String description, Map<String,Object> properties, String classname, String... classpath)
          Create a component configuration.
ComponentConfig(String name, String description, String classname, String... classpath)
          Create a component configuration.
 
Method Summary
 int compareTo(ComponentConfig that)
          
 boolean equals(Object obj)
          
 String getComponentClassname()
          Get the fully-qualified name of the Java class used for instances of this component
 List<String> getComponentClasspath()
          Get the classpath defined in terms of strings compatible with a ClassLoaderFactory.
 String[] getComponentClasspathArray()
          Get the classpath defined as an array of strings compatible with a ClassLoaderFactory.
 String getDescription()
          Get the description for this component
 String getName()
          Get the name of this component.
 Map<String,Object> getProperties()
          Get the (unmodifiable) properties to be set through reflection on components of this type after instantiation
 long getTimestamp()
          Get the system timestamp when this configuration object was created.
 boolean hasChanged(ComponentConfig component)
          Determine whether this component has changed with respect to the supplied component.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentConfig

public ComponentConfig(String name,
                       String description,
                       String classname,
                       String... classpath)
Create a component configuration.

Parameters:
name - the name of the configuration, which is considered to be a unique identifier
description - the description
classname - the name of the Java class used for the component
classpath - the optional classpath (defined in a way compatible with a ClassLoaderFactory
Throws:
IllegalArgumentException - if the name is null, empty or blank, or if the classname is null, empty or not a valid Java classname

ComponentConfig

public ComponentConfig(String name,
                       String description,
                       Map<String,Object> properties,
                       String classname,
                       String... classpath)
Create a component configuration.

Parameters:
name - the name of the configuration, which is considered to be a unique identifier
description - the description
properties - the mapping of properties to values that should be set through reflection after a component is instantiated with this configuration information
classname - the name of the Java class used for the component
classpath - the optional classpath (defined in a way compatible with a ClassLoaderFactory
Throws:
IllegalArgumentException - if the name is null, empty or blank, or if the class name is null, empty or not a valid Java class name

ComponentConfig

public ComponentConfig(String name,
                       String description,
                       long timestamp,
                       Map<String,Object> properties,
                       String classname,
                       String... classpath)
Create a component configuration.

Parameters:
name - the name of the configuration, which is considered to be a unique identifier
description - the description
timestamp - the timestamp that this component was last changed
properties - the mapping of properties to values that should be set through reflection after a component is instantiated with this configuration information
classname - the name of the Java class used for the component
classpath - the optional classpath (defined in a way compatible with a ClassLoaderFactory
Throws:
IllegalArgumentException - if the name is null, empty or blank, or if the classname is null, empty or not a valid Java classname
Method Detail

getName

public String getName()
Get the name of this component.

Returns:
the component name; never null, empty or blank

getDescription

public String getDescription()
Get the description for this component

Returns:
the description

getComponentClassname

public String getComponentClassname()
Get the fully-qualified name of the Java class used for instances of this component

Returns:
the Java class name of this component; never null or empty and always a valid Java class name

getComponentClasspath

public List<String> getComponentClasspath()
Get the classpath defined in terms of strings compatible with a ClassLoaderFactory.

Returns:
the classpath; never null but possibly empty

getComponentClasspathArray

public String[] getComponentClasspathArray()
Get the classpath defined as an array of strings compatible with a ClassLoaderFactory.

Returns:
the classpath as an array; never null but possibly empty

getTimestamp

public long getTimestamp()
Get the system timestamp when this configuration object was created.

Returns:
the timestamp

getProperties

public Map<String,Object> getProperties()
Get the (unmodifiable) properties to be set through reflection on components of this type after instantiation

Returns:
the properties to be set through reflection on components of this type after instantiation; never null

compareTo

public int compareTo(ComponentConfig that)

Specified by:
compareTo in interface Comparable<ComponentConfig>

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hasChanged

public boolean hasChanged(ComponentConfig component)
Determine whether this component has changed with respect to the supplied component. This method basically checks all attributes, whereas equals only checks the type and getName().

Parameters:
component - the component to be compared with this one
Returns:
true if this componet and the supplied component have some changes, or false if they are exactly equivalent
Throws:
IllegalArgumentException - if the supplied component reference is null or is not the same type as this object


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.