## org.eclipse.emf.importer.java.builder
Class JavaEcoreBuilder

    java.lang.Object
      org.eclipse.emf.importer.java.builder.JavaEcoreBuilder

    public class JavaEcoreBuilder

extends java.lang.Object

Nested Class Summary
`protected static class` `JavaEcoreBuilder.RequiredClassifierType`

Field Summary
`protected BasicDiagnostic` `basicDiagnostic` A collection of the problems encountered during the processing.
`protected java.util.Set<EClassifier>` `demandCreatedEClassifiers` The set of classifiers that were demand created.
`protected static java.util.regex.Pattern` `eAnnotationDetailExpression`
`protected static java.util.regex.Pattern` `eAnnotationExpression`
`protected java.util.Set<EAttribute>` `eAttributes` The attributes that must be treated as attributes because the are explicitly declared to be of that kind.
`protected java.util.Map<EGenericType,EGenericType>` `ecoreEGenericTypeToJavaEGenericTypeMap` A map from a generic type to the possibly null generic type that represents its proper Java type.
`protected EcoreUtil.EGenericTypeConverter` `eGenericTypeConverter` The utility used to convert a generate type to a fully qualified Java instance type.
`protected java.util.Map<EModelElement,JNode>` `eModelElementToJNodeMap` The map from a model element to the corresponding JNode.
`protected java.util.Map<EPackage,java.util.Map<java.lang.Object,java.lang.Integer>>` `ePackageToOrderingMap` The map from package to the map of ordering constants.
`protected java.util.Map<EPackage,java.lang.String>` `ePackageToPrefixMap` The map from package to the it's prefix.
`protected java.util.Map<EReference,java.util.List<java.lang.String>>` `eReferenceToKeyNamesMap` The map from a reference to the names of its keys.
`protected java.util.Map<EReference,java.lang.String>` `eReferenceToOppositeNameMap` The map from a reference to the name of its opposite.
`protected java.util.Set<EStructuralFeature>` `eStructuralFeatures` The features handled during the traversal.
`protected static java.util.regex.Pattern` `extendsAnnotationExpression` The pattern for extracting the @extends annotations.
`protected java.util.Collection<GenModel>` `externalGenModels` All the external GenModels from all required projects.
`protected java.util.Map<java.lang.String,EPackage>` `externalPackageNameToEPackageMap` The map from a package name to the corresponding package.
`protected static FacadeHelper` `facadeHelper` The factory used to create JNodes.
`protected boolean` `foundJava` Set to true when a compilation unit is processed and hence indicates if anything to process has been found.
`protected GenModel` `genModel` The GenModel being generated.
`protected IFile` `genModelFile` The file being generated.
`protected static java.util.regex.Pattern` `implementsAnnotationExpression` The pattern for extracting the @implements annotations.
`protected static java.lang.String` `MAP_ENTRY_CLASS_CONTAINER_ANNOTATION_SOURCE`
`protected static java.util.regex.Pattern` `modelAnnotationExpression` The pattern for extracting the @model annotations.
`protected static java.util.regex.Pattern` `modelDocExpression` The pattern for extracting the model documentation.
`protected GenModel` `oldGenModelVersion` The old version to against which to reconcile.
`protected java.util.Map<java.lang.String,EPackage>` `packageNameToEPackageMap` The map from a package name to the corresponding package.
`protected java.util.Set<EReference>` `transientEReferenceWithOpposite` The set of references that have opposites and have been explicitly marked as being transient.
`protected java.util.Collection<GenPackage>` `usedGenPackages` All the used GenPackages.

Constructor Summary
`JavaEcoreBuilder(IFile genModelFile)` Creates a builder for the given file.
`JavaEcoreBuilder(IFile genModelFile, GenModel oldGenModelVersion)`
`JavaEcoreBuilder(IFile genModelFile, GenModel oldGenModelVersion, GenModel genModel)`

