org.eclipse.xsd.impl
Class XSDSimpleTypeDefinitionImpl.AssessmentImpl

java.lang.Object
  extended by org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl.AssessmentImpl
All Implemented Interfaces:
XSDSimpleTypeDefinition.Assessment
Enclosing class:
XSDSimpleTypeDefinitionImpl

public static class XSDSimpleTypeDefinitionImpl.AssessmentImpl
extends java.lang.Object
implements XSDSimpleTypeDefinition.Assessment

This is used to gather selectively the information determined when assessing a literal string with respect to a XSDSimpleTypeDefinition. It is intended to be very light-weight and flexible. You may begin assessment with a node, which handles three cases: if the node is an attribute, it's value is used to determine the literal; if the node is a text node, it's value is used to determine the literal; if the node is an element, it's (one and only) child text node is used to determine the literal in the preceeding case. You may begin assessment with a literal by not setting a node. And you may begin assessment with a normalizedLiteral by setting neither the node nor the literal. Unless additional yield flags are set, assessment will perform but one function: it will set the diagnostics to Collections.EMPTY_LIST when the literal fails to assess as valid. Hence, this most-light-weight invocation will only determine validity. You may choose for assessment to yield additional results, i.e., the value, the canonicalLiteral, and the diagnostics, using the flags YIELD_VALUE, YIELD_CANONICAL_LITERAL, YIELD_DIAGNOSTICS.


Field Summary
 java.util.Collection<XSDSimpleTypeDefinition.Assessment> assessments
          This records any nested assessments that were performed.
 java.lang.String canonicalLiteral
          This is the canonical literal representation of the literal.
 org.w3c.dom.Element context
          This is the context in which the prefix of QNames are resolved.
 java.util.Collection<XSDDiagnostic> diagnostics
          These are the diagnostics that are collected.
 java.lang.String literal
          This is the literal that is being assessed.
 org.w3c.dom.Node node
          This is the node whose literal is being assessed.
 java.lang.String normalizedLiteral
          This is the normalized value of the literal being assessed.
 java.lang.Object value
          This is the value of the normalized literal in the Java representation of the value space.
 XSDAnySimpleType xsdAnySimpleType
          This is the simple type definition doing the assessment for an atomic type.
 XSDSimpleTypeDefinitionImpl xsdSimpleTypeDefinition
          This is the simple type definition doing the assessment.
 int yield
          This determines the results that will be yielded during assessment.
static int YIELD_CANONICAL_LITERAL
           
static int YIELD_DIAGNOSTICS
           
static int YIELD_VALUE
           
 
Constructor Summary
XSDSimpleTypeDefinitionImpl.AssessmentImpl()
          This creates an empty instance; minimally, the node or literal would need to be set before using this.
XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Element context, org.w3c.dom.Node node, int yield)
          This creates an instance to assess the given node and to yield the specified results.
XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Element context, java.lang.String literal, int yield)
          This creates an instance to assess the given literal and to yield the specified results.
XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Node node, int yield)
          This creates an instance to assess the given node and to yield the specified results.
XSDSimpleTypeDefinitionImpl.AssessmentImpl(java.lang.String literal, int yield)
          This creates an instance to assess the given literal and to yield the specified results.
 
Method Summary
 void assignDiagnostics(XSDConcreteComponent xsdConcreteComponent, org.w3c.dom.Element element, java.lang.String attributeName)
           
protected  java.lang.Object[] createSubstitutions(int length)
           
 void format(java.lang.String noun, java.lang.String name)
          Called with a noun and a proper noun to perform substitution on the diagnostic messages, e.g., format("employee", "John Doe").
