public class PropertyManagement extends Object implements Serializable
The class supports some basic conversions.
Non-serializable objects: Persistable instances are converted to and from byte
formats. QueryConstraints is a special case, supporting WKT String. Path are
converted to a from string representation of the their URI.
Serializable objects: NumericRange supports min,max in string representation (e.g.
"1.0,2.0")
NOTE: ConfigutationWrapper implementation is scopeless.
EXPECTED FUTURE WORK: I am bit unsatisfied with the duality of the parameters base class. In one case, in is treated a description for a class value and, in the other case, it is treated as a description for the type of a property value. The former is really a descriptor of a Class of type class. Generics do not help due to erasure. The impact of this inconsistency is the inability to validate on 'store'. Instead, validation occurs on 'gets'. The ultimate goal is to uniformly provide feedback to parameters from command line arguments and property files on submission to the manager rather than on extraction from the manager.
| Modifier and Type | Class and Description |
|---|---|
static class |
PropertyManagement.ByteConverter |
static class |
PropertyManagement.DoubleConverter |
static class |
PropertyManagement.IntegerConverter |
static class |
PropertyManagement.PathConverter |
static class |
PropertyManagement.PersistableConverter |
static interface |
PropertyManagement.PropertyConverter<T> |
static interface |
PropertyManagement.PropertyGroup<T extends Serializable> |
static class |
PropertyManagement.QueryConverter |
| Constructor and Description |
|---|
PropertyManagement() |
PropertyManagement(ParameterEnum<?>[] names,
Object[] values) |
PropertyManagement(PropertyManagement.PropertyConverter<?>[] converters,
ParameterEnum<?>[] names,
Object[] values) |
PropertyManagement(PropertyManagement pm) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConverter(PropertyManagement.PropertyConverter<?> converter)
Add to the set of converters used to take a String representation of a value and convert it
into another serializable form.
|
void |
copy(ParameterEnum<?> propertyNameFrom,
ParameterEnum<?> propertyNameTo) |
void |
dump() |
Serializable |
get(ParameterEnum<?> propertyName) |
<T> T |
getClassInstance(ParameterEnum<?> property,
Class<T> iface,
Class<?> defaultClass) |
Object |
getProperty(ParameterEnum<?> property)
Returns the value as, without conversion from the properties.
|
<T> T |
getProperty(ParameterEnum<?> property,
PropertyManagement.PropertyConverter<T> converter)
Returns the value after conversion.
|
Boolean |
getPropertyAsBoolean(ParameterEnum<?> property,
Boolean defaultValue) |
byte[] |
getPropertyAsBytes(ParameterEnum<?> property) |
Class<?> |
getPropertyAsClass(ParameterEnum<?> property) |
<T> Class<? extends T> |
getPropertyAsClass(ParameterEnum<?> property,
Class<? extends T> iface,
Class<? extends T> defaultClass) |
<T> Class<T> |
getPropertyAsClass(ParameterEnum<?> property,
Class<T> iface) |
Double |
getPropertyAsDouble(ParameterEnum<?> property,
double defaultValue) |
Integer |
getPropertyAsInt(ParameterEnum<?> property,
int defaultValue) |
org.apache.hadoop.fs.Path |
getPropertyAsPath(ParameterEnum<?> property) |
org.locationtech.geowave.core.index.persist.Persistable |
getPropertyAsPersistable(ParameterEnum<?> property) |
org.locationtech.geowave.core.store.api.Query<?> |
getPropertyAsQuery(ParameterEnum property) |
org.locationtech.geowave.core.index.numeric.NumericRange |
getPropertyAsRange(ParameterEnum<?> property,
org.locationtech.geowave.core.index.numeric.NumericRange defaultValue) |
String |
getPropertyAsString(ParameterEnum<?> property) |
String |
getPropertyAsString(ParameterEnum<?> property,
String defaultValue) |
boolean |
hasProperty(ParameterEnum<?> property) |
void |
setConfig(ParameterEnum<?>[] parameters,
org.apache.hadoop.conf.Configuration config,
Class<?> scope) |
void |
setJobConfiguration(org.apache.hadoop.conf.Configuration configuration,
Class<?> scope) |
void |
store(ParameterEnum<?> property,
Object value) |
<T> void |
store(ParameterEnum<?> property,
T value,
PropertyManagement.PropertyConverter<T> converter) |
void |
storeAll(ParameterEnum<?>[] names,
Object[] values) |
Serializable |
storeIfEmpty(ParameterEnum<?> propertyEnum,
Serializable value)
Does not work for non-serializable data (e.g.
|
public PropertyManagement()
public PropertyManagement(PropertyManagement.PropertyConverter<?>[] converters, ParameterEnum<?>[] names, Object[] values)
public PropertyManagement(ParameterEnum<?>[] names, Object[] values)
public PropertyManagement(PropertyManagement pm)
public Serializable get(ParameterEnum<?> propertyName)
public <T> void store(ParameterEnum<?> property, T value, PropertyManagement.PropertyConverter<T> converter)
public void store(ParameterEnum<?> property, Object value)
public Serializable storeIfEmpty(ParameterEnum<?> propertyEnum, Serializable value)
public void copy(ParameterEnum<?> propertyNameFrom, ParameterEnum<?> propertyNameTo)
public void storeAll(ParameterEnum<?>[] names, Object[] values)
public void setConfig(ParameterEnum<?>[] parameters, org.apache.hadoop.conf.Configuration config, Class<?> scope)
public <T> T getClassInstance(ParameterEnum<?> property, Class<T> iface, Class<?> defaultClass) throws InstantiationException
InstantiationExceptionpublic boolean hasProperty(ParameterEnum<?> property)
public String getPropertyAsString(ParameterEnum<?> property)
public Object getProperty(ParameterEnum<?> property) throws Exception
Exceptionpublic <T> T getProperty(ParameterEnum<?> property, PropertyManagement.PropertyConverter<T> converter) throws Exception
Exceptionpublic byte[] getPropertyAsBytes(ParameterEnum<?> property)
public String getPropertyAsString(ParameterEnum<?> property, String defaultValue)
public Boolean getPropertyAsBoolean(ParameterEnum<?> property, Boolean defaultValue)
public Integer getPropertyAsInt(ParameterEnum<?> property, int defaultValue)
public Double getPropertyAsDouble(ParameterEnum<?> property, double defaultValue)
public org.locationtech.geowave.core.index.numeric.NumericRange getPropertyAsRange(ParameterEnum<?> property, org.locationtech.geowave.core.index.numeric.NumericRange defaultValue)
public Class<?> getPropertyAsClass(ParameterEnum<?> property)
public <T> Class<T> getPropertyAsClass(ParameterEnum<?> property, Class<T> iface) throws ClassNotFoundException
ClassNotFoundExceptionpublic <T> Class<? extends T> getPropertyAsClass(ParameterEnum<?> property, Class<? extends T> iface, Class<? extends T> defaultClass)
public org.locationtech.geowave.core.store.api.Query<?> getPropertyAsQuery(ParameterEnum property) throws Exception
Exceptionpublic org.apache.hadoop.fs.Path getPropertyAsPath(ParameterEnum<?> property) throws Exception
Exceptionpublic org.locationtech.geowave.core.index.persist.Persistable getPropertyAsPersistable(ParameterEnum<?> property) throws Exception
Exceptionpublic void setJobConfiguration(org.apache.hadoop.conf.Configuration configuration,
Class<?> scope)
public void dump()
public void addConverter(PropertyManagement.PropertyConverter<?> converter)
This is done if the preferred internal representation does not match that of a string. For example, a query is maintained as bytes even though it can be provided as a query
converter - Copyright © 2013–2022. All rights reserved.