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

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


   * {@inheritDoc}
   */
  @Override
  ITypeDeclaration buildTypeDeclaration() {

    IType type = getEnumType();

    if (type != null) {
      enumType = Boolean.TRUE;
      return type.getTypeDeclaration();
    }
    else {
      enumType = Boolean.FALSE;
      return super.buildTypeDeclaration();
    }
View Full Code Here


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

    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) {
View Full Code Here

  @Override
  IType buildType() {

    List<IType> types = new ArrayList<IType>(resolvers.size());
    TypeHelper helper = getTypeHelper();
    IType unresolvableType = helper.unknownType();

    // Convert any primitive types into its Class type and any non-number into Object
    for (Resolver typeResolver : resolvers) {

      IType type = typeResolver.getType();

      // Only a resolvable type will be added to the list
      if (type != unresolvableType) {
        // Non-numeric type cannot be added
        if (!helper.isNumericType(type)) {
View Full Code Here

   */
  @Override
  IType buildType() {

    TypeHelper helper = getTypeHelper();
    IType unknownType = helper.unknownType();
    IType type = null;

    for (int index = 0, count = resolvers.size(); index < count; index++) {
      IType anotherType = resolvers.get(index).getType();

      if (anotherType == unknownType) {
        continue;
      }

View Full Code Here

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

    IType stringType   = null;
    IType numericType  = null;
    IType dateTimeType = null;
    IType numericClass = getTypeHelper().numberType();
    IType dateClass    = getTypeHelper().dateType();

    for (Resolver resolver : resolvers) {
      IType parameterType = resolver.getType();

      // String parameter type
      if (getTypeHelper().isStringType(parameterType)) {
        stringType = parameterType;
      }
      // Numeric parameter type
      else if (parameterType.isAssignableTo(numericClass)) {
        numericType = numericClass;
      }
      // Date/Time parameter type
      else if (parameterType.isAssignableTo(dateClass)) {
        dateTimeType = dateClass;
      }
    }

    // String type
View Full Code Here

    // Now find the closest type for each location
    TreeSet<IType> types = new TreeSet<IType>(buildNumericTypeComparator());

    for (InputParameter inputParameter : inputParameters) {
      IType type = queryContext.getParameterType(inputParameter);

      // A type is ignored if it cannot be determined and it can't affect the calculation
      // if the same input parameter is used elsewhere. Example:
      // SELECT e FROM Employee e WHERE :name IS NOT NULL AND e.name = 'JPQL'
      // The first :name cannot be used to calculate the type
      if (type.isResolvable()) {
        types.add(type);
      }
    }

    return types.isEmpty() ? getTypeHelper().objectType() : types.first();
View Full Code Here

   * @return The result type of the JPQL query if it could accurately be calculated or the
   * {@link IClass} for <code>Object</code> if it could not be calculated
   */
  protected IType getResultType() {

    IType type = queryContext.getType(getJPQLExpression());

    if (!type.isResolvable()) {
      type = getTypeHelper().objectType();
    }

    return type;
  }
View Full Code Here

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

    IType type = getTypeDeclaration().getType();
    TypeHelper helper = getTypeHelper();

    // Integral types: int/Integer, long/Long => the result is a Long
    if (helper.isIntegralType(type)) {
      return helper.longType();
    }

    // Floating types: float/Float, double/Double => the result is a Double
    if (helper.isFloatingType(type)) {
      return helper.doubleType();
    }

    // BigInteger, the result is the same
    IType bigIntegerType = helper.bigInteger();

    if (type.equals(bigIntegerType)) {
      return bigIntegerType;
    }

    // BigDecimal, the result is the same
    IType bigDecimalType = helper.bigDecimal();

    if (type.equals(bigDecimalType)) {
      return bigDecimalType;
    }

View Full Code Here

   * {@inheritDoc}
   */
  @Override
  ITypeDeclaration buildTypeDeclaration() {

    IType type = getEnumType();

    if (type != null) {
      enumType = Boolean.TRUE;
      return type.getTypeDeclaration();
    }
    else {
      enumType = Boolean.FALSE;
      return super.buildTypeDeclaration();
    }
View Full Code Here

   * have been converted into the class of that primitive
   */
  public IType convertPrimitive(IType type) {

    // byte
    IType newType = toByteType(type);
    if (newType != type) {
      return newType;
    }

    // short
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.