protected  void getAllDiagnostics(java.util.Collection<XSDDiagnostic> result)
           
 java.util.Collection<XSDSimpleTypeDefinition.Assessment> getAssessments()
          Returns any nested assessments that were performed.
 java.lang.String getCanonicalLiteral()
          Returns the canonical literal representation of the assessed value.
 org.w3c.dom.Element getContext()
          Returns the element used as the context for this assessment; this is significant only for interpretting the prefix of QNames.
 java.util.Collection<XSDDiagnostic> getDiagnostics()
          Returns the diagnostics collected for this particular assessment and for any nested assessments.
 java.lang.String getLiteral()
          Returns the literal that is assessed.
 java.util.Collection<XSDDiagnostic> getLocalDiagnostics()
          Returns the diagnostics that are collected for just this particular assessment.
 XSDSimpleTypeDefinition getMemberTypeDefinition()
           
 org.w3c.dom.Node getNode()
          Returns the node whose literal value is assessed.
 java.lang.String getNormalizedLiteral()
          Returns the normalized value of the literal that is assessed.
 XSDSimpleTypeDefinition getTypeDefinition()
          Returns the type definition against which the literal is assessed.
 java.lang.Object getValue()
          Return the value of the normalized literal in the Java representation of the value space.
 void reportDatatypeDiagnostic()
           
protected static java.lang.String requote(java.lang.String message)
           
 void validate(XSDConstrainingFacet xsdConstrainingFacet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YIELD_VALUE

public static final int YIELD_VALUE
See Also:
Constant Field Values

YIELD_CANONICAL_LITERAL

public static final int YIELD_CANONICAL_LITERAL
See Also:
Constant Field Values

YIELD_DIAGNOSTICS

public static final int YIELD_DIAGNOSTICS
See Also:
Constant Field Values

xsdSimpleTypeDefinition

public XSDSimpleTypeDefinitionImpl xsdSimpleTypeDefinition
This is the simple type definition doing the assessment.


xsdAnySimpleType

public XSDAnySimpleType xsdAnySimpleType
This is the simple type definition doing the assessment for an atomic type.


context

public org.w3c.dom.Element context
This is the context in which the prefix of QNames are resolved.


node

public org.w3c.dom.Node node
This is the node whose literal is being assessed.


literal

public java.lang.String literal
This is the literal that is being assessed.


normalizedLiteral

public java.lang.String normalizedLiteral
This is the normalized value of the literal being assessed.


yield

public int yield
This determines the results that will be yielded during assessment.


value

public java.lang.Object value
This is the value of the normalized literal in the Java representation of the value space.


canonicalLiteral

public java.lang.String canonicalLiteral
This is the canonical literal representation of the literal.


diagnostics

public java.util.Collection<XSDDiagnostic> diagnostics
These are the diagnostics that are collected.


assessments

public java.util.Collection<XSDSimpleTypeDefinition.Assessment> assessments
This records any nested assessments that were performed.

Constructor Detail

XSDSimpleTypeDefinitionImpl.AssessmentImpl

public XSDSimpleTypeDefinitionImpl.AssessmentImpl()
This creates an empty instance; minimally, the node or literal would need to be set before using this.


XSDSimpleTypeDefinitionImpl.AssessmentImpl

public XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Node node,
                                                  int yield)
This creates an instance to assess the given node and to yield the specified results.


XSDSimpleTypeDefinitionImpl.AssessmentImpl

public XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Element context,
                                                  org.w3c.dom.Node node,
                                                  int yield)
This creates an instance to assess the given node and to yield the specified results.


XSDSimpleTypeDefinitionImpl.AssessmentImpl

public XSDSimpleTypeDefinitionImpl.AssessmentImpl(java.lang.String literal,
                                                  int yield)
This creates an instance to assess the given literal and to yield the specified results.


XSDSimpleTypeDefinitionImpl.AssessmentImpl

public XSDSimpleTypeDefinitionImpl.AssessmentImpl(org.w3c.dom.Element context,
                                                  java.lang.String literal,
                                                  int yield)
This creates an instance to assess the given literal and to yield the specified results.

Method Detail

getTypeDefinition

public XSDSimpleTypeDefinition getTypeDefinition()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the type definition against which the literal is assessed.

Specified by:
getTypeDefinition in interface XSDSimpleTypeDefinition.Assessment
Returns:
the type definition against which the literal is assessed.

getContext

public org.w3c.dom.Element getContext()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the element used as the context for this assessment; this is significant only for interpretting the prefix of QNames.

Specified by:
getContext in interface XSDSimpleTypeDefinition.Assessment
Returns:
the element used as the context for this assessment.

getNode

public org.w3c.dom.Node getNode()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the node whose literal value is assessed.

Specified by:
getNode in interface XSDSimpleTypeDefinition.Assessment
Returns:
the node whose literal value is assessed.

getLiteral

public java.lang.String getLiteral()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the literal that is assessed.

Specified by:
getLiteral in interface XSDSimpleTypeDefinition.Assessment
Returns:
the literal that is assessed.

getNormalizedLiteral

public java.lang.String getNormalizedLiteral()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the normalized value of the literal that is assessed.

Specified by:
getNormalizedLiteral in interface XSDSimpleTypeDefinition.Assessment
Returns:
the normalized value of the literal that is assessed.

getValue

public java.lang.Object getValue()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Return the value of the normalized literal in the Java representation of the value space.

Specified by:
getValue in interface XSDSimpleTypeDefinition.Assessment
Returns:
the value of the normalized literal.

getCanonicalLiteral

public java.lang.String getCanonicalLiteral()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the canonical literal representation of the assessed value.

Specified by:
getCanonicalLiteral in interface XSDSimpleTypeDefinition.Assessment
Returns:
the canonical literal representation of the assessed value.

getMemberTypeDefinition

public XSDSimpleTypeDefinition getMemberTypeDefinition()

getLocalDiagnostics

public java.util.Collection<XSDDiagnostic> getLocalDiagnostics()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the diagnostics that are collected for just this particular assessment.

Specified by:
getLocalDiagnostics in interface XSDSimpleTypeDefinition.Assessment
Returns:
the diagnostics that are collected for just this particular assessment.

getAssessments

public java.util.Collection<XSDSimpleTypeDefinition.Assessment> getAssessments()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns any nested assessments that were performed. In the case of a union, there will be an assessment for the member type definition that was chosen to assess the literal. In the case of a list, there will be an assessment for every item in the list.

Specified by:
getAssessments in interface XSDSimpleTypeDefinition.Assessment
Returns:
any nested assessments that were performed.

getDiagnostics

public java.util.Collection<XSDDiagnostic> getDiagnostics()
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Returns the diagnostics collected for this particular assessment and for any nested assessments.

Specified by:
getDiagnostics in interface XSDSimpleTypeDefinition.Assessment
Returns:
the diagnostics collected for this particular assessment and for any nested assessments.

getAllDiagnostics

protected void getAllDiagnostics(java.util.Collection<XSDDiagnostic> result)

format

public void format(java.lang.String noun,
                   java.lang.String name)
Description copied from interface: XSDSimpleTypeDefinition.Assessment
Called with a noun and a proper noun to perform substitution on the diagnostic messages, e.g., format("employee", "John Doe"). If an element or attribute was originally specified, the word "element" or "attribute" and the URI of the element or attribute will already have been substituted.

Specified by:
format in interface XSDSimpleTypeDefinition.Assessment
Parameters:
noun - a noun.
name - a proper noun.

assignDiagnostics

public void assignDiagnostics(XSDConcreteComponent xsdConcreteComponent,
                              org.w3c.dom.Element element,
                              java.lang.String attributeName)

validate

public void validate(XSDConstrainingFacet xsdConstrainingFacet)

createSubstitutions

protected java.lang.Object[] createSubstitutions(int length)

requote

protected static java.lang.String requote(java.lang.String message)

reportDatatypeDiagnostic

public void reportDatatypeDiagnostic()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.