use of org.eclipse.persistence.jpa.jpql.tools.spi.ITypeDeclaration in project eclipselink by eclipse-ee4j.
the class CollectionValuedPathExpressionStateObject method resolveManagedType.
@Override
protected IManagedType resolveManagedType() {
IMapping mapping = getMapping();
if (mapping == null) {
return null;
}
TypeHelper typeHelper = getTypeHelper();
ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
IType type = typeDeclaration.getType();
// it cannot be traversed
if (typeHelper.isCollectionType(type)) {
return null;
}
// Primitive types cannot have a managed type
if (typeHelper.isPrimitiveType(type)) {
return null;
}
// Retrieve the corresponding managed type for the mapping's type
return getManagedTypeProvider().getManagedType(type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.ITypeDeclaration in project eclipselink by eclipse-ee4j.
the class CollectionValuedPathExpressionStateObject method resolveType.
@Override
protected IType resolveType() {
TypeHelper typeHelper = getTypeHelper();
ITypeDeclaration typeDeclaration = getTypeDeclaration();
IType type = typeDeclaration.getType();
// For a collection type, return the first type parameter
if (typeHelper.isCollectionType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length > 0) {
type = typeParameters[0].getType();
}
} else // For a map type, by default the value is the actual type to return
if (typeHelper.isMapType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length == 2) {
type = typeParameters[1].getType();
}
}
// only deals with the primitive wrapper type
return typeHelper.convertPrimitive(type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.ITypeDeclaration in project eclipselink by eclipse-ee4j.
the class CollectionValuedFieldResolver method buildType.
@Override
protected IType buildType() {
ITypeDeclaration typeDeclaration = getTypeDeclaration();
IType type = typeDeclaration.getType();
// For a collection type, return the first type parameter
if (getTypeHelper().isCollectionType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length > 0) {
type = typeParameters[0].getType();
}
} else // For a map type, by default the value is the actual type to return
if (getTypeHelper().isMapType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length == 2) {
type = typeParameters[1].getType();
}
}
// only deals with the primitive wrapper type
return getTypeHelper().convertPrimitive(type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.ITypeDeclaration in project eclipselink by eclipse-ee4j.
the class StateFieldResolver method resolveManagedType.
@Override
protected IManagedType resolveManagedType(IMapping mapping) {
ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
IType type = typeDeclaration.getType();
// it cannot be traversed
if (getTypeHelper().isCollectionType(type)) {
return null;
}
// Primitive types cannot have a managed type
if (getTypeHelper().isPrimitiveType(type)) {
return null;
}
// Retrieve the corresponding managed type for the mapping's type
return getProvider().getManagedType(type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.ITypeDeclaration in project eclipselink by eclipse-ee4j.
the class StateFieldPathExpressionStateObject method resolveManagedType.
@Override
protected IManagedType resolveManagedType() {
IMapping mapping = getMapping();
if (mapping == null) {
return null;
}
TypeHelper typeHelper = getTypeHelper();
ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
IType type = typeDeclaration.getType();
// Collection type cannot be traversed
if (typeHelper.isCollectionType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length == 0) {
return null;
}
type = typeParameters[0].getType();
} else // IType for the Map can be used to retrieve the type of the key and value
if (typeHelper.isMapType(type)) {
return new MapManagedType(getManagedTypeProvider(), type);
}
// Retrieve the corresponding managed type for the mapping's type
return getManagedTypeProvider().getManagedType(type);
}
Aggregations