Package org.opt4j.core.config
Class Property
java.lang.Object
org.opt4j.core.config.Property
The
Property
contains information about a single property of a
PropertyModule
.-
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, i.e., allRequirement
s must be fulfilled.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.
-
Constructor Details
-
Property
public Property(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
Returns the order.- Returns:
- the order
- See Also:
-
setOrder
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
Returnstrue
if the property is active, i.e., allRequirement
s must be fulfilled.- 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 the corresponding type.- Parameters:
value
- the value to set- Throws:
InvocationTargetException
- thrown if the value cannot be assigned
-
isNumber
Returnstrue
if the property represents a number.- Returns:
true
if the property represents a number
-
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
-