aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org/onap/policy/common/utils/properties
diff options
context:
space:
mode:
Diffstat (limited to 'utils/src/main/java/org/onap/policy/common/utils/properties')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/PropertyConfiguration.java40
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/SpecProperties.java2
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAccessException.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAnnotationException.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyException.java9
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyInvalidException.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyMissingException.java1
7 files changed, 45 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
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/SpecProperties.java b/utils/src/main/java/org/onap/policy/common/utils/properties/SpecProperties.java
index 0f416c3a..17009a83 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/SpecProperties.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/SpecProperties.java
@@ -39,6 +39,7 @@ public class SpecProperties extends Properties {
private final String specPrefix;
/**
+ * Constructor.
*
* @param prefix the property name prefix that appears before any specialization, may
* be ""
@@ -50,6 +51,7 @@ public class SpecProperties extends Properties {
}
/**
+ * Constructor.
*
* @param prefix the property name prefix that appears before any specialization, may
* be ""
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAccessException.java b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAccessException.java
index 568a8a79..b416cd0f 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAccessException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAccessException.java
@@ -28,6 +28,7 @@ public class PropertyAccessException extends PropertyException {
private static final long serialVersionUID = 1L;
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -37,6 +38,7 @@ public class PropertyAccessException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -47,6 +49,7 @@ public class PropertyAccessException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -57,6 +60,7 @@ public class PropertyAccessException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAnnotationException.java b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAnnotationException.java
index 2803ddfe..f068e158 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAnnotationException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyAnnotationException.java
@@ -27,6 +27,7 @@ public class PropertyAnnotationException extends PropertyException {
private static final long serialVersionUID = 1L;
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -36,6 +37,7 @@ public class PropertyAnnotationException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -46,6 +48,7 @@ public class PropertyAnnotationException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -56,6 +59,7 @@ public class PropertyAnnotationException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyException.java b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyException.java
index 8df4fb8e..44edd428 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyException.java
@@ -37,6 +37,7 @@ public class PropertyException extends Exception {
private final String fieldName;
/**
+ * Constructor.
*
* @param propName name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -49,6 +50,7 @@ public class PropertyException extends Exception {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -62,6 +64,7 @@ public class PropertyException extends Exception {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -75,6 +78,7 @@ public class PropertyException extends Exception {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -89,6 +93,7 @@ public class PropertyException extends Exception {
}
/**
+ * Get the property name.
*
* @return name of the property for which the exception was thrown, or {@code null} if
* no name was provided
@@ -98,6 +103,7 @@ public class PropertyException extends Exception {
}
/**
+ * Get the field name.
*
* @return name of the field for which the exception was thrown, or {@code null} if no
* field was provided
@@ -107,6 +113,8 @@ public class PropertyException extends Exception {
}
/**
+ * Make the message.
+ *
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
* @param message error message, never {@code null}
@@ -117,6 +125,7 @@ public class PropertyException extends Exception {
}
/**
+ * Make the message.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyInvalidException.java b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyInvalidException.java
index da1b6ae8..aad44318 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyInvalidException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyInvalidException.java
@@ -28,6 +28,7 @@ public class PropertyInvalidException extends PropertyException {
private static final long serialVersionUID = 1L;
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -37,6 +38,7 @@ public class PropertyInvalidException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -47,6 +49,7 @@ public class PropertyInvalidException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
@@ -57,6 +60,7 @@ public class PropertyInvalidException extends PropertyException {
}
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}
diff --git a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyMissingException.java b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyMissingException.java
index de542e6a..ccbe5f9a 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyMissingException.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/properties/exception/PropertyMissingException.java
@@ -27,6 +27,7 @@ public class PropertyMissingException extends PropertyException {
private static final long serialVersionUID = 1L;
/**
+ * Constructor.
*
* @param propnm name of the property causing the exception, or {@code null}
* @param fieldName name of the field causing the exception, or {@code null}