diff options
Diffstat (limited to 'utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java')
-rw-r--r-- | utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java b/utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java index e72ebaba..653fe484 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java +++ b/utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java @@ -41,8 +41,8 @@ import org.onap.policy.common.utils.properties.exception.PropertyMissingExceptio * subclass. The values of the fields are set via <i>setXxx()</i> methods. As a result, if * a field is annotated and there is no corresponding <i>setXxx()</i> method, then an * exception will be thrown. - * <p> - * It is possible that an invalid <i>defaultValue</i> is specified via the + * + * <p>It is possible that an invalid <i>defaultValue</i> is specified via the * {@link Property} annotation. This could remain undetected until an optional property is * left out of the {@link Properties}. Consequently, this class will always validate a * {@link Property}'s default value, if the <i>defaultValue</i> is not empty or if @@ -120,23 +120,6 @@ public class PropertyConfiguration { } /** - * @param field field whose value is to be set - * @param prop property of interest - * @return the method to be used to set the field's value - * @throws PropertyAccessException if a "set" method cannot be identified - */ - private Method getSetter(Field field, Property prop) throws PropertyAccessException { - String nm = "set" + StringUtils.capitalize(field.getName()); - - try { - return this.getClass().getMethod(nm, field.getType()); - - } catch (NoSuchMethodException | SecurityException e) { - throw new PropertyAccessException(prop.name(), nm, e); - } - } - - /** * Sets a field's value from a particular property. * * @param setter method to be used to set the field's value @@ -167,6 +150,25 @@ public class PropertyConfiguration { } /** + * Get the setter. + * + * @param field field whose value is to be set + * @param prop property of interest + * @return the method to be used to set the field's value + * @throws PropertyAccessException if a "set" method cannot be identified + */ + private Method getSetter(Field field, Property prop) throws PropertyAccessException { + String nm = "set" + StringUtils.capitalize(field.getName()); + + try { + return this.getClass().getMethod(nm, field.getType()); + + } catch (NoSuchMethodException | SecurityException e) { + throw new PropertyAccessException(prop.name(), nm, e); + } + } + + /** * Gets a property value, coercing it to the field's type. * * @param field field whose value is to be set |