Class CompilationUnitContext

java.lang.Object
com.github.javaparser.symbolsolver.javaparsermodel.contexts.AbstractJavaParserContext<CompilationUnit>
com.github.javaparser.symbolsolver.javaparsermodel.contexts.CompilationUnitContext
All Implemented Interfaces:
Context

public class CompilationUnitContext extends AbstractJavaParserContext<CompilationUnit>
  • Field Details

  • Constructor Details

  • Method Details

    • solveSymbol

      public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name)
      Description copied from interface: Context
      Used where a symbol is being used (e.g. solving x when used as an argument doubleThis(x), or calculation return x * 2;).
      Parameters:
      name - the variable / reference / identifier used.
      Returns:
      // FIXME: Better documentation on how this is different to solveSymbolAsValue()
    • isAlreadyResolved

      private boolean isAlreadyResolved(String qName)
    • solveType

      public SymbolReference<ResolvedTypeDeclaration> solveType(String name, List<ResolvedType> typeArguments)
      Description copied from interface: Context
      Method used to solve a name with an expected list of type arguments.
      This method differs from Context.solveType(String) by taking the type arguments in consideration. For example, lets imagine that we have a project containing the following classes:
      • com/example/Alpha.java
      • com/example/Beta.java
      Where Alpha creates a inner interface called CustomInterface and Beta implements Alpha.CustomInterface and also declares a inner interface called CustomInterface with type arguments. Using this method we can specify which type arguments we are expecting and will be resolved with the type matching that declaration.
      Parameters:
      name - The name to be solved.
      typeArguments - The list of expected type arguments.
      Returns:
      The declaration associated with the given type name.
    • isCompositeName

      protected boolean isCompositeName(String name)
    • solveTypeFromOuterMostRef

      private SymbolReference<ResolvedTypeDeclaration> solveTypeFromOuterMostRef(String name)
    • solveExternalTypeFromOuterMostRef

      private SymbolReference<ResolvedTypeDeclaration> solveExternalTypeFromOuterMostRef(String name)
    • qName

      private String qName(ClassOrInterfaceType type)
    • qName

      private String qName(Name name)
    • toSimpleName

      private String toSimpleName(String qName)
    • packageName

      private String packageName(String qName)
    • solveMethod

      public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly)
      Description copied from interface: Context
      We find the method declaration which is the best match for the given name and list of typeParametersValues.
    • fieldsExposedToChild

      public List<ResolvedFieldDeclaration> fieldsExposedToChild(Node child)
      Description copied from interface: Context
      The fields that are declared and in this immediate context made visible to a given child. This list could include values which are shadowed.
    • getType

      private String getType(String qName)
    • getMember

      private String getMember(String qName)