EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

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

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.spi.java.JavaType
All Implemented Interfaces:
IType

public class JavaType
extends java.lang.Object
implements IType

The concrete implementation of IType that is wrapping a Java type.

Version:
2.4
Author:
Pascal Filion
Since:
2.3

Field Summary
 
Fields inherited from interface org.eclipse.persistence.jpa.jpql.spi.IType
UNRESOLVABLE_TYPE
 
Constructor Summary
JavaType(ITypeRepository typeRepository, java.lang.Class<?> type)
          Creates a new JavaType.
JavaType(ITypeRepository typeRepository, java.lang.String typeName)
          Creates a new JavaType.
 
Method Summary
protected  IConstructor buildConstructor(java.lang.reflect.Constructor<?> constructor)
           
protected  java.util.Collection<IConstructor> buildConstructors()
           
protected  java.lang.String[] buildEnumConstants()
           
 IterableIterator<IConstructor> constructors()
          Returns the external representation of the Java class's constructors.
 boolean equals(IType type)
          Determines whether the given type represents the same Java type thank this one.
 boolean equals(java.lang.Object object)
          
 java.lang.String[] getEnumConstants()
          If this IType represents an Enum type, then this method should returns the name of the constants.
 java.lang.String getName()
          Returns the fully qualified class name.
 java.lang.Class<?> getType()
          Returns the encapsulated Class, which is the actual type.
 ITypeDeclaration getTypeDeclaration()
          Returns the declaration of the Java class, which gives the information about type parameters, dimensionality, etc.
protected  ITypeRepository getTypeRepository()
          Returns the type repository for the application.
 boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Determines whether the given annotation is present on this type.
 int hashCode()
          
 boolean isAssignableTo(IType otherType)
          Determines whether this type is an instance of the given type.
 boolean isEnum()
          Determines whether this IType represents an Enum.
 boolean isResolvable()
          Determines whether this Java type actually exists.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaType

public JavaType(ITypeRepository typeRepository,
                java.lang.Class<?> type)
Creates a new JavaType.

Parameters:
typeRepository - The external form of a type repository
type - The actual Java type wrapped by this class

JavaType

public JavaType(ITypeRepository typeRepository,
                java.lang.String typeName)
Creates a new JavaType.

Parameters:
typeRepository - The external form of a type repository
typeName - The fully qualified name of the Java type
Method Detail

buildConstructor

protected IConstructor buildConstructor(java.lang.reflect.Constructor<?> constructor)

buildConstructors

protected java.util.Collection<IConstructor> buildConstructors()

buildEnumConstants

protected java.lang.String[] buildEnumConstants()

constructors

public IterableIterator<IConstructor> constructors()
Returns the external representation of the Java class's constructors. All public, protected, default (package) access, and private constructors should be included.

Specified by:
constructors in interface IType
Returns:
The declared constructors

equals

public boolean equals(IType type)
Determines whether the given type represents the same Java type thank this one.

Note: Object.hashCode() needs to be overridden.

Specified by:
equals in interface IType
Parameters:
type - The type to compare with this one
Returns:
true if the given type and this one represents the same Java type; false otherwise

equals

public boolean equals(java.lang.Object object)

Overrides:
equals in class java.lang.Object

getEnumConstants

public java.lang.String[] getEnumConstants()
If this IType represents an Enum type, then this method should returns the name of the constants.

Specified by:
getEnumConstants in interface IType
Returns:
The name of the Enum constant or an empty list if the type is not an Enum

getName

public java.lang.String getName()
Returns the fully qualified class name.

Specified by:
getName in interface IType
Returns:
The name of the class represented by this one

getType

public java.lang.Class<?> getType()
Returns the encapsulated Class, which is the actual type.

Returns:
The actual Java type, if null is returned; then the class could not be resolved

getTypeDeclaration

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

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

getTypeRepository

protected ITypeRepository getTypeRepository()
Returns the type repository for the application.

Returns:
The repository of ITypes

hasAnnotation

public boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determines whether the given annotation is present on this type.

Specified by:
hasAnnotation in interface IType
Parameters:
annotationType - The class of the annotation
Returns:
true if the annotation is defined on this type; false otherwise

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isAssignableTo

public boolean isAssignableTo(IType otherType)
Determines whether this type is an instance of the given type.

Specified by:
isAssignableTo in interface IType
Parameters:
otherType - The type used to determine if the class represented by this external form is an instance of with one
Returns:
true if this type is an instance of the given type; false otherwise

isEnum

public boolean isEnum()
Determines whether this IType represents an Enum.

Specified by:
isEnum in interface IType
Returns:
true if this is an Enum; false otherwise

isResolvable

public boolean isResolvable()
Determines whether this Java type actually exists.

Specified by:
isResolvable in interface IType
Returns:
true if the actual Java type can be located on the application's class path; false if it could not be found

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference