com.endeca.itl.cas.api
Class ModuleConfig

java.lang.Object
  extended by com.endeca.itl.cas.api.ModuleConfig
Direct Known Subclasses:
ManipulatorConfig, OutputConfig, SourceConfig

public abstract class ModuleConfig
extends Object

Abstract class that supports specifying an ID and a list of properties as part of configuring a module.


Field Summary
protected  ModuleId mModuleId
           
protected  List<ModuleProperty> mModuleProperties
           
 
Constructor Summary
ModuleConfig()
           
ModuleConfig(ModuleId moduleId)
           
 
Method Summary
 void addModuleProperty(ModuleProperty moduleProperty)
          Add a new ModuleProperty to the current list.
 boolean equals(Object other)
          Compares the list of module properties as a set.
 ModuleId getModuleId()
           
 List<ModuleProperty> getModuleProperties()
          Returns the Properties used for configuring the module.
 ModuleProperty getProperty(String key)
          Gets the (first) ModuleProperty object that has been set for a given key.
 List<String> getPropertyValues(String key)
          Returns all values that have been set for a given key
 String getSingletonPropertyValue(String key)
          Returns the single module property value specified by the key
 String getSingletonPropertyValue(String key, String defaultValue)
          Returns the single module property value specified by the key
 Boolean getSingletonPropertyValueAsBoolean(String key)
          Returns the single module property value specified by the key
 boolean getSingletonPropertyValueAsBoolean(String key, boolean defaultValue)
          Returns the single module property value specified by the key
 Integer getSingletonPropertyValueAsInteger(String key)
           
 Integer getSingletonPropertyValueAsInteger(String key, int defaultValue)
           
 int hashCode()
           
 boolean hasProperty(String key)
          Checks if a ModuleProperty exists for a given key.
 boolean hasPropertyValue(String key)
           
 void setModuleId(ModuleId moduleId)
          Set the identifier for the module being configured.
 void setModuleProperties(List<ModuleProperty> moduleProperties)
          Replace list of module properties with given list.
 void setModulePropertyValues(String key, String... values)
          Sets the property values for the specified property key.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mModuleId

protected ModuleId mModuleId

mModuleProperties

protected List<ModuleProperty> mModuleProperties
Constructor Detail

ModuleConfig

public ModuleConfig()

ModuleConfig

public ModuleConfig(ModuleId moduleId)
Method Detail

getModuleId

public ModuleId getModuleId()

setModuleId

public void setModuleId(ModuleId moduleId)
Set the identifier for the module being configured. This is optional in a config because OutputConfig objects do not require a ModuleId, because there is a reasonable default.

Parameters:
moduleId -

getModuleProperties

public List<ModuleProperty> getModuleProperties()
Returns the Properties used for configuring the module. The possible values will differ based on the type of module.


setModuleProperties

public void setModuleProperties(List<ModuleProperty> moduleProperties)
Replace list of module properties with given list.

Parameters:
moduleProperties - list to use instead.

addModuleProperty

public void addModuleProperty(ModuleProperty moduleProperty)
Add a new ModuleProperty to the current list. No checking is performed to assure no duplicate property keys are added.

Parameters:
moduleProperty - to add

getProperty

public ModuleProperty getProperty(String key)
Gets the (first) ModuleProperty object that has been set for a given key.

Parameters:
key -
Returns:
ModuleProperty, or null if not found.

hasProperty

public boolean hasProperty(String key)
Checks if a ModuleProperty exists for a given key.

Parameters:
key -
Returns:
ModuleProperty, or null if not found.

hasPropertyValue

public boolean hasPropertyValue(String key)
Parameters:
key -
Returns:
true if a ModuleProperty exists for a given key and the ModuleProperty contains one or more non-null values.

getPropertyValues

public List<String> getPropertyValues(String key)
Returns all values that have been set for a given key

Parameters:
key -
Returns:
a list of values, as strings, or an empty list if one are set.

equals

public boolean equals(Object other)
Compares the list of module properties as a set.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getSingletonPropertyValue

public String getSingletonPropertyValue(String key)
Returns the single module property value specified by the key

Parameters:
key -
Returns:
the module property if it exists, null otherwise.
Throws:
IllegalStateException - if this module property has multiple values.

getSingletonPropertyValue

public String getSingletonPropertyValue(String key,
                                        String defaultValue)
Returns the single module property value specified by the key

Parameters:
key -
defaultValue -
Returns:
the module property if it exists, otherwise returns the default value.
Throws:
IllegalStateException - if this module property has multiple values.

getSingletonPropertyValueAsBoolean

public Boolean getSingletonPropertyValueAsBoolean(String key)
Returns the single module property value specified by the key

Parameters:
key -
Returns:
the boolean value of the module property if it exists, null otherwise. If more than one, returns the first.

getSingletonPropertyValueAsBoolean

public boolean getSingletonPropertyValueAsBoolean(String key,
                                                  boolean defaultValue)
Returns the single module property value specified by the key

Parameters:
key -
defaultValue -
Returns:
the boolean value of the module property if it exists, or returns the default value otherwise.

getSingletonPropertyValueAsInteger

public Integer getSingletonPropertyValueAsInteger(String key)
Parameters:
key -
Returns:
single integer value specified by the property key. If the value does not exist, returns null. If more than one, returns the first.

getSingletonPropertyValueAsInteger

public Integer getSingletonPropertyValueAsInteger(String key,
                                                  int defaultValue)
Parameters:
key -
defaultValue -
Returns:
single integer value specified by the property key. If the value does not exist, returns the argument defaultValue. If more than one, returns the first.

setModulePropertyValues

public void setModulePropertyValues(String key,
                                    String... values)
Sets the property values for the specified property key. If the PropertyValue does not already exist, a new entry will be created and saved in this configuration

Parameters:
key -
values -


Copyright © 2011 Endeca. All Rights Reserved.