public class Description extends Object
Constructor and Description |
---|
Description(ComponentType type,
String name,
String desc,
boolean isCollection,
Class<?> childClass,
Collection<Description> children,
boolean required)
Constructor.
|
Description(ConfigComponent configComponent,
boolean isCollection,
Class<?> childClass,
Collection<Description> children)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Collection<Description> |
childrenOfType(ComponentType type)
Get all the children of a specific type
|
Collection<Description> |
filterChildren(Predicate<Description> filter)
Get a filtered collection of the child descriptions.
|
Map<String,Description> |
getChildren()
Gets a map of the parameters that the object contains.
|
Class<?> |
getChildType()
Get the class of the objects for the getter/setter methods.
|
String |
getCommonName()
Gets the common name for the matcher.
|
String |
getDescription()
Gets the description of descriptive text for the component.
|
String |
getParamValue(Log log,
Object object)
Retrieve the value of a the described parameter from the specified object.
|
Method |
getter(Class<?> clazz)
Returns the getter for the component in the specified class.
|
ComponentType |
getType()
Gets the type of the component.
|
boolean |
isCollection()
Get the isCollection flag.
|
boolean |
isRequired()
Get the canBeChild flag.
|
String |
methodName(String prefix)
Generate a method name for this description.
|
void |
setChild(Log log,
IHeaderMatcher.Builder builder,
String name,
String value)
Sets the child value in the builder.
|
void |
setChildren(Log log,
IHeaderMatcher.Builder builder,
Map<String,String> attributes)
Sets the children of values in the builder.
|
Method |
setter(Class<?> clazz)
Returns the setter for the component in the specified class.
|
String |
toString() |
String |
toString(int indent)
Write a description with indentation.
|
static Predicate<Description> |
typePredicate(ComponentType type) |
public Description(ComponentType type, String name, String desc, boolean isCollection, Class<?> childClass, Collection<Description> children, boolean required)
type
- the type of the component.name
- the name of the component.desc
- the description of the component.isCollection
- true if the getter/setter expects a collectionchildClass
- the class for expected for the getter/setter.children
- the collection of descriptions for all the components that
are children of the described component.public Description(ConfigComponent configComponent, boolean isCollection, Class<?> childClass, Collection<Description> children)
configComponent
- the configuration componentisCollection
- the collection flag.childClass
- the type of object that the method getter/setter expects.children
- the collection of descriptions for all the components that
are children the described component.public static Predicate<Description> typePredicate(ComponentType type)
public boolean isRequired()
true
if this item can be a child of the containing item.public ComponentType getType()
public boolean isCollection()
public Class<?> getChildType()
public String getCommonName()
public String getDescription()
public String getParamValue(Log log, Object object)
null
.log
- the Log to log issues to.object
- the object that contains the value.public Map<String,Description> getChildren()
public Collection<Description> childrenOfType(ComponentType type)
type
- the type to returnpublic Collection<Description> filterChildren(Predicate<Description> filter)
filter
- the filter to apply to the child descriptions.public String methodName(String prefix)
prefix
- the start of the method name (e.g. "set", "get" )public Method getter(Class<?> clazz) throws NoSuchMethodException, SecurityException
clazz
- the Class to get the getter from.NoSuchMethodException
- if the class does not have the getter.SecurityException
- if the getter can not be accessed.public Method setter(Class<?> clazz) throws NoSuchMethodException, SecurityException
set(String)
method.set(String)
method.set
method that takes a
childeClass
argument.clazz
- the Class to get the getter from, generally a Builder class..NoSuchMethodException
- if the class does not have the getter.SecurityException
- if the getter can not be accessed.public void setChildren(Log log, IHeaderMatcher.Builder builder, Map<String,String> attributes)
log
- The log to write messages to.builder
- The Matcher builder to set the values in.attributes
- a Map of parameter names to values.public void setChild(Log log, IHeaderMatcher.Builder builder, String name, String value)
log
- The log to write messages to.builder
- The Matcher builder to set the values in.name
- the name of the child to setvalue
- the value of the parameter.public String toString(int indent)
indent
- the number of spaces to indent.Copyright © 2006–2024 Apache Software Foundation. All rights reserved.