Dali Provisional API
Release 3.2

org.eclipse.jpt.jpa.core
Interface JpaFile

All Superinterfaces:
ContentTypeReference, IAdaptable, JpaModel, Model

public interface JpaFile
extends JpaModel, ContentTypeReference

A JPA Project contains JPA files for all files in the project that are relevant to the JPA spec.

To retrieve the JPA file corresponding to an Eclipse file:

 IFile file = (IFile) ResourcesPlugin.getWorkspace().getRoot().findMember("Foo.java");
 JpaFile jpaFile = (JpaFile) file.getAdapter(JpaFile.class);
 
This is a non-blocking call; and as a result it will return null if the JPA file or its JPA project is currently under construction. Use a JPA file reference to retrieve a JPA file in a blocking fashion that will return a JPA file once it and its JPA project have been constructed.

See org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters.

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Since:
2.0
See Also:
JpaFile.Reference, FileAdapterFactory

Nested Class Summary
static class JpaFile.FileEquals
           
static interface JpaFile.Reference
          Standard adapter for retrieving a JPA file: IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Foo Project"); IFile file = project.getFile("Foo.java"); JpaFile.Reference jpaFileRef = (JpaFile.Reference) file.getAdapter(JpaFile.Reference.class); JpaFile jpaFile = jpaFileRef.getValue(); See org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters.
static class JpaFile.ResourceModelTransformer
           
 
Nested classes/interfaces inherited from interface org.eclipse.jpt.jpa.core.JpaModel
JpaModel.JpaVersionIsCompatibleWith
 
Nested classes/interfaces inherited from interface org.eclipse.jpt.common.core.ContentTypeReference
ContentTypeReference.ContentTypeIs, ContentTypeReference.ContentTypeIsKindOf, ContentTypeReference.ContentTypeTransformer
 
Field Summary
static org.eclipse.jpt.common.utility.transformer.Transformer<JpaFile,JptResourceModel> RESOURCE_MODEL_TRANSFORMER
           
static String ROOT_STRUCTURE_NODES_COLLECTION
           
 
Fields inherited from interface org.eclipse.jpt.common.core.ContentTypeReference
TRANSFORMER
 
Method Summary
 IFile getFile()
          Return the JPA file's Eclipse file.
 JptResourceModel getResourceModel()
          Return the resource model corresponding to the JPA file; typically a JPA compilation unit, a JPA XML resource, or a JPA package fragment root (JAR).
 JptResourceModel getResourceModel(IContentType contentType)
          Convenience method.
 Iterable<JpaStructureNode> getRootStructureNodes()
          Return the JPA file's root structure nodes.
 int getRootStructureNodesSize()
          Return the count of the JPA file's root context model objects.
 JpaStructureNode getStructureNode(int textOffset)
          Return the structure node best corresponding to the location in the file.
 void updateRootStructureNodes()
          Update the collection of root structure nodes.
 
Methods inherited from interface org.eclipse.jpt.jpa.core.JpaModel
getJpaPlatform, getJpaProject, getJpaProjectManager, getParent, getResource, stateChanged
 
Methods inherited from interface org.eclipse.jpt.common.utility.model.Model
addChangeListener, addCollectionChangeListener, addListChangeListener, addPropertyChangeListener, addStateChangeListener, removeChangeListener, removeCollectionChangeListener, removeListChangeListener, removePropertyChangeListener, removeStateChangeListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jpt.common.core.ContentTypeReference
getContentType
 

Field Detail

RESOURCE_MODEL_TRANSFORMER

static final org.eclipse.jpt.common.utility.transformer.Transformer<JpaFile,JptResourceModel> RESOURCE_MODEL_TRANSFORMER

ROOT_STRUCTURE_NODES_COLLECTION

static final String ROOT_STRUCTURE_NODES_COLLECTION
See Also:
Constant Field Values
Method Detail

getFile

IFile getFile()
Return the JPA file's Eclipse file.


getResourceModel

JptResourceModel getResourceModel()
Return the resource model corresponding to the JPA file; typically a JPA compilation unit, a JPA XML resource, or a JPA package fragment root (JAR).


getResourceModel

JptResourceModel getResourceModel(IContentType contentType)
Convenience method. Return the resource model corresponding to the JPA file if the file's content is a "kind-of" the specified content type; otherwise, return null. This is useful when a client has looked up the JPA file via a file name [and assumed content type].

See Also:
getResourceModel()

updateRootStructureNodes

void updateRootStructureNodes()
Update the collection of root structure nodes. This is called at the end of the project update.

See Also:
JpaStructureNode.addRootStructureNodesTo(JpaFile, java.util.Collection)

getRootStructureNodes

Iterable<JpaStructureNode> getRootStructureNodes()
Return the JPA file's root structure nodes.


getRootStructureNodesSize

int getRootStructureNodesSize()
Return the count of the JPA file's root context model objects.


getStructureNode

JpaStructureNode getStructureNode(int textOffset)
Return the structure node best corresponding to the location in the file.


Dali Provisional API
Release 3.2

Copyright (c) 2012 Oracle. All rights reserved.