schema2template.model
Class MSVExpressionInformation

java.lang.Object
  extended by schema2template.model.MSVExpressionInformation

public class MSVExpressionInformation
extends Object

Gather information from one MSV expression like:


Constructor Summary
MSVExpressionInformation(com.sun.msv.grammar.Expression exp)
           
 
Method Summary
 boolean canHaveText()
          Can the MSV expression have text content?
 Set<com.sun.msv.grammar.Expression> getMultiples()
          Returns all child elements which are no singletons
 List<List<com.sun.msv.grammar.Expression>> getPathsContaining(com.sun.msv.grammar.Expression exp)
          Gets all paths leading from this.getExpression() to exp (but not necessarily ending in exp).
 Set<com.sun.msv.grammar.Expression> getSingletons()
          Returns all singleton child elements
 boolean isMandatory(Collection<com.sun.msv.grammar.Expression> equallyNamedChildren)
          Determines whether an Element or Attribute child is mandatory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MSVExpressionInformation

public MSVExpressionInformation(com.sun.msv.grammar.Expression exp)
Method Detail

getSingletons

public Set<com.sun.msv.grammar.Expression> getSingletons()
Returns all singleton child elements

Returns:
All child elements which can only occur one time

getMultiples

public Set<com.sun.msv.grammar.Expression> getMultiples()
Returns all child elements which are no singletons

Returns:
All child elements which can only occur one time

getPathsContaining

public List<List<com.sun.msv.grammar.Expression>> getPathsContaining(com.sun.msv.grammar.Expression exp)
Gets all paths leading from this.getExpression() to exp (but not necessarily ending in exp). A path always starts with this.getExpression() and ends in someChildDefinition.getExpression().

Parameters:
exp - The MSV Expression. If you use this.getExpression() you get all paths starting from this.getExpression(). If you use someChildDefinition.getExpression() you get all paths from this.getExpression() to the Expression of the Child Definition.
Returns:
A List of paths containing exp or null if there are no such paths

canHaveText

public boolean canHaveText()
Can the MSV expression have text content?

Returns:
true if the node defined by this can have text content

isMandatory

public boolean isMandatory(Collection<com.sun.msv.grammar.Expression> equallyNamedChildren)
Determines whether an Element or Attribute child is mandatory.

If there are multiples of child (other equally named expressions) providing only one of those Expressions will determine whether exactly this expression is mandatory. In most cases this will return false, and in most cases this is not what you want to know. Therefore you can provide a Collection of (equally named) child expressions.

Returns:
whether child is mandatory


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.