Package org.eclipse.persistence.jpa.jpql

Examples of org.eclipse.persistence.jpa.jpql.ITypeHelper


  protected void validateUpdateItemTypes(UpdateItem expression, Object type) {

    if (expression.hasNewValue()) {

      Expression newValue = expression.getNewValue();
      ITypeHelper typeHelper = getTypeHelper();
      boolean nullValue = isNullValue(newValue);

      // A NULL value is ignored, except if the type is a primitive, null cannot be
      // assigned to a mapping of primitive type
      if (nullValue) {
        if (typeHelper.isPrimitiveType(type)) {
          addProblem(expression, UpdateItem_NullNotAssignableToPrimitive);
        }
        return;
      }

      Object newValueType = getType(newValue);

      // Do a quick check for known JDK types:
      // 1) Date/Time/Timestamp
      // 2) Any classes related to a number, eg long/Long etc
      if (!helper.isTypeResolvable(newValueType) ||
          typeHelper.isDateType(type) && typeHelper.isDateType(newValueType) ||
          (typeHelper.isNumericType(type)         || typeHelper.isPrimitiveType(type)) &&
          (typeHelper.isNumericType(newValueType) || typeHelper.isPrimitiveType(newValueType))) {

        return;
      }

      // The new value's type can't be assigned to the item's type
View Full Code Here


    // 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
    ITypeHelper typeHelper = getTypeHelper();

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

        !helper.isTypeResolvable(type2)) {

      return true;
    }

    ITypeHelper typeHelper = getTypeHelper();

    if (type1 == type2) {
      return typeHelper.isNumericType(type1) ||
      typeHelper.isStringType(type1||
      typeHelper.isDateType(type1);
    }
    else {
      return typeHelper.isNumericType(type1) && typeHelper.isNumericType(type2) ||
             typeHelper.isStringType(type1&& typeHelper.isStringType(type2||
             typeHelper.isDateType(type1)    && typeHelper.isDateType(type2);
    }
  }
View Full Code Here

   */
  protected boolean isIntegralType(Expression expression) {

    if (isNumericType(expression)) {

      ITypeHelper typeHelper = getTypeHelper();
      Object type = helper.getType(expression);

      return type == typeHelper.unknownType() ||
             typeHelper.isIntegralType(type);
    }

    return false;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.ITypeHelper

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.