public class XMLGrammarPoolImpl extends Object implements XMLGrammarPool
Modifier and Type | Class and Description |
---|---|
protected static class |
XMLGrammarPoolImpl.Entry
This class is a grammar pool entry.
|
Modifier and Type | Field and Description |
---|---|
protected int |
fGrammarCount |
protected XMLGrammarPoolImpl.Entry[] |
fGrammars
Grammars.
|
protected boolean |
fPoolIsLocked |
protected static int |
TABLE_SIZE
Default size.
|
Constructor and Description |
---|
XMLGrammarPoolImpl()
Constructs a grammar pool with a default number of buckets.
|
XMLGrammarPoolImpl(int initialCapacity)
Constructs a grammar pool with a specified number of buckets.
|
Modifier and Type | Method and Description |
---|---|
void |
cacheGrammars(String grammarType,
Grammar[] grammars)
return the final set of grammars that the validator ended up
with.
|
void |
clear()
Removes all grammars from the pool.
|
boolean |
containsGrammar(XMLGrammarDescription desc)
Returns true if the grammar pool contains a grammar associated
to the specified grammar description.
|
boolean |
equals(XMLGrammarDescription desc1,
XMLGrammarDescription desc2)
This method checks whether two grammars are the same.
|
Grammar |
getGrammar(XMLGrammarDescription desc)
Returns the grammar associated to the specified grammar description.
|
int |
hashCode(XMLGrammarDescription desc)
Returns the hash code value for the given grammar description.
|
void |
lockPool()
Causes the XMLGrammarPool not to store any grammars when
the cacheGrammars(String, Grammar[[]) method is called.
|
void |
putGrammar(Grammar grammar)
Puts the specified grammar into the grammar pool and associates it to
its root element name or its target namespace.
|
Grammar |
removeGrammar(XMLGrammarDescription desc)
Removes the grammar associated to the specified grammar description from the
grammar pool and returns the removed grammar.
|
Grammar |
retrieveGrammar(XMLGrammarDescription desc)
This method requests that the application retrieve a grammar
corresponding to the given GrammarIdentifier from its cache.
|
Grammar[] |
retrieveInitialGrammarSet(String grammarType)
retrieve the initial known set of grammars.
|
void |
unlockPool()
Allows the XMLGrammarPool to store grammars when its cacheGrammars(String, Grammar[])
method is called.
|
protected static final int TABLE_SIZE
protected XMLGrammarPoolImpl.Entry[] fGrammars
protected boolean fPoolIsLocked
protected int fGrammarCount
public XMLGrammarPoolImpl()
public XMLGrammarPoolImpl(int initialCapacity)
public Grammar[] retrieveInitialGrammarSet(String grammarType)
XMLGrammarPool
retrieve the initial known set of grammars. this method is called by a validator before the validation starts. the application can provide an initial set of grammars available to the current validation attempt.
retrieveInitialGrammarSet
in interface XMLGrammarPool
grammarType
- the type of the grammar, from the
org.apache.xerces.xni.grammars.Grammar
interface.public void cacheGrammars(String grammarType, Grammar[] grammars)
XMLGrammarPool
return the final set of grammars that the validator ended up with. This method is called after the validation finishes. The application may then choose to cache some of the returned grammars.
cacheGrammars
in interface XMLGrammarPool
grammarType
- the type of the grammars being returned;grammars
- an array containing the set of grammars being
returned; order is not significant.public Grammar retrieveGrammar(XMLGrammarDescription desc)
XMLGrammarPool
This method requests that the application retrieve a grammar corresponding to the given GrammarIdentifier from its cache. If it cannot do so it must return null; the parser will then call the EntityResolver. An application must not call its EntityResolver itself from this method; this may result in infinite recursions.
retrieveGrammar
in interface XMLGrammarPool
desc
- The description of the Grammar being requested.public void putGrammar(Grammar grammar)
grammar
- The Grammar.public Grammar getGrammar(XMLGrammarDescription desc)
desc
- The Grammar Description.public Grammar removeGrammar(XMLGrammarDescription desc)
desc
- The Grammar Description.public boolean containsGrammar(XMLGrammarDescription desc)
desc
- The Grammar Description.public void lockPool()
XMLGrammarPool
lockPool
in interface XMLGrammarPool
public void unlockPool()
XMLGrammarPool
unlockPool
in interface XMLGrammarPool
public void clear()
XMLGrammarPool
clear
in interface XMLGrammarPool
public boolean equals(XMLGrammarDescription desc1, XMLGrammarDescription desc2)
desc1
- The grammar descriptiondesc2
- The grammar description of the grammar to be compared topublic int hashCode(XMLGrammarDescription desc)
desc
- The grammar descriptionCopyright © 2021 JBoss by Red Hat. All rights reserved.