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
FieldsModifier and TypeFieldDescriptionprotected final Map<Class<? extends Annotation>,Annotation> protected final Methodprotected Stringprotected final com.google.inject.Moduleprotected final Stringprotected intprotected final Collection<Requirement>protected final Methodprotected final Class<?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequirement(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.intgetOrder()Returns the order.Returns the requirements.Returns the setter method.Class<?>getType()Returns the type.getValue()Returns the value of the property.booleanisActive()Returnstrueif the property is active.booleanisNumber()Returnstrueif the property represents a number.voidSets the info.voidsetOrder(int order) Sets the order.voidSets the value of the property.voidSets the value of the property.protected voidsetValueObject(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()Returnstrueif the property is active.- Returns:
trueif 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()Returnstrueif the property represents a number.- Returns:
trueif 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
-