|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectthings.data.ThingsPropertyReaderToolkit
public class ThingsPropertyReaderToolkit
A grab bag of static property utilities as well as a view utility object class. These will define how the properties are parsed and presented.
Property lists are comma delimited. Whitespace is preserved.
ENCODING: Escape with ?. Separate multivalues with ,. The , may be escaped with ?. The = indicates equality. It may be escaped with the ?.
Version History
EPG - Partially adapted from another project - 22 NOV 04
| Nested Class Summary | |
|---|---|
static class |
ThingsPropertyReaderToolkit.Validations
The supported validations. |
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
ThingsPropertyReaderToolkit()
Default constructor. |
|
ThingsPropertyReaderToolkit(ThingsPropertyTree propertyTree)
Constructor. |
|
ThingsPropertyReaderToolkit(ThingsPropertyViewReader propertyViewReader)
Constructor. |
|
| Method Summary | |
|---|---|
static java.lang.String[] |
decodeString(java.lang.String value)
Decode the string. |
static java.lang.String |
encodeString(java.lang.String... values)
Encode a string of values and return as a new string. |
static java.lang.String |
encodeString(java.lang.String value)
Encode a string and return as a new string. |
static void |
encodeString(java.io.Writer out,
java.lang.String... values)
Encode a string of values to a writer. |
static void |
encodeString(java.io.Writer out,
java.lang.String value)
Encode a single string to a writer. |
static java.lang.String |
fixPath(java.lang.String root,
java.lang.String offset)
Fix the path to the root. |
java.lang.String |
getDefaulted(java.lang.String path,
java.lang.String defaultValue)
Get a optional property. |
java.lang.String |
getOptional(java.lang.String... path)
Get a optional property. |
java.lang.String |
getOptional(java.lang.String path)
Get a optional property. |
java.lang.String[] |
getOptionalAsMulti(java.lang.String... path)
Get a optional property as a multi-value. |
java.lang.String[] |
getOptionalAsMulti(java.lang.String path)
Get a optional property as a multi-value. |
java.lang.String |
getOptionalSingle(java.lang.String... path)
Get a optional property. |
java.lang.String |
getOptionalSingle(java.lang.String path)
Get a optional property. |
boolean |
getOptionalTruth(java.lang.String... path)
Get a optional property and evaluate it for truth. |
java.lang.String[] |
getOrderedNumberedPly(java.lang.String... path)
This will create an ordered list of property names from a ply that consists entirely of numeric entries. |
java.lang.String |
getRequired(java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations,
java.lang.String... path)
Get a required property. |
java.lang.String |
getRequired(java.lang.String... path)
Get a required property. |
java.lang.String |
getRequired(java.lang.String path)
Get a required property. |
java.lang.String |
getRequired(java.lang.String path,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
Get a required property. |
java.lang.String[] |
getRequiredAsMulti(java.lang.String... path)
Get a required property as a multi-value. |
java.lang.String[] |
getRequiredAsMulti(java.lang.String path)
Get a required property as a multi-value. |
int |
getRequiredInteger(java.lang.String... path)
Get a required property and evaluate it as an integer. |
int |
getRequiredInteger(java.lang.String path)
Get a required property and evaluate it as an integer. |
java.lang.String |
getRequiredSingle(java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations,
java.lang.String... path)
Get a required property. |
java.lang.String |
getRequiredSingle(java.lang.String... path)
Get a required property. |
java.lang.String |
getRequiredSingle(java.lang.String path)
Get a required property. |
java.lang.String |
getRequiredSingle(java.lang.String path,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
Get a required property. |
boolean |
getRequiredTruth(java.lang.String... path)
Get a required property and evaluate it for truth. |
ThingsPropertyViewReader |
getView()
Get the property view reader. |
static java.lang.String |
path(java.lang.String... items)
Build a path. |
static java.util.ListIterator<java.lang.String> |
propertyList(java.lang.String property)
It will take a single property and treat it as a list. |
void |
validate(java.lang.String target,
java.lang.String name,
java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations)
Validate. |
void |
validate(java.lang.String target,
java.lang.String name,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
Validate. |
int |
validateInt(java.lang.String target,
java.lang.String name)
Validate integer. |
long |
validateLong(java.lang.String target,
java.lang.String name)
Validate long. |
static void |
validatePath(java.lang.String path)
Validate the path. |
static void |
validateValue(java.lang.String value)
Validate a value. |
static void |
validateValues(java.lang.String[] values)
Validate a values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThingsPropertyReaderToolkit()
throws ThingsException
ThingsException
public ThingsPropertyReaderToolkit(ThingsPropertyViewReader propertyViewReader)
throws ThingsException
propertyViewReader - The view reader to use.
ThingsException
public ThingsPropertyReaderToolkit(ThingsPropertyTree propertyTree)
throws ThingsException
propertyTree - The tree to use.
ThingsException| Method Detail |
|---|
public java.lang.String getRequired(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String getRequired(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsException
public boolean getRequiredTruth(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsExceptionPlato
public int getRequiredInteger(java.lang.String path)
throws ThingsException
path - the property name
ThingsExceptionPlato
public int getRequiredInteger(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsExceptionPlato
public java.lang.String getRequired(java.lang.String path,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
throws ThingsException
path - the property namerequestedValidations - The requested validations
ThingsException
public java.lang.String getRequired(java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations,
java.lang.String... path)
throws ThingsException
path - pieces of the path.requestedValidations - The requested validations
ThingsException
public java.lang.String getRequiredSingle(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String getRequiredSingle(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsException
public java.lang.String getRequiredSingle(java.lang.String path,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
throws ThingsException
path - the property namerequestedValidations - The requested validations
ThingsException
public java.lang.String getRequiredSingle(java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations,
java.lang.String... path)
throws ThingsException
path - pieces of the path.requestedValidations - The requested validations
ThingsException
public java.lang.String[] getRequiredAsMulti(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String[] getRequiredAsMulti(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsException
public java.lang.String getOptional(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String getDefaulted(java.lang.String path,
java.lang.String defaultValue)
path - the property namedefaultValue - the default value.
public java.lang.String getOptional(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsException
public boolean getOptionalTruth(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsExceptionPlato
public java.lang.String getOptionalSingle(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String getOptionalSingle(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsException
public java.lang.String[] getOptionalAsMulti(java.lang.String path)
throws ThingsException
path - the property name
ThingsException
public java.lang.String[] getOptionalAsMulti(java.lang.String... path)
throws ThingsException
path - pieces of the path.
ThingsExceptionpublic ThingsPropertyViewReader getView()
ThingsPropertyViewReader
public java.lang.String[] getOrderedNumberedPly(java.lang.String... path)
throws ThingsException
path - to the ply
ThingsException
public static void validatePath(java.lang.String path)
throws ThingsException
ThingsException
public static void validateValue(java.lang.String value)
throws ThingsException
ThingsException
public static void validateValues(java.lang.String[] values)
throws ThingsException
ThingsException
public static java.lang.String fixPath(java.lang.String root,
java.lang.String offset)
throws ThingsException
root - the root offset. You can use null.offset - the offset from root.
ThingsExceptionpublic static java.lang.String path(java.lang.String... items)
items - the strings to build.
public static java.lang.String[] decodeString(java.lang.String value)
throws ThingsException
value - The string to decode.
ThingsException - Null or bad strings will cause exceptions.
public static java.lang.String encodeString(java.lang.String... values)
throws ThingsException
values - The strings to encode.
ThingsException - Null or bad strings will cause exceptions.
public static java.lang.String encodeString(java.lang.String value)
throws ThingsException
value - The string to encode.
ThingsException - Null or bad strings will cause exceptions.
public static void encodeString(java.io.Writer out,
java.lang.String... values)
throws ThingsException
values - The strings to encode.out - The target writer.
ThingsException - Null or bad strings will cause exceptions.
public static void encodeString(java.io.Writer out,
java.lang.String value)
throws java.lang.Throwable
value - The string to encode.out - The target writer.
java.lang.Throwable - Null or bad strings will cause exceptions.
public void validate(java.lang.String target,
java.lang.String name,
java.util.Collection<ThingsPropertyReaderToolkit.Validations> requestedValidations)
throws ThingsException
This is a kludge with the toArray. Bleh. No time.
target - The string to check.name - Property name (used for error reporting, if necessary).requestedValidations - All the validations as a collection. Remember, NOT_NULL is assumed.
ThingsException - with code DATA_ERROR_PROPERTY_FAILED_VALIDATION if any validation fails.
public void validate(java.lang.String target,
java.lang.String name,
ThingsPropertyReaderToolkit.Validations... requestedValidations)
throws ThingsException
target - The string to check.name - Property name (used for error reporting, if necessary).requestedValidations - All the validations. Remember, NOT_NULL is assumed.
ThingsException - with code DATA_ERROR_PROPERTY_FAILED_VALIDATION if any validation fails.
public int validateInt(java.lang.String target,
java.lang.String name)
throws ThingsException
target - The string to check.name - property name for error reporting purposes.
ThingsException - with code DATA_ERROR_PROPERTY_FAILED_VALIDATION if any validation fails.
public long validateLong(java.lang.String target,
java.lang.String name)
throws ThingsException
target - The string to check.name - property name for error reporting purposes.
ThingsException - with code DATA_ERROR_PROPERTY_FAILED_VALIDATION if any validation fails.public static java.util.ListIterator<java.lang.String> propertyList(java.lang.String property)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||