Package org.eclipse.persistence.jpa.jpql.spi

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


    /**
     * {@inheritDoc}
     */
    @Override
    public final void visit(CaseExpression expression) {
      IType type = getType(expression);
      valid = isRightType(type);
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    @Override
    public final void visit(CoalesceExpression expression) {
      IType type = getType(expression);
      valid = isRightType(type);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public final void visit(FuncExpression expression) {
      IType type = getType(expression);
      valid = isRightType(type);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public final void visit(StateFieldPathExpression expression) {
      IType type = getType(expression);
      valid = isRightType(type);
    }
View Full Code Here

    TypeHelper typeHelper = getTypeHelper();

    for (int index = types1.length; --index >= 0; ) {

      // Convert a primitive to its Object type
      IType type1 = typeHelper.convertPrimitive(types1[index].getType());
      IType type2 = typeHelper.convertPrimitive(types2[index]);

      if (!type1.isAssignableTo(type2)) {
        return false;
      }
    }
View Full Code Here

    return isValid(expression, BooleanTypeValidator.class);
  }

  private boolean isComparisonEquivalentType(Expression expression1, Expression expression2) {

    IType type1 = getType(expression1);
    IType type2 = getType(expression2);

    // 1. The types are the same
    // 2. The type cannot be determined, pretend they are equivalent,
    //    another rule will validate it
    // 3. One is assignable to the other one
    TypeHelper typeHelper = getTypeHelper();

    return (type1 == type2) ||
           !type1.isResolvable() ||
           !type2.isResolvable() ||
            typeHelper.isNumericType(type1) && typeHelper.isNumericType(type2) ||
            typeHelper.isDateType(type1)    && typeHelper.isDateType(type2)    ||
            type1.isAssignableTo(type2) ||
            type2.isAssignableTo(type1);
  }
View Full Code Here

            type2.isAssignableTo(type1);
  }

  private boolean isEquivalentBetweenType(Expression expression1, Expression expression2) {

    IType type1 = getType(expression1);
    IType type2 = getType(expression2);

    // The type cannot be determined, pretend they are equivalent,
    // another rule will validate it
    if (!type1.isResolvable() || !type2.isResolvable()) {
      return true;
    }

    TypeHelper typeHelper = getTypeHelper();
View Full Code Here

  private boolean isIntegralType(Expression expression) {

    if (isNumericType(expression)) {

      TypeHelper typeHelper = getTypeHelper();
      IType type = getType(expression);

      if (type != typeHelper.unknownType()) {
        return typeHelper.isIntegralType(type);
      }
    }
View Full Code Here

       !collectionValuedPathExpression.endsWithDot()) {

      // A collection_valued_field is designated by the name of an association field in a
      // one-to-many or a many-to-many relationship or by the name of an element collection field
      Resolver resolver = getResolver(expression);
      IType type = resolver.getType();
      IMapping mapping = resolver.getMapping();

      // Does not resolve to a valid path
      if (!type.isResolvable() || (mapping == null)) {
        int startIndex = position(expression);
        int endIndex   = startIndex + length(expression);

        addProblem(
          expression,
View Full Code Here

    // A single_valued_object_field is designated by the name of an association field in a
    // one-to-one or many-to-one relationship or a field of embeddable class type
    if (expression.hasIdentificationVariable() &&
       !expression.endsWithDot()) {

      IType type = getType(expression);
      IMapping mapping = getMapping(expression);

      // Does not resolve to a valid path
      if (!type.isResolvable()) {
        addProblem(expression, StateFieldPathExpression_NotResolvable, expression.toParsedText());
      }
      // Make sure an enum constant was parsed as a state field path
      // expression before checking for a mapping
      else if ((mapping == null) && type.isEnum()) {
        String enumConstant = expression.getPath(expression.pathSize() - 1);
        boolean found = false;

        for (String constant : type.getEnumConstants()) {
          if (constant.equals(enumConstant)) {
            found = true;
            break;
          }
        }

        if (!found) {
          int startIndex = position(expression) + type.getName().length() + 1;
          int endIndex   = startIndex + enumConstant.length();
          addProblem(expression, startIndex, endIndex, StateFieldPathExpression_InvalidEnumConstant, enumConstant);
        }

        // Remove the used identification variable since it's is the first
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.spi.IType

Copyright © 2018 www.massapicom. 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.