org.eclipse.xtext.generator.grammarAccess
Class GrammarAccess

java.lang.Object
  extended by org.eclipse.xtext.generator.grammarAccess.GrammarAccess

public class GrammarAccess
extends java.lang.Object

This API can be used by other templates to generate code that has hard references to grammar rules/elements

Author:
Moritz Eysholdt

Constructor Summary
GrammarAccess()
           
 
Method Summary
 java.lang.String gaAccessor(org.eclipse.emf.ecore.EObject ele)
          Returns the invokation of an element or rule accessor.
 java.lang.String gaElementAccessMethodeName(AbstractElement element)
          Returns the method name for accessing an element via a GrammarAccess implementation.
 java.lang.String gaElementAccessor(AbstractElement ele)
          Returns the invokation of the element accessor method as Java statement.
 java.lang.String gaElementIdentifyer(AbstractElement element)
          Creates an identifier for an AbstractElement which is a valid Java identifier and which is unique whithin the element's rule.
 java.lang.String gaElementsAccessor(AbstractRule rule)
          Returns the invokation of the rule's content accessor method as Java statement.
 java.lang.String gaFQName(Grammar grammar)
          Returns the full qulified Java class name of a GrammarAccess implementation for a grammar.
 java.lang.String gaFullAccessor(AbstractElement ele)
          Returns the invokation of the element accessor method as full qualified Java statement.
 java.lang.String gaRuleAccesorClassName(AbstractRule rule)
          Returns the simple class name of a rule's facade.
 java.lang.String gaRuleAccessMethodName(AbstractRule rule)
          Returns the method name for accessing a rule via a GrammarAccess implementation.
 java.lang.String gaRuleAccessor(AbstractRule rule)
          Returns the invokation of the rule accessor method as Java statement.
 java.lang.String gaRuleElementAccessor(AbstractElement ele)
          Returns the invokation of the element accessor method for a GrammarAccess as Java statement.
 java.lang.String gaRuleElementsMethodName(AbstractRule rule)
          Returns the method name for accessing a rule's content via a ParseRuleAccess implementation.
 java.lang.String gaRuleIdentifyer(AbstractRule rule)
          Creates an identifier for a Rule which is a valid Java idetifier and unique within the Rule's grammar.
 java.lang.String gaSimpleName(Grammar grammar)
          Returns the simple Java class name of a GrammarAccess implementation for a Grammar.
 java.lang.String gaTypeAccessor(TypeRef ele)
          Returns the invokation of an element or rule accessor, including the .getType() call.
 java.lang.String grammarFragmentToStr(org.eclipse.emf.ecore.EObject ele, java.lang.String prefix)
           
 java.lang.String toJavaIdentifier(java.lang.String text, boolean uppercaseFirst)
          Converts an arbitary string to a valid Java identifier The string is being split up along the the caracters that are not valid as java identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarAccess

public GrammarAccess()
Method Detail

gaFullAccessor

public java.lang.String gaFullAccessor(AbstractElement ele)
Returns the invokation of the element accessor method as full qualified Java statement. Example: return FowlerDslTestLanguageGrammarAccess.INSTANCE.prStatemachine().ele1AssignmentStates()

Parameters:
ele - the element
Returns:
The java statement

toJavaIdentifier

public java.lang.String toJavaIdentifier(java.lang.String text,
                                         boolean uppercaseFirst)
Converts an arbitary string to a valid Java identifier The string is being split up along the the caracters that are not valid as java identifier. The first character of each segments is made upper case which leads to a camel-case style.

Parameters:
text - the string
uppercaseFirst - whether the first character of the returned identifier should be uppercase or lowercase
Returns:
the java identifier

gaRuleIdentifyer

public java.lang.String gaRuleIdentifyer(AbstractRule rule)
Creates an identifier for a Rule which is a valid Java idetifier and unique within the Rule's grammar.

Parameters:
rule - the Rule
Returns:
the identifier

gaElementIdentifyer

public java.lang.String gaElementIdentifyer(AbstractElement element)
Creates an identifier for an AbstractElement which is a valid Java identifier and which is unique whithin the element's rule. The identifier tries to be as human-readable as possible.

Parameters:
element - the element
Returns:
the element's identifier

gaFQName

public java.lang.String gaFQName(Grammar grammar)
Returns the full qulified Java class name of a GrammarAccess implementation for a grammar.

Parameters:
grammar -
Returns:
the GrammarAccess' full qualified Java class name

gaSimpleName

public java.lang.String gaSimpleName(Grammar grammar)
Returns the simple Java class name of a GrammarAccess implementation for a Grammar. The simple class name is defined as the class' name without any package names.

Parameters:
grammar - the grammar
Returns:
the GrammarAccess' simple class name

gaRuleAccessMethodName

public java.lang.String gaRuleAccessMethodName(AbstractRule rule)
Returns the method name for accessing a rule via a GrammarAccess implementation.

Parameters:
rule - the rule for which the accessor method is needed
Returns:
the method's name.

gaRuleElementsMethodName

public java.lang.String gaRuleElementsMethodName(AbstractRule rule)
Returns the method name for accessing a rule's content via a ParseRuleAccess implementation.

Parameters:
rule - the rule for which the accessor method is needed
Returns:
the method's name.

gaElementAccessMethodeName

public java.lang.String gaElementAccessMethodeName(AbstractElement element)
Returns the method name for accessing an element via a GrammarAccess implementation.

Parameters:
element - the element for which the accesor method is needed
Returns:
the method's name.

gaRuleAccesorClassName

public java.lang.String gaRuleAccesorClassName(AbstractRule rule)
Returns the simple class name of a rule's facade. A GrammarAccess implementation has a facade for each parser rule, which contains the methods for accessing the rule's elements.

Parameters:
rule -
Returns:
the simple class name

gaRuleAccessor

public java.lang.String gaRuleAccessor(AbstractRule rule)
Returns the invokation of the rule accessor method as Java statement.

Parameters:
rule - the rule
Returns:
The java statement

gaElementsAccessor

public java.lang.String gaElementsAccessor(AbstractRule rule)
Returns the invokation of the rule's content accessor method as Java statement.

Parameters:
rule - the rule
Returns:
The java statement

gaElementAccessor

public java.lang.String gaElementAccessor(AbstractElement ele)
Returns the invokation of the element accessor method as Java statement. The called method is implemented by the rule's facade. Example: ele1AssignmentStates()

Parameters:
ele - the element
Returns:
The java statement

gaRuleElementAccessor

public java.lang.String gaRuleElementAccessor(AbstractElement ele)
Returns the invokation of the element accessor method for a GrammarAccess as Java statement. Example: prStatemachine().ele1AssignmentStates()

Parameters:
ele - the element
Returns:
The java statement

gaTypeAccessor

public java.lang.String gaTypeAccessor(TypeRef ele)
Returns the invokation of an element or rule accessor, including the .getType() call. Example1: getFooRule().getType() Example2: getBarRule().getFooAction().getType()


gaAccessor

public java.lang.String gaAccessor(org.eclipse.emf.ecore.EObject ele)
Returns the invokation of an element or rule accessor. Example1: getFooRule() Example2: getBarRule().getFooAction()


grammarFragmentToStr

public java.lang.String grammarFragmentToStr(org.eclipse.emf.ecore.EObject ele,
                                             java.lang.String prefix)