net.sf.saxon.type
Class Facet

java.lang.Object
  extended bynet.sf.saxon.type.Facet
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LengthFacet, PatternFacet, ValueRangeFacet

public class Facet
extends Object
implements Serializable

Represents the base type for XML Schema Facets

Version:
$Revision: 1.1 $ $Date: 2004/03/09 10:10:35 $
Author:
Keith Visco
See Also:
Serialized Form

Field Summary
static String ENUMERATION
           
static String FRACTIONDIGITS
           
static String LENGTH
           
static String MAX_EXCLUSIVE
           
static String MAX_INCLUSIVE
           
static String MAX_LENGTH
           
static String MIN_EXCLUSIVE
           
static String MIN_INCLUSIVE
           
static String MIN_LENGTH
           
static String PATTERN
           
static String TOTALDIGITS
           
static String WHITESPACE
           
 
Constructor Summary
protected Facet()
           
 
Method Summary
 void checkFacetRestriction(SimpleType base)
          Check that this facet is legal when used on a type derived by restriction
 String getName()
          Returns the name of this Facet
 String getValue()
          Returns the character (String) representation of this facet
 boolean isMultivalued()
          Returns true if this Facet can occur more than once, such as the "enumeration" facet.
static Facet makeFacet(String name, String value)
          Factory method: creates a new Facet with the given name
 boolean testAtomicValue(AtomicValue value)
          Test whether an atomic value conforms to this facet
 byte toByte()
          Returns a byte representation of the value of this facet
 double toDouble()
          Returns a double representation of the value of this facet
 float toFloat()
          Returns a double representation of the value of this facet
 long toLong()
          Returns a long representation of the value of this facet
 short toShort()
          Returns an short representation of the value of this facet
 boolean validate(ErrorListener errorListener)
          Checks the validity of this Schema defintion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENUMERATION

public static final String ENUMERATION
See Also:
Constant Field Values

LENGTH

public static final String LENGTH
See Also:
Constant Field Values

PATTERN

public static final String PATTERN
See Also:
Constant Field Values

MAX_EXCLUSIVE

public static final String MAX_EXCLUSIVE
See Also:
Constant Field Values

MAX_INCLUSIVE

public static final String MAX_INCLUSIVE
See Also:
Constant Field Values

MIN_EXCLUSIVE

public static final String MIN_EXCLUSIVE
See Also:
Constant Field Values

MIN_INCLUSIVE

public static final String MIN_INCLUSIVE
See Also:
Constant Field Values

MAX_LENGTH

public static final String MAX_LENGTH
See Also:
Constant Field Values

MIN_LENGTH

public static final String MIN_LENGTH
See Also:
Constant Field Values

WHITESPACE

public static final String WHITESPACE
See Also:
Constant Field Values

TOTALDIGITS

public static final String TOTALDIGITS
See Also:
Constant Field Values

FRACTIONDIGITS

public static final String FRACTIONDIGITS
See Also:
Constant Field Values
Constructor Detail

Facet

protected Facet()
Method Detail

makeFacet

public static Facet makeFacet(String name,
                              String value)
                       throws SchemaException
Factory method: creates a new Facet with the given name

Parameters:
name - the name of the Facet
value - the value of the Facet
Throws:
SchemaException

getName

public String getName()
Returns the name of this Facet

Returns:
the name of this Facet

getValue

public String getValue()
Returns the character (String) representation of this facet

Returns:
the value of this facet

isMultivalued

public boolean isMultivalued()
Returns true if this Facet can occur more than once, such as the "enumeration" facet.

Returns:
true if this Facet can occur more than once.

toLong

public long toLong()
            throws NumberFormatException
Returns a long representation of the value of this facet

Returns:
a long representation of the value of this facet
Throws:
NumberFormatException

toShort

public short toShort()
              throws NumberFormatException
Returns an short representation of the value of this facet

Returns:
an short representation of the value of this facet
Throws:
NumberFormatException

toFloat

public float toFloat()
              throws NumberFormatException
Returns a double representation of the value of this facet

Returns:
a double representation of the value of this facet
Throws:
NumberFormatException

toDouble

public double toDouble()
                throws NumberFormatException
Returns a double representation of the value of this facet

Returns:
a double representation of the value of this facet
Throws:
NumberFormatException

toByte

public byte toByte()
            throws NumberFormatException
Returns a byte representation of the value of this facet

Returns:
a byte representation of the value of this facet
Throws:
NumberFormatException

checkFacetRestriction

public void checkFacetRestriction(SimpleType base)
                           throws SchemaException
Check that this facet is legal when used on a type derived by restriction

Parameters:
base - the type from which the restricted type is derived
Throws:
SchemaException - if the facet is not legal

validate

public boolean validate(ErrorListener errorListener)
                 throws SchemaException
Checks the validity of this Schema defintion.

Throws:
SchemaException - when this Schema definition is invalid.

testAtomicValue

public boolean testAtomicValue(AtomicValue value)
Test whether an atomic value conforms to this facet

Parameters:
value - the value to be tested
Returns:
true if the value conforms; false if it doesn't conform, or if the test fails