Method Summary
`protected void` `addToPackage(EPackage ePackage, EClassifier eClassifier)`
`protected void` `analyzeCompilationUnit(JCompilationUnit compilationUnit)` Walks the compilation unit to analyze the type.
`protected java.util.List<EGenericType>` `analyzeEGenericTypes(java.lang.String genericTypes)`
`protected void` `analyzeEnum(JEnum enumeration)`
`protected boolean` `analyzeEnumLiteral(EEnum eEnum, JMember member)` Creates EEnumLiteral as appropriate.
`protected void` `analyzeMethod(EClass eClass, JMethod method)` Creates an EOperation, EAttribute, or EReference as appropriate.
`protected ETypedElement` `analyzeMethod(EClass eClass, java.lang.String modelAnnotation, java.lang.String methodName, java.lang.String returnType, java.lang.String[] parameterNames, java.lang.String[] parameterTypes, java.lang.String[] exceptionTypes, java.lang.String[] typeParameters)`
`protected IPath` `analyzeProject(IProject project)`
`protected void` `analyzeType(JType type)` Walks the type either as an EClass or an ENum to analyze either the methods or the fields.
`void` `computeEPackages(Monitor monitor, ModelImporter modelImporter)`
`protected EStructuralFeature` `createFeature(EClass eClass, java.lang.String name, EGenericType eGenericType)`
`protected ResourceSet` `createResourceSet()`
`void` `determineExternalPackages(GenPackage genPackage)`
`protected void` `determineExternalPackages(GenPackage genPackage, ModelImporter modelImporter)`
`protected void` `error(java.lang.String message)` Produces another IStatus in the MultiStatus.
`protected java.util.List<EAnnotation>` `extractEAnnotations(java.lang.String modelAnnotation)`
`void` `getAllGenModelFiles(java.util.Collection<IFile> result, IContainer container)` Walks the container recursively.
`void` `getAllGenModelFiles(java.util.Collection<IFile> result, IFile file)` Walks the container recursively.
`void` `getAllReferencedProjects(java.util.Collection<IProject> result, IProject[] projects)` Walks the projects recursively.
`Diagnostic` `getDiagnostic()` Returns the diagnostic.
`protected EPackage` `getEPackage(JNode node)`
`protected java.lang.String` `getExtendsAnnotation(java.lang.String comment)` Returns the @extends/@implements annotation contents, or null.
`protected java.lang.String` `getFilteredModelAnnotations(java.lang.String modelAnnotation, java.lang.String filter)` Returns the filtered matches xyzAttribute-name="value" or of xyxAttribute-name='value', or null.
`GenModel` `getGenModel()` Returns the generator model.
`protected JCompilationUnit` `getJCompilationUnit(EModelElement eModelElement)`
`protected java.lang.String` `getModelAnnotation(java.lang.String comment)` Returns the @model annotation contents, or null.
`protected java.lang.String` `getModelAnnotationAttribute(java.lang.String modelAnnotation, java.lang.String attributeName)` Returns the unquoted value of attribute-name="value" or of attribute-name='value', or null.
`protected java.lang.String` `getModelAnnotationAttributes(java.lang.String modelAnnotation, java.lang.String attributeName)` Returns the space separated concatenation of the unquoted value of each attribute-name="value" or attribute-name='value' repeat, or null.
`protected java.lang.String` `getModelDocumentation(java.lang.String comment)` Returns the model documentation, or null.

`protected

`<T extends ENamedElement> T`

`

`getNamedElement(java.util.List<T> namedElements, java.lang.String name)`

`protected int` `getOrderingValue(ENamedElement eNamedElement, java.util.Map<java.lang.Object,java.lang.Integer> nameToIDMap)`
`java.util.Collection<GenPackage>` `getUsedGenPackages()` Returns the list of used GenPackages.
`protected void` `handleETypedElement(ETypedElement eTypedElement, java.lang.String name, java.lang.String type, java.lang.String modelAnnotation, java.lang.String identifierName)`
`protected boolean` `isListType(java.lang.String type)`
`protected boolean` `isMapType(java.lang.String type)`
`protected void` `match(java.util.List<EGenericType> target, java.util.List<EGenericType> javaEGenericTypes, java.util.List<EGenericType> ecoreEGenericTypes)`
`protected void` `resolve(EModelElement eModelElement, EGenericType ecoreEGenericType, EGenericType javaEGenericType)`
`protected void` `resolve(EModelElement eModelElement, EGenericType eGenericType, JavaEcoreBuilder.RequiredClassifierType requiredClassifierType)`
`protected EGenericType` `resolve(EModelElement eModelElement, java.lang.String typeName, JavaEcoreBuilder.RequiredClassifierType requiredClassifierType, boolean recordDemandCreatedEClassifier)`
`protected EGenericType` `resolveMapEntry(EPackage ePackage, EGenericType keyEGenericType, EGenericType valueEGenericType)`

