org.eclipse.jpt.core.resource.java
Interface JavaResourcePersistentMember

All Superinterfaces:
JavaResourceNode, Model
All Known Subinterfaces:
JavaResourcePersistentAttribute, JavaResourcePersistentType

public interface JavaResourcePersistentMember
extends JavaResourceNode

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.


Field Summary
static java.lang.String ANNOTATIONS_COLLECTION
           
static java.lang.String MAPPING_ANNOTATIONS_COLLECTION
           
static java.lang.String PERSISTABLE_PROPERTY
           
 
Method Summary
 JavaResourceNode addAnnotation(int index, java.lang.String nestableAnnotationName, java.lang.String containerAnnotationName)
          Add a new NestableAnnotation named nestableAnnotationName.
 JavaResourceNode addAnnotation(java.lang.String annotationName)
          Add an annotation for the given fully qualified annotation name
<T extends JavaResourceNode>
java.util.Iterator<T>
annotations()
          Return all JavaResources that correspond to annotations in the source code.
<T extends JavaResourceNode>
java.util.ListIterator<T>
annotations(java.lang.String nestableAnnotationName, java.lang.String containerAnnotationName)
          Given a nestable and container annotation name return the specified JavaResources.
 int annotationsSize()
           
 JavaResourceNode getAnnotation(java.lang.String annotationName)
          Returns the JavaResource with this fully qualifed annotation name.
 JavaResourceNode getMappingAnnotation()
          Return the JavaResource specified on this JavaPersistentResource In the case of multiples the first one will be returned as defined by the order of org.eclipse.jpt.core.internal.platform.GenericJpaPlatform#typeMappingAnnotationDefinitions() or org.eclipse.jpt.core.internal.platform.GenericJpaPlatform#attributeMappingAnnotationDefinitions()
 JavaResourceNode getMappingAnnotation(java.lang.String annotationName)
          Returns the JavaResource with this fully qualifed annotation name.
 TextRange getNameTextRange(org.eclipse.jdt.core.dom.CompilationUnit astRoot)
          return the text range for the name of the persistent resource
 JavaResourceNode getNonNullAnnotation(java.lang.String annotationName)
          Returns the JavaResource with this fully qualifed annotation name.
 JavaResourceNode getNullMappingAnnotation(java.lang.String annotationName)
          Return a null implementation of JavaResourceNode with this fully qualifed annotation name.
 boolean isFor(MethodSignature methodSignature, int occurrence)
          Return whether the Java resource persistent member is for the specified method.
 boolean isFor(java.lang.String memberName, int occurrence)
          Return whether the Java resource persistent member is for the specified member.
 boolean isPersistable()
          Return whether the underlying JDT member is persistable according to the JPA spec
 boolean isPersisted()
          Return whether the underlying JDT member is currently annotated as being persistent (equivalent to "is mapped")
<T extends JavaResourceNode>
java.util.Iterator<T>
mappingAnnotations()
          Return all JavaResources that correspond to type mapping annotations specified in the source code.
 int mappingAnnotationsSize()
           
 void move(int targetIndex, int sourceIndex, java.lang.String containerAnnotationName)
          Move nestableAnnotation found in the containerAnnotation from the specified source index to the specified target index.
 void removeAnnotation(int index, java.lang.String nestableAnnotationName, java.lang.String containerAnnotationName)
           
 void removeAnnotation(java.lang.String annotationName)
           
 void resolveTypes(org.eclipse.jdt.core.dom.CompilationUnit astRoot)
          Resolve type information that could be dependent on other files being added/removed
 void setMappingAnnotation(java.lang.String annotationName)
          Use this to change the type mapping annotation.
 
Methods inherited from interface org.eclipse.jpt.core.resource.java.JavaResourceNode
getJpaCompilationUnit, getResourceModel, getTextRange, initialize, updateFromJava
 
Methods inherited from interface org.eclipse.jpt.utility.model.Model
addCollectionChangeListener, addCollectionChangeListener, addListChangeListener, addListChangeListener, addPropertyChangeListener, addPropertyChangeListener, addStateChangeListener, addTreeChangeListener, addTreeChangeListener, removeCollectionChangeListener, removeCollectionChangeListener, removeListChangeListener, removeListChangeListener, removePropertyChangeListener, removePropertyChangeListener, removeStateChangeListener, removeTreeChangeListener, removeTreeChangeListener
 

Field Detail

MAPPING_ANNOTATIONS_COLLECTION

static final java.lang.String MAPPING_ANNOTATIONS_COLLECTION
See Also:
Constant Field Values

ANNOTATIONS_COLLECTION

static final java.lang.String ANNOTATIONS_COLLECTION
See Also:
Constant Field Values

PERSISTABLE_PROPERTY

static final java.lang.String PERSISTABLE_PROPERTY
See Also:
Constant Field Values
Method Detail

mappingAnnotations

