public class TypeIncubator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
TypeIncubator.FacetInfo |
Modifier and Type | Field and Description |
---|---|
private XSDatatypeImpl |
baseType
base type
|
private static java.lang.String[][] |
exclusiveFacetPairs |
private java.util.Map |
impl
storage for non-repeatable facets
|
Constructor and Description |
---|
TypeIncubator(XSDatatype baseType) |
Modifier and Type | Method and 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 consistent
|
private boolean |
contains(java.lang.String facetName)
checks if the specified facet was added to this map
|
XSDatatypeImpl |
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 added
|
boolean |
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.
|
private final java.util.Map impl
private final XSDatatypeImpl baseType
private static final java.lang.String[][] exclusiveFacetPairs
public TypeIncubator(XSDatatype baseType)
public void add(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
public void addFacet(java.lang.String name, java.lang.String strValue, boolean fixed, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
- when given facet is already specifiedpublic XSDatatypeImpl derive(java.lang.String newName) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
public XSDatatypeImpl derive(java.lang.String newNameUri, java.lang.String newLocalName) throws org.relaxng.datatype.DatatypeException
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.private static void checkRangeConsistency(XSDatatypeImpl newType, java.lang.String facetName1, java.lang.String facetName2) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
- when two facets are inconsistentprivate static org.relaxng.datatype.DatatypeException reportFacetInconsistency(java.lang.String newName, DataTypeWithFacet o1, java.lang.String facetName1, DataTypeWithFacet o2, java.lang.String facetName2)
private static boolean isValueFacet(java.lang.String facetName)
private static boolean isRepeatable(java.lang.String facetName)
public boolean isFixed(java.lang.String facetName)
public java.lang.Object getFacet(java.lang.String facetName)
public java.util.Vector getVector(java.lang.String facetName)
public int getPositiveInteger(java.lang.String facetName) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
- if the parameter cannot be parsed as a positive integerpublic int getNonNegativeInteger(java.lang.String facetName) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
- if the parameter cannot be parsed as a non-negative integerprivate boolean contains(java.lang.String facetName)
public boolean isEmpty()
public void dump(java.io.PrintStream out)
public java.lang.String getFacetNames()