`protected

`<T extends ENamedElement> void`

`

`sort(EList<T> namedElements, java.util.Map<java.lang.Object,java.lang.Integer> nameToIDMap)`

`protected java.lang.String` `stripTypeArguments(java.lang.String type)` Strips the type arguments from the type, if it has any.
`void` `traverse(IContainer container, java.util.Set<IResource> visited)` Walks the container recursively.
`void` `traverse(IFile file)` Analyzes .java files as compilation units.
`void` `used(EGenericType eGenericType)`
`void` `used(EModelElement modelElement)`
`protected void` `warning(java.lang.String message)` Produces another IStatus in the MultiStatus, with warning severity.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### facadeHelper

    protected static FacadeHelper facadeHelper

  The factory used to create JNodes.

### genModelFile

    protected IFile genModelFile

  The file being generated.

### genModel

    protected GenModel genModel

  The GenModel being generated.

### externalPackageNameToEPackageMap

    protected java.util.Map<java.lang.String,EPackage> externalPackageNameToEPackageMap

  The map from a package name to the corresponding package. These are populated from the GenModels of required projects.

### packageNameToEPackageMap

    protected java.util.Map<java.lang.String,EPackage> packageNameToEPackageMap

  The map from a package name to the corresponding package. These are populated on demand during traversal as modeled class and enums are discovered.

### ePackageToOrderingMap

    protected java.util.Map<EPackage,java.util.Map<java.lang.Object,java.lang.Integer>> ePackageToOrderingMap

  The map from package to the map of ordering constants. These are populated as the package interface is traversed.

### ePackageToPrefixMap

    protected java.util.Map<EPackage,java.lang.String> ePackageToPrefixMap

  The map from package to the it's prefix. These are populated as the package interfaces are traversed.

### eModelElementToJNodeMap

    protected java.util.Map<EModelElement,JNode> eModelElementToJNodeMap

  The map from a model element to the corresponding JNode. These are populated during traversal as each model element is created.

### eStructuralFeatures

    protected java.util.Set<EStructuralFeature> eStructuralFeatures

  The features handled during the traversal. These are populated during traversal as each feature is created. They must be patched after traversal is completed to ensure they have resolved to the right type of classifier.

### eAttributes

    protected java.util.Set<EAttribute> eAttributes

  The attributes that must be treated as attributes because the are explicitly declared to be of that kind.

### ecoreEGenericTypeToJavaEGenericTypeMap

    protected java.util.Map<EGenericType,EGenericType> ecoreEGenericTypeToJavaEGenericTypeMap

  A map from a generic type to the possibly null generic type that represents its proper Java type.

### demandCreatedEClassifiers

    protected java.util.Set<EClassifier> demandCreatedEClassifiers

  The set of classifiers that were demand created.

### eReferenceToOppositeNameMap

    protected java.util.Map<EReference,java.lang.String> eReferenceToOppositeNameMap

  The map from a reference to the name of its opposite. These are populated during traversal as each reference with an opposite is created. They must be patched after traversal and patching of typed elements is completed. The opposite found as a feature of the type.

### transientEReferenceWithOpposite

    protected java.util.Set<EReference> transientEReferenceWithOpposite

  The set of references that have opposites and have been explicitly marked as being transient.

### eReferenceToKeyNamesMap

    protected java.util.Map<EReference,java.util.List<java.lang.String>> eReferenceToKeyNamesMap

  The map from a reference to the names of its keys. These are populated during traversal as each reference with keys is created. They must be patched after traversal and patching of typed elements is completed. The key is found as an attribute of the type.

### externalGenModels

    protected java.util.Collection<GenModel> externalGenModels

  All the external GenModels from all required projects.

### usedGenPackages

    protected java.util.Collection<GenPackage> usedGenPackages

  All the used GenPackages.

### basicDiagnostic

    protected BasicDiagnostic basicDiagnostic

  A collection of the problems encountered during the processing.

### foundJava

    protected boolean foundJava

  Set to true when a compilation unit is processed and hence indicates if anything to process has been found.

### oldGenModelVersion

    protected GenModel oldGenModelVersion

  The old version to against which to reconcile.

### eGenericTypeConverter

    protected EcoreUtil.EGenericTypeConverter eGenericTypeConverter

  The utility used to convert a generate type to a fully qualified Java instance type.

### MAP_ENTRY_CLASS_CONTAINER_ANNOTATION_SOURCE

    protected static final java.lang.String MAP_ENTRY_CLASS_CONTAINER_ANNOTATION_SOURCE

See Also:
  Constant Field Values

### modelDocExpression

    protected static java.util.regex.Pattern modelDocExpression

  The pattern for extracting the model documentation.

### modelAnnotationExpression

    protected static java.util.regex.Pattern modelAnnotationExpression

  The pattern for extracting the @model annotations.

### extendsAnnotationExpression

    protected static java.util.regex.Pattern extendsAnnotationExpression

  The pattern for extracting the @extends annotations.

### implementsAnnotationExpression

    protected static java.util.regex.Pattern implementsAnnotationExpression

  The pattern for extracting the @implements annotations.

### eAnnotationExpression

    protected static java.util.regex.Pattern eAnnotationExpression

### eAnnotationDetailExpression

    protected static java.util.regex.Pattern eAnnotationDetailExpression

Constructor Detail

### JavaEcoreBuilder

    public JavaEcoreBuilder(IFile genModelFile)

  Creates a builder for the given file.

### JavaEcoreBuilder

    public JavaEcoreBuilder(IFile genModelFile,
                            GenModel oldGenModelVersion)

### JavaEcoreBuilder

    public JavaEcoreBuilder(IFile genModelFile,
                            GenModel oldGenModelVersion,
                            GenModel genModel)

Method Detail

### createResourceSet

    protected ResourceSet createResourceSet()

### analyzeProject

    protected IPath analyzeProject(IProject project)
                            throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### computeEPackages

    public void computeEPackages(Monitor monitor,
                                 ModelImporter modelImporter)
                          throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### used

    public void used(EGenericType eGenericType)

### used

    public void used(EModelElement modelElement)

### determineExternalPackages

    public void determineExternalPackages(GenPackage genPackage)

### determineExternalPackages

    protected void determineExternalPackages(GenPackage genPackage,
                                             ModelImporter modelImporter)

### getAllReferencedProjects

    public void getAllReferencedProjects(java.util.Collection<IProject> result,
                                         IProject[] projects)
                                  throws CoreException

  Walks the projects recursively.

  Throws:
    `CoreException`

### getAllGenModelFiles

    public void getAllGenModelFiles(java.util.Collection<IFile> result,
                                    IContainer container)
                             throws CoreException

  Walks the container recursively.

  Throws:
    `CoreException`

### getAllGenModelFiles

    public void getAllGenModelFiles(java.util.Collection<IFile> result,
                                    IFile file)
                             throws CoreException

  Walks the container recursively.

  Throws:
    `CoreException`

### traverse

    public void traverse(IContainer container,
                         java.util.Set<IResource> visited)
                  throws CoreException

  Walks the container recursively.

  Throws:
    `CoreException`

### traverse

    public void traverse(IFile file)
                  throws CoreException

  Analyzes .java files as compilation units.

  Throws:
    `CoreException`

### analyzeCompilationUnit

    protected void analyzeCompilationUnit(JCompilationUnit compilationUnit)

  Walks the compilation unit to analyze the type.

### analyzeEnum

    protected void analyzeEnum(JEnum enumeration)

### getEPackage

    protected EPackage getEPackage(JNode node)

### analyzeType

    protected void analyzeType(JType type)

  Walks the type either as an EClass or an ENum to analyze either the methods or the fields.

### analyzeMethod

    protected void analyzeMethod(EClass eClass,
                                 JMethod method)

  Creates an EOperation, EAttribute, or EReference as appropriate.

### analyzeMethod

    protected ETypedElement analyzeMethod(EClass eClass,
                                          java.lang.String modelAnnotation,
                                          java.lang.String methodName,
                                          java.lang.String returnType,
                                          java.lang.String[] parameterNames,
                                          java.lang.String[] parameterTypes,
                                          java.lang.String[] exceptionTypes,
                                          java.lang.String[] typeParameters)

### analyzeEGenericTypes

    protected java.util.List<EGenericType> analyzeEGenericTypes(java.lang.String genericTypes)

### isListType

    protected boolean isListType(java.lang.String type)

### isMapType

    protected boolean isMapType(java.lang.String type)

### handleETypedElement

    protected void handleETypedElement(ETypedElement eTypedElement,
                                       java.lang.String name,
                                       java.lang.String type,
                                       java.lang.String modelAnnotation,
                                       java.lang.String identifierName)

