|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.types.Type org.xins.common.types.standard.Properties
Standard type _properties.
Field Summary | |
static Properties |
SINGLETON
The only instance of this class. |
Constructor Summary | |
protected |
Properties(String name,
Type nameType,
Type valueType)
Constructs a new Properties object (constructor for
subclasses). |
Method Summary | |
static PropertyReader |
fromStringForOptional(String string)
Constructs a PropertyReader from the specified string. |
static PropertyReader |
fromStringForRequired(String string)
Constructs a PropertyReader from the specified string
which is guaranteed to be non-null . |
protected Object |
fromStringImpl(String string)
Converts from a String to an instance of the value class
for this type (implementation method). |
protected boolean |
isValidValueImpl(String string)
Determines if the specified String value is considered
valid for this type (implementation method). |
String |
toString(Object value)
Generates a string representation of the specified value for this type. |
static String |
toString(PropertyReader value)
Converts the specified PropertyReader to a string. |
Methods inherited from class org.xins.common.types.Type |
checkValue, fromString, getName, getValueClass, isValidValue, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Properties SINGLETON
null
.
Constructor Detail |
protected Properties(String name, Type nameType, Type valueType)
Properties
object (constructor for
subclasses).
name
- the name of this type, cannot be null
.nameType
- the type for property names, or null
if Text
should be assumed.valueType
- the type for property values, or null
if Text
should be assumed.Method Detail |
public static PropertyReader fromStringForRequired(String string) throws IllegalArgumentException, TypeValueException
PropertyReader
from the specified string
which is guaranteed to be non-null
.
string
- the string to convert, cannot be null
.
PropertyReader
object, never null
.
IllegalArgumentException
- if string == null
.
TypeValueException
- if the specified string does not represent a valid value for this
type.public static PropertyReader fromStringForOptional(String string) throws TypeValueException
PropertyReader
from the specified string.
string
- the string to convert, can be null
.
PropertyReader
, or null
if
string == null
.
TypeValueException
- if the specified string does not represent a valid value for this
type.public static String toString(PropertyReader value)
PropertyReader
to a string.
value
- the value to convert, can be null
.
null
if and
only if value == null
.protected final boolean isValidValueImpl(String string)
Type
String
value is considered
valid for this type (implementation method).
This method is called from Type.isValidValue(String)
. When
called from that method, it is guaranteed that the argument is not
null
.
Type
returns
true
.
isValidValueImpl
in class Type
string
- the String
value that should be checked for validity,
never null
.
true
if and only if the specified String
value is valid, false
otherwise.protected final Object fromStringImpl(String string) throws TypeValueException
Type
String
to an instance of the value class
for this type (implementation method).
This method is not required to check the validity of the specified
value (since Type.isValidValueImpl(String)
should have been called
before) but if it does, then it may throw a TypeValueException
.
fromStringImpl
in class Type
string
- the string to convert to an instance of the value class, guaranteed
to be not null
and guaranteed to have been passed to
Type.isValidValueImpl(String)
without getting an exception.
null
.
TypeValueException
- if string
is considered to be an invalid value for this
type.public final String toString(Object value) throws IllegalArgumentException, ClassCastException, TypeValueException
Type
Type.getValueClass()
). Also, it may have to fall within a
certain range of valid values, depending on the type.
The default implementation of this method in class Type
does
the following:
value == null
then it throws an
IllegalArgumentException
;
getValueClass().isInstance(value) == false
then
it throws a ClassCastException
;
value.
Object.toString()
.
toString
in class Type
value
- the value, cannot be null
.
null
.
ClassCastException
- if getValueClass().isInstance(value) == false
.
IllegalArgumentException
- if value == null
.
TypeValueException
- if the specified value is not in the allowed range.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |