| org.geotools.xml.SimpleBinding
All known Subclasses: org.geotools.xs.bindings.XSTypeDerivationControlBinding, org.geotools.xs.bindings.XSHexBinaryBinding, org.geotools.xs.bindings.XSUnsignedByteBinding, org.geotools.xs.bindings.XSFormChoiceBinding, org.geotools.xs.bindings.XSUnsignedLongBinding, org.geotools.xs.bindings.XSBlockSetBinding, org.geotools.xs.bindings.XSDateTimeBinding, org.geotools.xs.bindings.XSUnsignedShortBinding, org.geotools.xs.bindings.XSENTITYBinding, org.geotools.xs.bindings.XSNonPositiveIntegerBinding, org.geotools.xs.bindings.XSNonNegativeIntegerBinding, org.geotools.xs.bindings.XSSimpleDerivationSetBinding, org.geotools.xs.bindings.XSBase64BinaryBinding, org.geotools.xs.bindings.XSDurationBinding, org.geotools.xs.bindings.XSUnsignedIntBinding, org.geotools.xs.bindings.XSGYearBinding, org.geotools.xs.bindings.XSBooleanBinding, org.geotools.xs.bindings.XSStringBinding, org.geotools.sld.bindings.SLDGammaValueBinding, org.geotools.xs.bindings.XSLongBinding, org.geotools.xs.bindings.XSIntegerBinding, org.geotools.xs.bindings.XSNOTATIONBinding, org.geotools.xs.bindings.XSShortBinding, org.geotools.xs.bindings.XSTimeBinding, org.geotools.xs.bindings.XSLanguageBinding, org.geotools.xs.bindings.XSAnySimpleTypeBinding, org.geotools.xs.bindings.XSENTITIESBinding, org.geotools.xs.bindings.XSPositiveIntegerBinding, org.geotools.xs.bindings.XSGMonthBinding, org.geotools.xs.bindings.XSFloatBinding, org.geotools.xs.bindings.XSNegativeIntegerBinding, org.geotools.xs.bindings.XSIDREFSBinding, org.geotools.xs.bindings.XSDecimalBinding, org.geotools.xs.bindings.XSDerivationSetBinding, org.geotools.xs.bindings.XSDerivationControlBinding, org.geotools.xs.bindings.XSNMTOKENSBinding, org.geotools.xs.bindings.XSQNameBinding, org.geotools.xs.bindings.XSByteBinding, org.geotools.sld.bindings.SLDFormatBinding, org.geotools.xml.AbstractSimpleBinding, org.geotools.gml2.bindings.GMLNullTypeBinding, org.geotools.xs.bindings.XSGDayBinding, org.geotools.xs.bindings.XSGMonthDayBinding, org.geotools.xs.bindings.XSIntBinding, org.geotools.xs.bindings.XSDateBinding, org.geotools.xs.bindings.XSGYearMonthBinding, org.geotools.xs.bindings.XSReducedDerivationControlBinding, org.geotools.xs.bindings.XSPublicBinding, org.geotools.xs.bindings.XSAnyURIBinding, org.geotools.xs.bindings.XSFullDerivationSetBinding, org.geotools.xs.bindings.XSDoubleBinding, org.geotools.xs.bindings.XSIDREFBinding, org.geotools.xs.bindings.XSNamespaceListBinding, org.geotools.xs.bindings.XSAllNNIBinding,
SimpleBinding | public interface SimpleBinding extends Binding(Code) | | A strategy for parsing components in an instance document which are of
simple type.
Simple types can be manifested in elements and in attributes. Simple type
strategies must be capable of parsing simple values regardless of the form.
Strategy objects must declare how they relate to other strategy objects in
the type hierarchy of the type they parse. To allow strategy objects which
relate through a type hiearchy to communicate, a value is passed along to
strategies as they are executed. As an example, consider the strategies for
integer and decimal.
class DecimalStrategy implements Strategy {
...
int getExecutionMode() {
return OVERRIDE;
}
Object parse(InstanceComponent instance, Object value)
throws Exception {
BigDecimal decimal = new BigDecimal(instance.getText());
return decimal;
}
...
}
class IntegerStrategy implements Strategy {
...
int getExecutionMode() {
return AFTER;
}
Object parse(InstanceComponent instance, Object value)
throws Exception {
BigDecimal decimal = (BigDecimal)value;
return decimal.toBigInteger();
}
...
}
In the above example, the decimal strategy is at the top of the hierarchy as
it declares its execution mode as
org.geotools.xml.Binding.OVERRIDE .
Therefore it must process the raw text of the instance being parsed, and transform
it into the specific object, in this case an object of type BigDecimal.
The integer strategy extends the decimal strategy as it declares its
execution mode as
org.geotools.xml.Binding.AFTER . Therefore
the integer strategy has access to the result of the decimal strategy,
and can simply transform the result of the decimal strategy into its
specific type. In this case an object of type BigInteger.
author: Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net |
Method Summary | |
String | encode(Object object, String value) Performs the encoding of the object as a String.
Parameters: object - The object being encoded, never null. Parameters: value - The string returned from another binding in the typehierachy, which could be null. | Object | parse(InstanceComponent instance, Object value) Parses an instance component (element or attribute) into an object
representation.
Parameters: instance - The component being parsed. Parameters: value - The result of the parse from another strategy in the typehierarchy. |
encode | String encode(Object object, String value) throws Exception(Code) | | Performs the encoding of the object as a String.
Parameters: object - The object being encoded, never null. Parameters: value - The string returned from another binding in the typehierachy, which could be null. A String representing the object. |
parse | Object parse(InstanceComponent instance, Object value) throws Exception(Code) | | Parses an instance component (element or attribute) into an object
representation.
Parameters: instance - The component being parsed. Parameters: value - The result of the parse from another strategy in the typehierarchy. Could be null if this is the first strategy being executed. The parsed object, or null if the component could not be parsed. throws: Strategy - objects should not attempt to handle any exceptions. |
|
|