org.apache.ws.commons.schema.walker
Class XmlSchemaRestriction

java.lang.Object
  extended by org.apache.ws.commons.schema.walker.XmlSchemaRestriction

public class XmlSchemaRestriction
extends Object

This represents an XmlSchemaFacet. It uses an enum to more easily work with different facets, and its equals(Object) and hashCode() reflect that only enumerations and patterns can have multiple constraints.


Nested Class Summary
static class XmlSchemaRestriction.Type
          The facet type: one of the known constraining facets defined by XML Schema.
 
Constructor Summary
XmlSchemaRestriction(XmlSchemaRestriction.Type type)
          Constructs a new XmlSchemaRestriction from only the XmlSchemaRestriction.Type.
XmlSchemaRestriction(XmlSchemaRestriction.Type type, Object value, boolean isFixed)
          Constructs a new XmlSchemaRestriction from the XmlSchemaRestriction.Type, constraining value, and whether the facet may be overridden by child type definitions.
 
Method Summary
 boolean equals(Object obj)
          Determines equality.
 XmlSchemaRestriction.Type getType()
          The constraining facet's XmlSchemaRestriction.Type.
 Object getValue()
          The facet's constraint value.
 int hashCode()
          Generates a hash code based on the contents.
 boolean isFixed()
          Whether the constraint value may be overridden in child definitions ( true means it cannot).
 void setFixed(boolean isFixed)
          Sets whether the constraint value may be overridden in child definitions (true means that it cannot).
 void setValue(Object value)
          Sets the constraint value.
 String toString()
          Returns a String representation of this facet.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlSchemaRestriction

public XmlSchemaRestriction(XmlSchemaRestriction.Type type)
Constructs a new XmlSchemaRestriction from only the XmlSchemaRestriction.Type.

Parameters:
type - The facet's type.

XmlSchemaRestriction

public XmlSchemaRestriction(XmlSchemaRestriction.Type type,
                            Object value,
                            boolean isFixed)
Constructs a new XmlSchemaRestriction from the XmlSchemaRestriction.Type, constraining value, and whether the facet may be overridden by child type definitions.

Parameters:
type - The constraining facet type.
value - The constraining value.
isFixed - Whether the value may be overridden in child definitions.
Method Detail

getType

public XmlSchemaRestriction.Type getType()
The constraining facet's XmlSchemaRestriction.Type.


getValue

public Object getValue()
The facet's constraint value.


isFixed

public boolean isFixed()
Whether the constraint value may be overridden in child definitions ( true means it cannot).


setValue

public void setValue(Object value)
Sets the constraint value.


setFixed

public void setFixed(boolean isFixed)
Sets whether the constraint value may be overridden in child definitions (true means that it cannot).


hashCode

public int hashCode()
Generates a hash code based on the contents. If the type is an enumeration, then the isFixed and value elements are used in calculating the hash code. All of the other Restrictions are considered to be the same.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Determines equality. If the type is an enumeration, then the isFixed and value elements are used determining equality. All of the other Restrictions are considered to be equal to each other.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
Returns a String representation of this facet.

Overrides:
toString in class Object


Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.