Package org.opt4j.config
Class Property
java.lang.Object
org.opt4j.config.Property
The
Property
contains information about a single property of a
PropertyModule
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Class<? extends Annotation>,
Annotation> protected final Method
protected String
protected final com.google.inject.Module
protected final String
protected int
protected final Collection<Requirement>
protected final Method
protected final Class<?>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Returns the annotations of this property.Returns the getter method.getInfo()
Returns the info.getName()
Returns the name.int
getOrder()
Returns the order.Returns the requirements.Returns the setter method.Class<?>
getType()
Returns the type.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
Sets the info.void
setOrder
(int order) Sets the order.void
Sets the value of the property.void
Sets the value of the property.protected void
setValueObject
(Object value) Sets the value of the property.
-
Field Details
-
module
protected final com.google.inject.Module module -
name
-
type
-
getter
-
setter
-
info
-
order
protected int order -
requirements
-
annotations
-
-
Constructor Details
-
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 Details
-
getInfo
Returns the info.- Returns:
- the info
- See Also:
-
setInfo
Sets the info.- Parameters:
info
- the info to set- See Also:
-
getOrder
public int getOrder()Returns the order.- Returns:
- the order
- See Also:
-
setOrder
public void setOrder(int order) Sets the order.- Parameters:
order
- the order to set- See Also:
-
getName
Returns the name.- Returns:
- the name
-
getType
Returns the type.- Returns:
- the type
-
getGetter
Returns the getter method.- Returns:
- the getter
-
getSetter
Returns the setter method.- Returns:
- the setter
-
addRequirement
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
Returns the requirements.- Returns:
- the requirements
-
getValue
Returns the value of the property.- Returns:
- the value of the property
- See Also:
-
setValue
Sets the value of the property.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned- See Also:
-
setValue
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
Sets the value of the property.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned
-
getAnnotations
Returns the annotations of this property.- Returns:
- the annotations
-
getAnnotation
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
-