com.saxonica.schema
Class SimpleComponentReference

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.SimpleComponentReference
All Implemented Interfaces:
ComponentReference, Serializable, SourceLocator
Direct Known Subclasses:
AttributeUse, Particle

public class SimpleComponentReference
extends SchemaStructure
implements ComponentReference

A reference to a named schema group within the content model of a complex type

See Also:
Serialized Form

Field Summary
protected  int nameCode
          The name of the SchemaComponent referenced
protected  int symbolSpace
          The symbol space representing the kind of schema component that is referenced
protected  SchemaComponent target
          The corresponding SchemaComponent.
 
Constructor Summary
protected SimpleComponentReference()
          Default constructor for use by subclasses
  SimpleComponentReference(int symbolSpace, int fingerprint, EnterpriseConfiguration config)
          Creates a new SimpleComponentReference definition
 
Method Summary
 int getFingerprint()
          Get the fingerprint of the target of this reference
 int getNameCode()
           
 int getSymbolSpace()
          Get the symbol space of the target of this reference
 SchemaComponent getTarget()
          Returns the schema component that this is a reference to
 boolean isResolved()
          Determine whether this reference has been resolved
 void setNameCode(int nameCode)
           
 void setTarget(SchemaComponent target)
          Set the target component
 void tryToResolve(SchemaCompiler compiler)
          Attempt to resolve this reference using the components defined in a given schema.
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.saxonica.schema.ComponentReference
getConfiguration
 
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
 

Field Detail

nameCode

protected int nameCode
The name of the SchemaComponent referenced


target

protected SchemaComponent target
The corresponding SchemaComponent. This is null until the reference has been resolved.


symbolSpace

protected int symbolSpace
The symbol space representing the kind of schema component that is referenced

Constructor Detail

SimpleComponentReference

protected SimpleComponentReference()
Default constructor for use by subclasses


SimpleComponentReference

public SimpleComponentReference(int symbolSpace,
                                int fingerprint,
                                EnterpriseConfiguration config)
Creates a new SimpleComponentReference definition

Parameters:
symbolSpace - the symbol space for the component reference, for example elements, attributes, or types
fingerprint - the name pool fingerprint of the component name
config - the configuration to which this component belongs
Method Detail

isResolved

public boolean isResolved()
Determine whether this reference has been resolved

Specified by:
isResolved in interface ComponentReference
Returns:
true if the reference has been resolved to a schema component

setNameCode

public void setNameCode(int nameCode)

getFingerprint

public int getFingerprint()
Description copied from interface: ComponentReference
Get the fingerprint of the target of this reference

Specified by:
getFingerprint in interface ComponentReference
Returns:
the integer fingerprint of the component name

getNameCode

public int getNameCode()

getSymbolSpace

public int getSymbolSpace()
Get the symbol space of the target of this reference

Specified by:
getSymbolSpace in interface ComponentReference
Returns:
an integer code identifying the symbol space

getTarget

public SchemaComponent getTarget()
                          throws UnresolvedReferenceException
Returns the schema component that this is a reference to

Specified by:
getTarget in interface ComponentReference
Returns:
the schema component if the reference has been resolved.
Throws:
UnresolvedReferenceException - if the reference has not been resolved. Note that this is an unchecked exception.

setTarget

public void setTarget(SchemaComponent target)
Set the target component

Parameters:
target - the component that this reference points to

tryToResolve

public void tryToResolve(SchemaCompiler compiler)
Attempt to resolve this reference using the components defined in a given schema. No error results if the reference cannot be resolved.

Specified by:
tryToResolve in interface ComponentReference
Parameters:
compiler - The compiler being used to compile the referring component. This is assumed to know about the schema containing the candidate target components for the reference. If null, the schema containing the reference is used.


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.