Package org.opt4j.config
Class Property
- java.lang.Object
-
- org.opt4j.config.Property
-
public class Property extends Object
TheProperty
contains information about a single property of aPropertyModule
.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Class<? extends Annotation>,Annotation>
annotations
protected Method
getter
protected String
info
protected com.google.inject.Module
module
protected String
name
protected int
order
protected Collection<Requirement>
requirements
protected Method
setter
protected Class<?>
type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequirement(Requirement requirement)
Adds aRequirement
.<A extends Annotation>
AgetAnnotation(Class<? extends A> clazz)
Returns the annotation of the specified class or null if not existent.Collection<Annotation>
getAnnotations()
Returns the annotations of this property.Method
getGetter()
Returns the getter method.String
getInfo()
Returns the info.String
getName()
Returns the name.int
getOrder()
Returns the order.Collection<Requirement>
getRequirements()
Returns the requirements.Method
getSetter()
Returns the setter method.Class<?>
getType()
Returns the type.Object
getValue()
Returns the value of the property.boolean
isActive()
Returnstrue
if the property is active.boolean
isNumber()
Returnstrue
if the property represents a number.void
setInfo(String info)
Sets the info.void
setOrder(int order)
Sets the order.void
setValue(Object value)
Sets the value of the property.void
setValue(String value)
Sets the value of the property.protected void
setValueObject(Object value)
Sets the value of the property.
-
-
-
Field Detail
-
module
protected final com.google.inject.Module module
-
name
protected final String name
-
type
protected final Class<?> type
-
getter
protected final Method getter
-
setter
protected final Method setter
-
info
protected String info
-
order
protected int order
-
requirements
protected final Collection<Requirement> requirements
-
annotations
protected final Map<Class<? extends Annotation>,Annotation> annotations
-
-
Constructor Detail
-
Property
public Property(com.google.inject.Module module, String name, Class<?> type, Method getter, Method setter, Iterable<Annotation> annotations)
Constructs aProperty
.- Parameters:
module
- the modulename
- the nametype
- the typegetter
- the getter methodsetter
- the setter methodannotations
- the annotations
-
-
Method Detail
-
getInfo
public String getInfo()
Returns the info.- Returns:
- the info
- See Also:
setInfo(java.lang.String)
-
setInfo
public void setInfo(String info)
Sets the info.- Parameters:
info
- the info to set- See Also:
getInfo()
-
getOrder
public int getOrder()
Returns the order.- Returns:
- the order
- See Also:
setOrder(int)
-
setOrder
public void setOrder(int order)
Sets the order.- Parameters:
order
- the order to set- See Also:
getOrder()
-
getName
public String getName()
Returns the name.- Returns:
- the name
-
getType
public Class<?> getType()
Returns the type.- Returns:
- the type
-
getGetter
public Method getGetter()
Returns the getter method.- Returns:
- the getter
-
getSetter
public Method getSetter()
Returns the setter method.- Returns:
- the setter
-
addRequirement
public void addRequirement(Requirement requirement)
Adds aRequirement
.- Parameters:
requirement
- the requirement to add
-
isActive
public boolean isActive()
Returnstrue
if the property is active.- Returns:
true
if the property is active
-
getRequirements
public Collection<Requirement> getRequirements()
Returns the requirements.- Returns:
- the requirements
-
getValue
public Object getValue()
Returns the value of the property.- Returns:
- the value of the property
- See Also:
setValue(java.lang.Object)
-
setValue
public void setValue(Object value) throws InvocationTargetException
Sets the value of the property.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned- See Also:
getValue()
-
setValue
public void setValue(String value) throws InvocationTargetException
Sets the value of the property. The property has first to be converted to a the corresponding type.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned
-
isNumber
public boolean isNumber()
Returnstrue
if the property represents a number.- Returns:
true
if the property represents a number
-
setValueObject
protected void setValueObject(Object value) throws InvocationTargetException
Sets the value of the property.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned
-
getAnnotations
public Collection<Annotation> getAnnotations()
Returns the annotations of this property.- Returns:
- the annotations
-
getAnnotation
public <A extends Annotation> A getAnnotation(Class<? extends A> clazz)
Returns the annotation of the specified class or null if not existent.- Type Parameters:
A
- the annotation type- Parameters:
clazz
- the specific annotation class- Returns:
- the annotation
-
-