<T extends JavaResourceNode> java.util.Iterator<T> mappingAnnotations()
Return all JavaResources that correspond to type mapping annotations specified in the source code. In JPA these could be Entity, MappedSuperclass, Embeddable.

Does not return duplicate annotations as this error is handled by the java compiler.


mappingAnnotationsSize

int mappingAnnotationsSize()

getMappingAnnotation

JavaResourceNode getMappingAnnotation()
Return the JavaResource specified on this JavaPersistentResource In the case of multiples the first one will be returned as defined by the order of org.eclipse.jpt.core.internal.platform.GenericJpaPlatform#typeMappingAnnotationDefinitions() or org.eclipse.jpt.core.internal.platform.GenericJpaPlatform#attributeMappingAnnotationDefinitions()


getMappingAnnotation

JavaResourceNode getMappingAnnotation(java.lang.String annotationName)
Returns the JavaResource with this fully qualifed annotation name. In JPA the valid annotations are "javax.persistence.Embedddable", "javax.persistence.Entity", and "javax.persistence.MappedSuperclass" Return the first if there are duplicates in the source code

Parameters:
annotationName - - fully qualified annotation name

setMappingAnnotation

void setMappingAnnotation(java.lang.String annotationName)
Use this to change the type mapping annotation. This will only remove other mapping annotations in case there were multiple before. It will not remove any non-mapping annotations

Parameters:
annotationName - - fully qualified annotation name

annotations

<T extends JavaResourceNode> java.util.Iterator<T> annotations()
Return all JavaResources that correspond to annotations in the source code. Does not return duplicate annotations as this error is handled by the java compiler. No MappingAnnotations should be included.

See Also:
mappingAnnotations()

annotationsSize

int annotationsSize()

annotations

<T extends JavaResourceNode> java.util.ListIterator<T> annotations(java.lang.String nestableAnnotationName,
                                                                   java.lang.String containerAnnotationName)
Given a nestable and container annotation name return the specified JavaResources. If both the nestable and container annotations are specified on the Type, then only return the nestable annotations specified within the container annotation. This is only going to return JavaResources that match the nestableAnnotationName


getAnnotation

JavaResourceNode getAnnotation(java.lang.String annotationName)
Returns the JavaResource with this fully qualifed annotation name. Return the first if there are duplicates in the source code.


getNonNullAnnotation

JavaResourceNode getNonNullAnnotation(java.lang.String annotationName)
Returns the JavaResource with this fully qualifed annotation name. Return the first if there are duplicates in the source code. Will not return null, but a null Object instead if no annotation with this name exists in the java source.


getNullMappingAnnotation

JavaResourceNode getNullMappingAnnotation(java.lang.String annotationName)
Return a null implementation of JavaResourceNode with this fully qualifed annotation name. The corresponding AnnotationDefinition needs to implement buildNullAnnotation() AnnotationDefinition#buildNullAnnotation(JavaResourcePersistentMember, org.eclipse.jpt.core.internal.jdtutility.Member)


addAnnotation

JavaResourceNode addAnnotation(java.lang.String annotationName)
Add an annotation for the given fully qualified annotation name


removeAnnotation

void removeAnnotation(java.lang.String annotationName)

addAnnotation

JavaResourceNode addAnnotation(int index,
                               java.lang.String nestableAnnotationName,
                               java.lang.String containerAnnotationName)
Add a new NestableAnnotation named nestableAnnotationName. Create a new container annotation if necessary and add the nestable annotation to it. If both nestable and container already exist then add to the container annotation leaving the existing nestable annotaion alone. If only nestable exists, then create the new container annotation and move the nestable to it also adding the new one. If neither exists, create a new nestable annotation.

Returns:
the new JavaResource with the name nestableAnnotationName

removeAnnotation

void removeAnnotation(int index,
                      java.lang.String nestableAnnotationName,
                      java.lang.String containerAnnotationName)

move

void move(int targetIndex,
          int sourceIndex,
          java.lang.String containerAnnotationName)
Move nestableAnnotation found in the containerAnnotation from the specified source index to the specified target index.


isPersistable

boolean isPersistable()
Return whether the underlying JDT member is persistable according to the JPA spec


isPersisted

boolean isPersisted()
Return whether the underlying JDT member is currently annotated as being persistent (equivalent to "is mapped")


isFor

boolean isFor(java.lang.String memberName,
              int occurrence)
Return whether the Java resource persistent member is for the specified member.


isFor

boolean isFor(MethodSignature methodSignature,
              int occurrence)
Return whether the Java resource persistent member is for the specified method.


getNameTextRange

TextRange getNameTextRange(org.eclipse.jdt.core.dom.CompilationUnit astRoot)
return the text range for the name of the persistent resource


resolveTypes

void resolveTypes(org.eclipse.jdt.core.dom.CompilationUnit astRoot)
Resolve type information that could be dependent on other files being added/removed