Package com.sun.msv.datatype.xsd
Class TypeIncubator
- java.lang.Object
-
- com.sun.msv.datatype.xsd.TypeIncubator
-
public class TypeIncubator extends java.lang.Object
derives a new type by adding facets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
TypeIncubator.FacetInfo
-
Field Summary
Fields Modifier and Type Field Description private XSDatatypeImpl
baseType
base typeprivate static java.lang.String[][]
exclusiveFacetPairs
private java.util.Map
impl
storage for non-repeatable facets
-
Constructor Summary
Constructors Constructor Description TypeIncubator(XSDatatype baseType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context)
Deprecated.please use the addFacet method, which is better named.void
addFacet(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context)
adds a facet to the type.private static void
checkRangeConsistency(XSDatatypeImpl newType, java.lang.String facetName1, java.lang.String facetName2)
check (min,max) facet specification and makes sure that they are consistentprivate boolean
contains(java.lang.String facetName)
checks if the specified facet was added to this mapXSDatatypeImpl
derive(java.lang.String newName)
Deprecated.XSDatatypeImpl
derive(java.lang.String newNameUri, java.lang.String newLocalName)
derives a new datatype from a datatype by facets that were set.void
dump(java.io.PrintStream out)
dumps the contents to the given object.java.lang.Object
getFacet(java.lang.String facetName)
gets a value of non-repeatable facet the behavior is undefined when the specified facetName doesn't exist in this map.java.lang.String
getFacetNames()
gets names of the facets in this object this method is used to produce error messages.int
getNonNegativeInteger(java.lang.String facetName)
gets a value of non-repeatable facet as a non-negative integer the behavior is undefined when the specified facetName doesn't exist in this map.int
getPositiveInteger(java.lang.String facetName)
gets a value of non-repeatable facet as a positive integer the behavior is undefined when the specified facetName doesn't exist in this map.java.util.Vector
getVector(java.lang.String facetName)
gets a value of repeatable facet the behavior is undefined when the specified facetName doesn't exist in this map.boolean
isEmpty()
returns true if no facet is addedboolean
isFixed(java.lang.String facetName)
returns true if that facet is fixed.private static boolean
isRepeatable(java.lang.String facetName)
returns true if the specified facet is a facet which can be set multiple times.private static boolean
isValueFacet(java.lang.String facetName)
returns true if the specified facet is a facet that needs value-space-level check.private static org.relaxng.datatype.DatatypeException
reportFacetInconsistency(java.lang.String newName, DataTypeWithFacet o1, java.lang.String facetName1, DataTypeWithFacet o2, java.lang.String facetName2)
creates a BadTypeException with appropriate error message.
-
-
-
Field Detail
-
impl
private final java.util.Map impl
storage for non-repeatable facets
-
baseType
private final XSDatatypeImpl baseType
base type
-
exclusiveFacetPairs
private static final java.lang.String[][] exclusiveFacetPairs
-
-
Constructor Detail
-
TypeIncubator
public TypeIncubator(XSDatatype baseType)
-
-
Method Detail
-
add
public void add(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeException
Deprecated.please use the addFacet method, which is better named.adds a facet to the type.- Throws:
org.relaxng.datatype.DatatypeException
-
addFacet
public void addFacet(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeException
adds a facet to the type.- Throws:
org.relaxng.datatype.DatatypeException
- when given facet is already specified
-
derive
public XSDatatypeImpl derive(java.lang.String newName) throws org.relaxng.datatype.DatatypeException
Deprecated.- Throws:
org.relaxng.datatype.DatatypeException
-
derive
public XSDatatypeImpl derive(java.lang.String newNameUri, java.lang.String newLocalName) throws org.relaxng.datatype.DatatypeException
derives a new datatype from a datatype by facets that were set. It is completely legal to use null as the newTypeName parameter, which means the derivation of an anonymous datatype.- Throws:
org.relaxng.datatype.DatatypeException
- DatatypeException is thrown if derivation is somehow invalid. For example, not applicable facets are applied, or enumeration has invalid values, ... things like that.
-
checkRangeConsistency
private static void checkRangeConsistency(XSDatatypeImpl newType, java.lang.String facetName1, java.lang.String facetName2) throws org.relaxng.datatype.DatatypeException
check (min,max) facet specification and makes sure that they are consistent- Throws:
org.relaxng.datatype.DatatypeException
- when two facets are inconsistent
-
reportFacetInconsistency
private static org.relaxng.datatype.DatatypeException reportFacetInconsistency(java.lang.String newName, DataTypeWithFacet o1, java.lang.String facetName1, DataTypeWithFacet o2, java.lang.String facetName2)
creates a BadTypeException with appropriate error message. this method is only useful for reporting facet consistency violation.
-
isValueFacet
private static boolean isValueFacet(java.lang.String facetName)
returns true if the specified facet is a facet that needs value-space-level check.
-
isRepeatable
private static boolean isRepeatable(java.lang.String facetName)
returns true if the specified facet is a facet which can be set multiple times.
-
isFixed
public boolean isFixed(java.lang.String facetName)
returns true if that facet is fixed. the behavior is undefined when the specified facetName doesn't exist in this map.
-
getFacet
public java.lang.Object getFacet(java.lang.String facetName)
gets a value of non-repeatable facet the behavior is undefined when the specified facetName doesn't exist in this map.
-
getVector
public java.util.Vector getVector(java.lang.String facetName)
gets a value of repeatable facet the behavior is undefined when the specified facetName doesn't exist in this map.
-
getPositiveInteger
public int getPositiveInteger(java.lang.String facetName) throws org.relaxng.datatype.DatatypeException
gets a value of non-repeatable facet as a positive integer the behavior is undefined when the specified facetName doesn't exist in this map.- Throws:
org.relaxng.datatype.DatatypeException
- if the parameter cannot be parsed as a positive integer
-
getNonNegativeInteger
public int getNonNegativeInteger(java.lang.String facetName) throws org.relaxng.datatype.DatatypeException
gets a value of non-repeatable facet as a non-negative integer the behavior is undefined when the specified facetName doesn't exist in this map.- Throws:
org.relaxng.datatype.DatatypeException
- if the parameter cannot be parsed as a non-negative integer
-
contains
private boolean contains(java.lang.String facetName)
checks if the specified facet was added to this map
-
isEmpty
public boolean isEmpty()
returns true if no facet is added
-
dump
public void dump(java.io.PrintStream out)
dumps the contents to the given object. this method is for debug use only.
-
getFacetNames
public java.lang.String getFacetNames()
gets names of the facets in this object this method is used to produce error messages.
-
-