### getJCompilationUnit

    protected JCompilationUnit getJCompilationUnit(EModelElement eModelElement)

### stripTypeArguments

    protected java.lang.String stripTypeArguments(java.lang.String type)

  Strips the type arguments from the type, if it has any.

### createFeature

    protected EStructuralFeature createFeature(EClass eClass,
                                               java.lang.String name,
                                               EGenericType eGenericType)

### analyzeEnumLiteral

    protected boolean analyzeEnumLiteral(EEnum eEnum,
                                         JMember member)

  Creates EEnumLiteral as appropriate.

  Returns:
    `true` when the method has created an EnumLiteral after analyzing the JMember

### getModelDocumentation

    protected java.lang.String getModelDocumentation(java.lang.String comment)

  Returns the model documentation, or null.

### getModelAnnotation

    protected java.lang.String getModelAnnotation(java.lang.String comment)

  Returns the @model annotation contents, or null.

### getExtendsAnnotation

    protected java.lang.String getExtendsAnnotation(java.lang.String comment)

  Returns the @extends/@implements annotation contents, or null.

### getModelAnnotationAttribute

    protected java.lang.String getModelAnnotationAttribute(java.lang.String modelAnnotation,
                                                           java.lang.String attributeName)

  Returns the unquoted value of attribute-name="value" or of attribute-name='value', or null.

### getModelAnnotationAttributes

    protected java.lang.String getModelAnnotationAttributes(java.lang.String modelAnnotation,
                                                            java.lang.String attributeName)

  Returns the space separated concatenation of the unquoted value of each attribute-name="value" or attribute-name='value' repeat, or null.

### extractEAnnotations

    protected java.util.List<EAnnotation> extractEAnnotations(java.lang.String modelAnnotation)

### getFilteredModelAnnotations

    protected java.lang.String getFilteredModelAnnotations(java.lang.String modelAnnotation,
                                                           java.lang.String filter)

  Returns the filtered matches xyzAttribute-name="value" or of xyxAttribute-name='value', or null.

### match

    protected void match(java.util.List<EGenericType> target,
                         java.util.List<EGenericType> javaEGenericTypes,
                         java.util.List<EGenericType> ecoreEGenericTypes)

### resolve

    protected void resolve(EModelElement eModelElement,
                           EGenericType ecoreEGenericType,
                           EGenericType javaEGenericType)

### resolve

    protected void resolve(EModelElement eModelElement,
                           EGenericType eGenericType,
                           JavaEcoreBuilder.RequiredClassifierType requiredClassifierType)

### resolve

    protected EGenericType resolve(EModelElement eModelElement,
                                   java.lang.String typeName,
                                   JavaEcoreBuilder.RequiredClassifierType requiredClassifierType,
                                   boolean recordDemandCreatedEClassifier)

### addToPackage

    protected void addToPackage(EPackage ePackage,
                                EClassifier eClassifier)

### resolveMapEntry

    protected EGenericType resolveMapEntry(EPackage ePackage,
                                           EGenericType keyEGenericType,
                                           EGenericType valueEGenericType)

### sort

    protected <T extends ENamedElement> void sort(EList<T> namedElements,
                                                  java.util.Map<java.lang.Object,java.lang.Integer> nameToIDMap)

### getOrderingValue

    protected int getOrderingValue(ENamedElement eNamedElement,
                                   java.util.Map<java.lang.Object,java.lang.Integer> nameToIDMap)

### getNamedElement

    protected <T extends ENamedElement> T getNamedElement(java.util.List<T> namedElements,
                                                          java.lang.String name)

### getDiagnostic

    public Diagnostic getDiagnostic()

  Returns the diagnostic.

  Returns:
    the status.

### getGenModel

    public GenModel getGenModel()

  Returns the generator model.

  Returns:
    the generator model.

### getUsedGenPackages

    public java.util.Collection<GenPackage> getUsedGenPackages()

  Returns the list of used GenPackages.

  Returns:
    the list of used GenPackages.

### error

    protected void error(java.lang.String message)

  Produces another IStatus in the MultiStatus.

  Parameters:
    `message` - a description of the error.

### warning

    protected void warning(java.lang.String message)

  Produces another IStatus in the MultiStatus, with warning severity.

  Parameters:
    `message` - a description of the error.

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