public class ConfigurationProperty extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static ConfigurationNamespace |
namespaceDefault |
Constructor and Description |
---|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name)
constructor to build a configuration property for a module with a name
but with no value or nested property list.
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationNamespace namespace,
java.util.List<ConfigurationProperty> propertiesList)
constructor to build a configuration property for a module with a name,
namespace and a list of properties to nest within it
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationNamespace namespace,
java.util.List<ConfigurationProperty> propertiesList,
boolean notifyListeners)
constructor to build a configuration property for a module with a name,
namespace and a list of properties to nest within it
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationNamespace namespace,
java.lang.String value)
constructor to build a configuration property for a module with a name
and a single value
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationProperty property)
create a configuration property with one nested property
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
java.util.List<ConfigurationProperty> propertiesList)
constructor to build a configuration property for a module with a name and
a list of properties to load
|
ConfigurationProperty(org.kepler.build.modules.Module module,
java.lang.String name,
java.lang.String value)
constructor to build a configuration property for a module with a name
and a single value
|
Modifier and Type | Method and Description |
---|---|
void |
addProperty(ConfigurationProperty property)
add a nested property to this configuration property
|
void |
addProperty(ConfigurationProperty property,
boolean notifyListeners)
add a nested property to this configuration property
|
protected void |
addProperty(ConfigurationProperty property,
boolean ignoreMutable,
boolean notifyListeners,
boolean setDirty)
add a nested property to this configuration property.
|
void |
addProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationNamespace namespace,
ConfigurationProperty property)
add a new property for a given module with a given name that has the given
property nested within it.
|
void |
addProperty(org.kepler.build.modules.Module module,
java.lang.String name,
ConfigurationProperty property)
add a new property for a given module with a given name that has the given
property nested within it.
|
void |
addPropertyAtIndex(int index,
ConfigurationProperty propertyToAdd)
add propertyToAdd before the beforeProperty in the ordering of the list of
properties for this property
|
void |
addPropertyIfNotThere(ConfigurationProperty propertyToAdd)
add a nested property if the contents are not already present,
ignoring: namespaces, modules, originmodules.
|
void |
addPropertyIfNotThere(ConfigurationProperty propertyToAdd,
boolean setDirty) |
void |
addPropertyIfNotThereAtIndex(int index,
ConfigurationProperty propertyToAdd)
add a nested property at index if the contents are not already present,
ignoring: namespaces, modules, originmodules.
|
boolean |
containsProperty(ConfigurationProperty nestedProperty)
returns true if this property contains a nested property,
ignoring: namespaces, modules, originmodules.
|
boolean |
containsProperty(java.lang.String name,
boolean recursive)
return true if this ConfigurationProperty contains a property with the given name..
|
boolean |
equalsContents(ConfigurationProperty property)
returns true if the property contents are identical to this one,
ignoring: namespaces, modules, originmodules.
|
static java.util.List<ConfigurationProperty> |
findProperties(ConfigurationProperty property,
java.lang.String name,
java.lang.String value,
boolean recursive)
return a list of properties that have a name that matches name and a value
that matches value within property.
|
static java.util.List<ConfigurationProperty> |
findProperties(java.util.List<ConfigurationProperty> properties,
java.lang.String name,
java.lang.String value,
boolean recursive)
Search a list of properties for properties that contain a name and a value
|
java.util.List<ConfigurationProperty> |
findProperties(java.lang.String name,
java.lang.String value)
returns a list of properties within this property that have a specific
name and value.
|
java.util.List<ConfigurationProperty> |
findProperties(java.lang.String name,
java.lang.String value,
boolean recursive)
returns a list of properties within this property that have a specific
name and value.
|
java.lang.String |
getFullName()
returns a fully qualified name including the module and namespace
|
org.kepler.build.modules.Module |
getModule()
return the module associated with this property
|
java.lang.String |
getName()
return the name of this property
|
ConfigurationNamespace |
getNamespace()
return the namepace
|
org.kepler.build.modules.Module |
getOriginModule() |
ConfigurationProperty |
getParent()
returns the parent propert of this property.
|
java.util.List<ConfigurationProperty> |
getProperties()
return a list of nested properties within this property
|
static java.util.List<ConfigurationProperty> |
getProperties(ConfigurationProperty cp,
java.lang.String name,
boolean recursive)
get properties from a configurationProperty with a given name.
|
java.util.List<ConfigurationProperty> |
getProperties(java.lang.String name)
return a list of nested properties that have a specific name.
|
java.util.List<ConfigurationProperty> |
getProperties(java.lang.String name,
boolean recursive)
do a recursive get through this ConfigurationProperty
|
protected static java.util.List<ConfigurationProperty> |
getPropertiesWithPath(ConfigurationProperty property,
java.lang.String[] s,
boolean returnChildren)
recursively return all properties with a path denoted in s.
|
ConfigurationProperty |
getProperty(int index)
get the property with the given index in the current list of properties
|
ConfigurationProperty |
getProperty(java.lang.String name)
if there are more than one property with the same name, just return
the first one.
|
ConfigurationProperty |
getProperty(java.lang.String name,
int index)
return a property with a given name at the specified index.
|
java.lang.String |
getValue()
return the value of this property.
|
static java.util.List<java.lang.String> |
getValueList(java.util.List<ConfigurationProperty> propList,
java.lang.String propertyName,
boolean recursive)
return a list of strings of the values of a property with a given name in
the list of properties
|
java.lang.String |
getXML()
return the xml version of this property
|
boolean |
hasLeafValue()
return true if this property has a string value
|
boolean |
hasNestedProperties()
return true if this property has nested properties
|
boolean |
isDirty()
returns this congifuration property's dirty flag
|
boolean |
isDirty(boolean recursive)
returns true if this property has changed since it was last saved
|
boolean |
isMutable()
returns true if this propert is mutable.
|
boolean |
overrideProperty(ConfigurationProperty originalProperty,
ConfigurationProperty newProperty,
boolean overrideNamespace)
override originalProperty with newProperty.
|
void |
prettyPrint()
print this configurationProperty nicely showing the hierarchy
|
static void |
prettyPrintList(java.util.List<ConfigurationProperty> l)
pretty print a list of configuration properties
|
protected static java.lang.String[] |
processName(java.lang.String name)
process a name with . notations into a string array
|
boolean |
removeProperty(ConfigurationProperty propertyToRemove)
remove the given property
|
protected void |
resetDirty(boolean recursive)
reset the dirty flag
|
void |
setDirty(boolean dirty)
set dirty. generally other classes shouldn't call this
but it's a good way to force serialization when nothing has
actually changed.
|
protected void |
setMutable(boolean mutable)
set whether this property is mutable.
|
void |
setNamespace(boolean notifyListeners,
ConfigurationNamespace namespace)
set the namespace of this property
|
void |
setNamespace(ConfigurationNamespace namespace)
set the namespace of this property
|
void |
setNamespace(ConfigurationNamespace namespace,
boolean recursive)
sets the namespace.
|
void |
setNamespace(ConfigurationNamespace namespace,
boolean recursive,
boolean notifyListeners)
sets the namespace.
|
static void |
setNamespace(ConfigurationProperty cp,
ConfigurationNamespace namespace,
boolean recursive)
set the namespace on a configurationProperty
|
static void |
setNamespace(ConfigurationProperty cp,
ConfigurationNamespace namespace,
boolean recursive,
boolean notifyListeners)
set the namespace on a configurationProperty
|
void |
setOriginModule(org.kepler.build.modules.Module m) |
void |
setParent(ConfigurationProperty property)
set the parent property of this property
|
void |
setValue(java.lang.String value)
set the value of this property
|
static void |
simplePrintList(java.util.List<ConfigurationProperty> l) |
java.lang.String |
toString()
return a string representation of this property
|
java.lang.String |
toString(boolean recursive) |
java.lang.String |
toString(boolean recursive,
boolean includeNamespace,
boolean includeModule,
boolean includeOriginModule)
returns a string representation of this property
|
java.lang.String |
toStringContents()
Returns the string contents of this property without the namespace,
module name, and origin module name (if present).
|
public static final ConfigurationNamespace namespaceDefault
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, java.util.List<ConfigurationProperty> propertiesList)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationNamespace namespace, java.util.List<ConfigurationProperty> propertiesList)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationNamespace namespace, java.util.List<ConfigurationProperty> propertiesList, boolean notifyListeners)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, java.lang.String value)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationNamespace namespace, java.lang.String value)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name)
public ConfigurationProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationProperty property) throws NamespaceException, ConfigurationManagerException
public void addProperty(ConfigurationProperty property) throws NamespaceException, ConfigurationManagerException
public void addProperty(ConfigurationProperty property, boolean notifyListeners) throws NamespaceException, ConfigurationManagerException
protected void addProperty(ConfigurationProperty property, boolean ignoreMutable, boolean notifyListeners, boolean setDirty) throws NamespaceException, ConfigurationManagerException
public void addProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationProperty property) throws NamespaceException, ConfigurationManagerException
public void addProperty(org.kepler.build.modules.Module module, java.lang.String name, ConfigurationNamespace namespace, ConfigurationProperty property) throws NamespaceException, ConfigurationManagerException
public void addPropertyAtIndex(int index, ConfigurationProperty propertyToAdd) throws NamespaceException, ConfigurationManagerException
index
- index in this property's property list to add propertyToAddpropertyToAdd
- the property to addNamespaceException
ConfigurationManagerException
public void addPropertyIfNotThere(ConfigurationProperty propertyToAdd) throws NamespaceException, ConfigurationManagerException
public void addPropertyIfNotThere(ConfigurationProperty propertyToAdd, boolean setDirty) throws NamespaceException, ConfigurationManagerException
public void addPropertyIfNotThereAtIndex(int index, ConfigurationProperty propertyToAdd) throws NamespaceException, ConfigurationManagerException
public boolean removeProperty(ConfigurationProperty propertyToRemove)
propertyToRemove
- the property to removepublic java.util.List<ConfigurationProperty> getProperties()
public java.util.List<ConfigurationProperty> getProperties(java.lang.String name)
public java.util.List<ConfigurationProperty> getProperties(java.lang.String name, boolean recursive)
name
- the name to look forrecursive
- public static java.util.List<ConfigurationProperty> getProperties(ConfigurationProperty cp, java.lang.String name, boolean recursive)
cp
- the ConfigurationProperty to get fromname
- the name to look forrecursive
- if true, look through the tree recursively.public ConfigurationProperty getProperty(java.lang.String name)
public ConfigurationProperty getProperty(java.lang.String name, int index)
public ConfigurationProperty getProperty(int index)
public boolean overrideProperty(ConfigurationProperty originalProperty, ConfigurationProperty newProperty, boolean overrideNamespace)
originalProperty
- the property to overridenewProperty
- the property to take the place of originalPropertyoverrideNamespace
- true if you want to automatically set the namespace
of newProperty (along with all of its subproperties) to that of
originalProperty.public java.util.List<ConfigurationProperty> findProperties(java.lang.String name, java.lang.String value, boolean recursive)
name
- the name of the property to findvalue
- the value of the property to findrecursive
- true if you want a recursive (deep) searchpublic java.util.List<ConfigurationProperty> findProperties(java.lang.String name, java.lang.String value)
name
- the name of the property to findvalue
- the value of the property to findpublic java.lang.String getValue()
public void setValue(java.lang.String value) throws ConfigurationManagerException
ConfigurationManagerException
public boolean hasLeafValue()
public boolean hasNestedProperties()
public java.lang.String getName()
public org.kepler.build.modules.Module getModule()
public ConfigurationNamespace getNamespace()
public void setDirty(boolean dirty)
public void setNamespace(boolean notifyListeners, ConfigurationNamespace namespace)
public void setNamespace(ConfigurationNamespace namespace)
public void setNamespace(ConfigurationNamespace namespace, boolean recursive)
public void setNamespace(ConfigurationNamespace namespace, boolean recursive, boolean notifyListeners)
public java.lang.String getFullName()
public boolean isMutable()
public boolean containsProperty(java.lang.String name, boolean recursive)
property
- the propertypublic boolean containsProperty(ConfigurationProperty nestedProperty)
public boolean equalsContents(ConfigurationProperty property)
public java.lang.String getXML()
public java.lang.String toString(boolean recursive)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringContents()
public java.lang.String toString(boolean recursive, boolean includeNamespace, boolean includeModule, boolean includeOriginModule)
recursive
- if true, string includes all sub-propertiesincludeNamespace
- if true, string includes the namespaceincludeModule
- if true, string include module nameincludeOriginModule
- if true, string includes originModule namepublic void prettyPrint()
public boolean isDirty(boolean recursive)
recursive
- true if the dirty flag should be searched for in any
contained configuration propertypublic boolean isDirty()
public ConfigurationProperty getParent()
public static void setNamespace(ConfigurationProperty cp, ConfigurationNamespace namespace, boolean recursive)
public static void setNamespace(ConfigurationProperty cp, ConfigurationNamespace namespace, boolean recursive, boolean notifyListeners)
public static java.util.List<ConfigurationProperty> findProperties(java.util.List<ConfigurationProperty> properties, java.lang.String name, java.lang.String value, boolean recursive)
public static java.util.List<ConfigurationProperty> findProperties(ConfigurationProperty property, java.lang.String name, java.lang.String value, boolean recursive)
public static void prettyPrintList(java.util.List<ConfigurationProperty> l)
public static void simplePrintList(java.util.List<ConfigurationProperty> l)
public static java.util.List<java.lang.String> getValueList(java.util.List<ConfigurationProperty> propList, java.lang.String propertyName, boolean recursive)
public void setOriginModule(org.kepler.build.modules.Module m)
public org.kepler.build.modules.Module getOriginModule()
public void setParent(ConfigurationProperty property)
protected void resetDirty(boolean recursive)
recursive
- set to true if all properties that this property
contains should also be resetprotected static java.util.List<ConfigurationProperty> getPropertiesWithPath(ConfigurationProperty property, java.lang.String[] s, boolean returnChildren)
protected void setMutable(boolean mutable)
protected static java.lang.String[] processName(java.lang.String name)