sk.uniba.euromath.document.schema.impl.export
Class AttributeRuleImpl

java.lang.Object
  extended by sk.uniba.euromath.document.schema.impl.export.AttributeRuleImpl
All Implemented Interfaces:
IQNameAcceptor, IAttributeRuleP, IBaseRuleP, IForeignNodeP, ISingleQNameP, IValueRule

public final class AttributeRuleImpl
extends Object
implements IAttributeRuleP

Implements the AttributeRule interface. Because instances are pooled in RulePool, Object's equals and hashCode works fine.

Author:
Martin Vysny

Method Summary
 boolean accepts(String namespaceURI, String localName)
           Check whether the acceptor accepts given pair.
 boolean acceptsForeign()
          Checks whether this rule can generate attributes from foreign namespace.
 boolean acceptsNamespace(String namespaceURI)
          Checks if the namelist accepts/contains at least one qname from given namespace.
 boolean acceptsSomething()
          Checks, whether this value rule accepts any non-empty string.
 boolean acceptsValue(String value)
          Checks whether this textual rule can contain given value.
 boolean equals(Object obj)
           
 EnumSet<AcceptsEnum> getAccepts()
          Returns type of qnames, that this rule accepts.
 String getDatatypeName()
          Returns human-readable name for the datatype, that is represented by this instance.
 String getErrorMessage(String value)
          Compose and return an error message, why given value was not accepted.
 Set<String> getNamespaces()
          Tries to obtain a list of namespaces of qnames that are contained in this name list.
 String getNamespaceUri()
          Returns base namespace (the namespace of local elements).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

accepts

public boolean accepts(String namespaceURI,
                       String localName)
Description copied from interface: IQNameAcceptor

Check whether the acceptor accepts given pair.

Specified by:
accepts in interface IQNameAcceptor
Parameters:
namespaceURI - the namespace part of the qname. Acceptor must take both empty-string and null values as a null namespace.

If the acceptor accepts the attribute qnames also, then local attributes should have null as their namespace, regardless of the value of getNamespaceUri() function.

localName - the local name part.
Returns:
true if it accepts given qname, false otherwise.

acceptsForeign

public boolean acceptsForeign()
Checks whether this rule can generate attributes from foreign namespace.

Returns:
true if this rule can generate attributes from foreign namespace.

acceptsValue

public boolean acceptsValue(String value)
Description copied from interface: IValueRule
Checks whether this textual rule can contain given value.

Specified by:
acceptsValue in interface IValueRule
Parameters:
value - value to check.
Returns:
true if the value is valid.

getDatatypeName

public String getDatatypeName()
Description copied from interface: IValueRule
Returns human-readable name for the datatype, that is represented by this instance.

Specified by:
getDatatypeName in interface IValueRule
Returns:
Short displayable name (and description, if necessary) of datatype.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

acceptsSomething

public boolean acceptsSomething()
Description copied from interface: IValueRule
Checks, whether this value rule accepts any non-empty string.

Specified by:
acceptsSomething in interface IValueRule
Returns:
true if this value rule accepts any non-empty string.

getErrorMessage

public String getErrorMessage(String value)
Description copied from interface: IValueRule
Compose and return an error message, why given value was not accepted.

Specified by:
getErrorMessage in interface IValueRule
Parameters:
value - the value
Returns:
error message, possibly suggesting correct value whenever possible. If no error message is available then return empty string. If the value is acceptable return null.

acceptsNamespace

public boolean acceptsNamespace(String namespaceURI)
Description copied from interface: IForeignNodeP
Checks if the namelist accepts/contains at least one qname from given namespace.

Specified by:
acceptsNamespace in interface IForeignNodeP
Parameters:
namespaceURI - the namespace to check.
Returns:
true if the namelist accepts at least one qname with given namespace.

getNamespaces

public Set<String> getNamespaces()
Description copied from interface: IForeignNodeP
Tries to obtain a list of namespaces of qnames that are contained in this name list. If the set cannot be computed (or it would be infinite) then return null.

Specified by:
getNamespaces in interface IForeignNodeP
Returns:
namespaces of items contained in the namelist, or null if it cannot be computed and/or represented. null namespace is represented as an empty string.

getAccepts

public EnumSet<AcceptsEnum> getAccepts()
Description copied from interface: IQNameAcceptor
Returns type of qnames, that this rule accepts. If the information is not known then the function should return EnumSet with both flags.

Specified by:
getAccepts in interface IQNameAcceptor
Returns:
one of ACCEPTS_* constants.

getNamespaceUri

public String getNamespaceUri()
Description copied from interface: IQNameAcceptor
Returns base namespace (the namespace of local elements).

Specified by:
getNamespaceUri in interface IQNameAcceptor
Returns:
base namespace of schema, that created this object.


Copyright © 2003-2006 null. All Rights Reserved.