Class NumericPropertyParser
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.NumericPropertyParser
Turns a configuration property or request parameter into a whole number. Configuration properties arrive from
JSON, so a value set as 30 may reach the connector as an Integer, a Long, a Double (30.0) or a String, and request
parameters are always Strings that may carry surrounding spaces. Parsing the value's string form with
Integer.parseInt rejected 30.0 and " 30" with a bare NumberFormatException that named neither the property nor
its value. Any representation of a whole number in range is now accepted, and anything else is reported with
the property's name.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetIntConfigurationProperty(String propertyName, Object propertyValue) Return the value of a configuration property as an int.static intgetIntRequestParameter(String parameterName, String parameterValue) Return the value of a request parameter as an int.static longgetLongConfigurationProperty(String propertyName, Object propertyValue) Return the value of a configuration property as a long.static longgetLongRequestParameter(String parameterName, String parameterValue) Return the value of a request parameter as a long.
-
Constructor Details
-
NumericPropertyParser
public NumericPropertyParser()
-
-
Method Details
-
getIntConfigurationProperty
Return the value of a configuration property as an int.- Parameters:
propertyName- name of the configuration propertypropertyValue- value of the configuration property (not null)- Returns:
- int value
- Throws:
OMFRuntimeException- the value is not a whole number in the range of an int
-
getLongConfigurationProperty
Return the value of a configuration property as a long.- Parameters:
propertyName- name of the configuration propertypropertyValue- value of the configuration property (not null)- Returns:
- long value
- Throws:
OMFRuntimeException- the value is not a whole number in the range of a long
-
getIntRequestParameter
Return the value of a request parameter as an int.- Parameters:
parameterName- name of the request parameterparameterValue- value of the request parameter (not null)- Returns:
- int value
- Throws:
OMFRuntimeException- the value is not a whole number in the range of an int
-
getLongRequestParameter
Return the value of a request parameter as a long.- Parameters:
parameterName- name of the request parameterparameterValue- value of the request parameter (not null)- Returns:
- long value
- Throws:
OMFRuntimeException- the value is not a whole number in the range of a long
-