EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.spi.java
Class AbstractMapping

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.spi.java.AbstractMapping
All Implemented Interfaces:
java.lang.Comparable<IMapping>, IMapping
Direct Known Subclasses:
AbstractFieldMapping, AbstractMethodMapping

public abstract class AbstractMapping
extends java.lang.Object
implements IMapping

The abstract implementation of IMapping that is wrapping the runtime representation of a persistent attribute.

Version:
2.4
Author:
Pascal Filion
Since:
2.4

Constructor Summary
protected AbstractMapping(IManagedType parent, java.lang.reflect.Member member)
          Creates a new AbstractMapping.
 
Method Summary
protected  ITypeDeclaration buildTypeDeclaration()
           
protected  int calculateMappingType()
          Calculates the type of the persistent attribute represented by this external form.
protected  int calculateMappingType(java.lang.annotation.Annotation[] annotations)
          Calculates the type of the mapping represented by this external form.
 int compareTo(IMapping mapping)
          
 int getMappingType()
          Returns the type of this mapping.
 java.lang.reflect.Member getMember()
          Returns the Java Member wrapped by this mapping, which represents a persistent attribute.
protected abstract  java.lang.annotation.Annotation[] getMemberAnnotations()
           
protected abstract  java.lang.reflect.Type getMemberGenericType()
           
protected abstract  java.lang.Class<?> getMemberType()
           
 java.lang.String getName()
          Returns the name of the persistence property represented by this mapping.
 IManagedType getParent()
          Returns the parent managed type owning this mapping.
 IType getType()
          Returns the type of this mapping.
 ITypeDeclaration getTypeDeclaration()
          Returns the declaration of the Java class, which gives the information about type parameters, dimensionality, etc.
protected  ITypeRepository getTypeRepository()
           
protected  boolean hasAnnotation(java.lang.annotation.Annotation[] annotations, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
           
protected  boolean hasAnnotation(java.lang.annotation.Annotation[] annotations, java.lang.String annotationType)
           
 boolean isCollection()
          Determines whether this IMapping is a collection type mapping.
 boolean isProperty()
          Determines whether this IMapping is a property type mapping.
 boolean isRelationship()
          Determines whether this IMapping is a relationship type mapping.
 boolean isTransient()
          Determines whether this IMapping is a transient mapping.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.persistence.jpa.jpql.spi.IMapping
hasAnnotation
 

Constructor Detail

AbstractMapping

protected AbstractMapping(IManagedType parent,
                          java.lang.reflect.Member member)
Creates a new AbstractMapping.

Parameters:
parent - The parent of this mapping
member - The Java Member wrapped by this mapping, which represents a persistent attribute
Method Detail

buildTypeDeclaration

protected ITypeDeclaration buildTypeDeclaration()

calculateMappingType

protected int calculateMappingType()
Calculates the type of the persistent attribute represented by this external form.

Returns:
The mapping type, which is one of the constants defined in persistence.jpa.jpql.spi.IMappingType IMappingType when the provider is generic JPA

calculateMappingType

protected int calculateMappingType(java.lang.annotation.Annotation[] annotations)
Calculates the type of the mapping represented by this external form.

Parameters:
annotations - The Annotations that are present on the member
Returns:
The mapping type, which is one of the constants defined in persistence.jpa.jpql.spi.IMappingType IMappingType when the provider is generic JPA

compareTo

public int compareTo(IMapping mapping)

Specified by:
compareTo in interface java.lang.Comparable<IMapping>

getMappingType

public int getMappingType()
Returns the type of this mapping.

Specified by:
getMappingType in interface IMapping
Returns:
One of the supported mapping type, which is one of the constants defined in IMappingType when the provider only supports generic JPA

getMember

public java.lang.reflect.Member getMember()
Returns the Java Member wrapped by this mapping, which represents a persistent attribute.

Returns:
The Java Member

getMemberAnnotations

protected abstract java.lang.annotation.Annotation[] getMemberAnnotations()

getMemberGenericType

protected abstract java.lang.reflect.Type getMemberGenericType()

getMemberType

protected abstract java.lang.Class<?> getMemberType()

getName

public java.lang.String getName()
Returns the name of the persistence property represented by this mapping.

Specified by:
getName in interface IMapping
Returns:
The name of this mapping

getParent

public IManagedType getParent()
Returns the parent managed type owning this mapping.

Specified by:
getParent in interface IMapping
Returns:
The parent of this mapping

getType

public IType getType()
Returns the type of this mapping. If this mapping is a relationship mapping, the parameter type of the collection is returned.

@OneToMany
private Collection<Employee> employees;

"Employee" is the type. To retrieve Collection, IMapping.getTypeDeclaration() needs to be used, its type will be Collection and it's generic type will be Employee.

Specified by:
getType in interface IMapping
Returns:
The external form representing the type of this mapping

getTypeDeclaration

public ITypeDeclaration getTypeDeclaration()
Returns the declaration of the Java class, which gives the information about type parameters, dimensionality, etc.

@OneToMany
private Collection<Employee> employees;

"Collection<Employee>" is the type declaration.

Specified by:
getTypeDeclaration in interface IMapping
Returns:
The external form of the class' type declaration

getTypeRepository

protected ITypeRepository getTypeRepository()

hasAnnotation

protected boolean hasAnnotation(java.lang.annotation.Annotation[] annotations,
                                java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)

hasAnnotation

protected boolean hasAnnotation(java.lang.annotation.Annotation[] annotations,
                                java.lang.String annotationType)

isCollection

public boolean isCollection()
Determines whether this IMapping is a collection type mapping.

Specified by:
isCollection in interface IMapping
Returns:
true if this IMapping is a collection mapping; false otherwise

isProperty

public boolean isProperty()
Determines whether this IMapping is a property type mapping.

Specified by:
isProperty in interface IMapping
Returns:
true if this IMapping is a property mapping; false otherwise

isRelationship

public boolean isRelationship()
Determines whether this IMapping is a relationship type mapping.

Specified by:
isRelationship in interface IMapping
Returns:
true if this IMapping is a relationship mapping; false otherwise

isTransient

public boolean isTransient()
Determines whether this IMapping is a transient mapping.

Specified by:
isTransient in interface IMapping
Returns:
true if this IMapping is a transient mapping; false otherwise

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference