Examples of ITypeDeclaration


Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

      Expression childExpression = expression.getExpression();
      String variableName = queryContext.literal(childExpression, LiteralType.IDENTIFICATION_VARIABLE);

      // Retrieve the identification variable's type without traversing the type parameters
      if (ExpressionTools.stringIsNotEmpty(variableName)) {
        ITypeDeclaration typeDeclaration = getTypeDeclaration(childExpression);

        if (!getTypeHelper().isMapType(typeDeclaration.getType())) {
          addProblem(
            childExpression,
            EncapsulatedIdentificationVariableExpression_NotMapValued,
            expression.getIdentifier()
          );
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

    // Example: Class<T>
    if (genericType instanceof ParameterizedType) {
      ParameterizedType parameterizedType = (ParameterizedType) genericType;
      for (Type type : parameterizedType.getActualTypeArguments()) {
        ITypeDeclaration typeParameter = buildTypeDeclaration(type);
        parameterTypes.add(typeParameter);
      }
    }
    // T[]
    else if (genericType instanceof GenericArrayType) {
      GenericArrayType genericArrayType = (GenericArrayType) genericType;
      parameterTypes.add(buildTypeDeclaration(genericArrayType.getGenericComponentType()));
    }
    // Example: Class
    else if (genericType.getClass() == Class.class) {
      ITypeDeclaration typeParameter = buildTypeDeclaration((Class<?>) genericType);
      parameterTypes.add(typeParameter);
    }
    // Example: <K, V>
    else if (genericType.getClass() == Class[].class) {
      for (Class<?> javaType : ((Class<?>[]) genericType)) {
        ITypeDeclaration typeParameter = buildTypeDeclaration(javaType);
        parameterTypes.add(typeParameter);
      }
    }
    // Example: <K, V>
    else if (genericType.getClass() == IType[].class) {
      for (IType type : ((IType[]) genericType)) {
        ITypeDeclaration typeParameter = new JavaTypeDeclaration(typeRepository, type, null, false);
        parameterTypes.add(typeParameter);
      }
    }

    return parameterTypes.toArray(new ITypeDeclaration[parameterTypes.size()]);
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

    if (mapping == null) {
      return null;
    }

    TypeHelper typeHelper = getTypeHelper();
    ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
    IType type = typeDeclaration.getType();

    // Collection type cannot be traversed
    // Example: SELECT e.employees. FROM Employee e where employees is a collection,
    // it cannot be traversed
    if (typeHelper.isCollectionType(type)) {
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   */
  @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();
      }
    }
    // For a map type, by default the value is the actual type to return
    else if (typeHelper.isMapType(type)) {

      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();

      if (typeParameters.length == 2) {
        type = typeParameters[1].getType();
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   * {@inheritDoc}
   */
  @Override
  protected IManagedType resolveManagedType(IMapping mapping) {

    ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
    IType type = typeDeclaration.getType();

    // Collection type cannot be traversed
    // Example: SELECT e.employees. FROM Employee e where employees is a collection,
    // it cannot be traversed
    if (getTypeHelper().isCollectionType(type)) {
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   * {@inheritDoc}
   */
  @Override
  protected IType buildType() {

    ITypeDeclaration typeDeclaration = getTypeDeclaration();

    if (getTypeHelper().isMapType(typeDeclaration.getType())) {
      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();

      if (typeParameters.length == 2) {
        return typeParameters[1].getType();
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

    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;
      }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   * {@inheritDoc}
   */
  @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();
      }
    }
    // For a map type, by default the value is the actual type to return
    else if (getTypeHelper().isMapType(type)) {
      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
      if (typeParameters.length == 2) {
        type = typeParameters[1].getType();
      }
    }

View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   * {@inheritDoc}
   */
  @Override
  protected IManagedType resolveManagedType(IMapping mapping) {

    ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
    IType type = typeDeclaration.getType();

    // Collection type cannot be traversed
    if (getTypeHelper().isCollectionType(type)) {
      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
      if (typeParameters.length == 0) {
        return null;
      }
      type = typeParameters[0].getType();
    }
    // Wrap the Map into a virtual IManagedType so it can be returned and the
    // IType for the Map can be used to retrieve the type of the key and value
    else if (getTypeHelper().isMapType(type)) {
      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
      if (typeParameters.length != 2) {
        return null;
      }
      type = typeParameters[1].getType();
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration

   * {@inheritDoc}
   */
  @Override
  protected IType resolveType() {

    ITypeDeclaration typeDeclaration = getTypeDeclaration();

    if (getTypeHelper().isMapType(typeDeclaration.getType())) {
      ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();

      if (typeParameters.length == 2) {
        return typeParameters[1].getType();
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.