Top Description Fields Constructors Methods
com.sun.msv.grammar.xmlschema

public Class LaxDefaultNameClass

extends NameClass
Class Inheritance
Imports
java.util.Set, com.sun.msv.grammar.DifferenceNameClass, .NameClass, .NameClassVisitor, .SimpleNameClass, com.sun.msv.util.StringPair

Special name class implementation used for the wild card of the "lax" mode.

In "lax" mode, we need a name class that matches all undefined names. Although it is possible to use DifferenceNameClass for this purpose, it is not a cost-efficient way because typically it becomes very large. (If there are twenty element declarations, we'll need twenty DifferenceNameClass to exclude all defined names).

This name class uses a Set to hold multiple names. If a name is contained in that set, it'll be rejected. If a name is not contained, it'll be accepted.

Special care is taken to make this NC as seamless as possible. When the visit method is called, the equivalent name class is constructed internally and the visitor will visit that name class. In this way, the visitors won't notice the existance of this "special" name class.

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private NameClass
protected NameClass
equivalentNameClass

equivalent name class by conventional primitives.

private final Set<StringPair>
names

set of StringPairs.

private static final long
Inherited from com.sun.msv.grammar.NameClass:
ALLLOCALNAME_WILDCARDNAMESPACE_WILDCARDNONE

Constructor Summary

AccessConstructor and Description
public
LaxDefaultNameClass(NameClass
this name class accepts a name if
  1. it's in the 'base" name class and
  2. it's not one of those excluded names
_base
)

Method Summary

Modifier and TypeMethod and Description
public boolean
accepts(String
namespace URI to be tested. If this value equals to NAMESPACE_WILDCARD, implementation must assume that valid namespace is specified. this twist will be used for error diagnosis.
namespaceURI
,
String
local part to be tested. As with namespaceURI, LOCALNAME_WILDCARD will acts as a wild card.
localName
)

Implements abstract com.sun.msv.grammar.NameClass.accepts.

checks if this name class accepts given namespace:localName pair.
public void
addName(String namespaceURI, String localName)

add a name so that this name will be rejected by the accepts method.

public Object
visit(NameClassVisitor visitor)

Implements abstract com.sun.msv.grammar.NameClass.visit.

visitor pattern support
Inherited from com.sun.msv.grammar.NameClass:
acceptsincludesintersectionisEqualToisNullsimplifyunion

Field Detail

baseback to summary
private NameClass base
equivalentNameClassback to summary
protected NameClass equivalentNameClass

equivalent name class by conventional primitives. Initially null, and created on demand.

namesback to summary
private final Set<StringPair> names

set of StringPairs. each item represents one name. it also contains WILDCARD as entry.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.sun.msv.grammar.NameClass.serialVersionUID.

Constructor Detail

LaxDefaultNameClassback to summary
public LaxDefaultNameClass(NameClass _base)
Parameters
_base:NameClass

this name class accepts a name if

  1. it's in the 'base" name class and
  2. it's not one of those excluded names

Method Detail

acceptsback to summary
public boolean accepts(String namespaceURI, String localName)

Implements abstract com.sun.msv.grammar.NameClass.accepts.

Doc from com.sun.msv.grammar.NameClass.accepts.

checks if this name class accepts given namespace:localName pair.

Parameters
namespaceURI:String

namespace URI to be tested. If this value equals to NAMESPACE_WILDCARD, implementation must assume that valid namespace is specified. this twist will be used for error diagnosis.

localName:String

local part to be tested. As with namespaceURI, LOCALNAME_WILDCARD will acts as a wild card.

Returns:boolean

true if the pair is accepted, false otherwise.

addNameback to summary
public void addName(String namespaceURI, String localName)

add a name so that this name will be rejected by the accepts method.

visitback to summary
public Object visit(NameClassVisitor visitor)

Implements abstract com.sun.msv.grammar.NameClass.visit.

Doc from com.sun.msv.grammar.NameClass.visit.

visitor pattern support