de.hedenus.xmltypes.impl
Class XMLLiteral

java.lang.Object
  extended by de.hedenus.xmltypes.impl.AbstractTypeImpl
      extended by de.hedenus.xmltypes.impl.XMLLiteral
All Implemented Interfaces:
Type

public class XMLLiteral
extends AbstractTypeImpl

XMLLiteral.

Author:
Michael Hedenus

Field Summary
 
Fields inherited from class de.hedenus.xmltypes.impl.AbstractTypeImpl
baseTypes, name, typeFactory
 
Constructor Summary
XMLLiteral(TypeFactoryImpl typeFactory)
           
 
Method Summary
 java.lang.Class getRepresentationClass()
          Returns the mapped Java type.
 java.lang.String getTypeSystem()
          Returns the type system identifier, for example "http://www.w3.org/2001/XMLSchema"
 boolean isAbstract()
          Returns true iff the type is abstract.
 boolean isPrimitive()
          Returns true iff the type is considered to be a primitive.
 java.lang.Object parse(java.lang.String literal)
          Parses a lexical value.
 boolean validate(java.lang.Object value)
          Returns true iff the value is valid.
 
Methods inherited from class de.hedenus.xmltypes.impl.AbstractTypeImpl
checkNull, getBaseTypes, getName, toLiteral, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLLiteral

public XMLLiteral(TypeFactoryImpl typeFactory)
Method Detail

getRepresentationClass

public java.lang.Class getRepresentationClass()
Description copied from interface: Type
Returns the mapped Java type.


getTypeSystem

public java.lang.String getTypeSystem()
Description copied from interface: Type
Returns the type system identifier, for example "http://www.w3.org/2001/XMLSchema"


isAbstract

public boolean isAbstract()
Description copied from interface: Type
Returns true iff the type is abstract. If a type is abstract the methods toLiteral() and parse() will throw an exception.
In terms of W3 Schema this is an ur-type.


isPrimitive

public boolean isPrimitive()
Description copied from interface: Type
Returns true iff the type is considered to be a primitive. The definition of a primitive type depends on the type system. Note that a constrained type may be considered as a primitive, e.g. the boolean primitive can be defined as an element of the set {0;1}, which is a constraint of the integral numbers. On the other hand, the boolean primitive can also be defined as in instance of {true;false} which is not a constraint of any other set.
In terms of W3 Schema primitive datatypes are those that are not defined in terms of other datatypes.


parse

public java.lang.Object parse(java.lang.String literal)
                       throws TypeException
Description copied from interface: Type
Parses a lexical value. Only the unconstrained base types may be used for parsing, i.e. it is possible that the parsing is successful but the resulting object is not valid according to the constraints of this particluar type. For example let the type be http://www.w3.org/2001/XMLSchema#nonNegativeInteger and the value be -5 then it is up to the implementation either to throw an exception (because the value is negative) or to return the value and let the application check it using the validate() method. The latter case would allow the user to be informed and to correct the value.
If the method is successful then the returned value should at least be valid according to the unconstrained base type of this particalur type.

Throws:
TypeException

validate

public boolean validate(java.lang.Object value)
Description copied from interface: Type
Returns true iff the value is valid.