Package org.exist.xquery

Examples of org.exist.xquery.XPathException$FunctionStackElement


            if (target.isAssignableFrom(getClass())){
                return (T)this;
            } else if (target.isAssignableFrom(Duration.class)) {
                return (T)duration;
            }
            throw new XPathException(ErrorCodes.XPTY0004, "cannot convert value of type " + Type.getTypeName(getType()) + " to Java object of type " + target.getName());
  }
View Full Code Here


            }
            throw new XPathException(ErrorCodes.XPTY0004, "cannot convert value of type " + Type.getTypeName(getType()) + " to Java object of type " + target.getName());
  }
   
    public boolean effectiveBooleanValue() throws XPathException {
        throw new XPathException(ErrorCodes.FORG0006, "value of type " + Type.getTypeName(getType()) +
            " has no boolean value.");
    }
View Full Code Here

  public IntegerValue(long value, int type) throws XPathException {
    this(value);
    this.type = type;
    if (!checkType(value, type))
      {throw new XPathException(
        "Value is not a valid integer for type " + Type.getTypeName(type));}
  }
View Full Code Here

  public IntegerValue(String stringValue) throws XPathException {
    try {
      value = new BigInteger(StringValue.trimWhitespace(stringValue)); // Long.parseLong(stringValue);
    } catch (final NumberFormatException e) {
        throw new XPathException(ErrorCodes.FORG0001,
          "failed to convert '" + stringValue + "' to an integer: " + e.getMessage(), e);
//      }
    }
  }
View Full Code Here

  public IntegerValue(String stringValue, int requiredType) throws XPathException {
    this.type = requiredType;
    try {
      value =  new BigInteger(StringValue.trimWhitespace(stringValue)); // Long.parseLong(stringValue);
      if (!(checkType(value, type)))
        {throw new XPathException(ErrorCodes.FORG0001, "can not convert '" +
            stringValue + "' to " + Type.getTypeName(type));}
    } catch (final NumberFormatException e) {
      throw new XPathException(ErrorCodes.FORG0001, "can not convert '" +
          stringValue + "' to " + Type.getTypeName(type));
    }
  }
View Full Code Here

                case Type.UNSIGNED_BYTE :
                        return value.compareTo(ZERO_BIGINTEGER) >= 0 &&
        value.compareTo(LARGEST_UNSIGNED_BYTE) <= 0;
            }
           
            throw new XPathException("Unknown type: " + Type.getTypeName(type));
  }
View Full Code Here

      case Type.UNSIGNED_BYTE :
        return value > -1 && value <= 255;
      case Type.POSITIVE_INTEGER :
        return value > 0; // jmv >= 0;
    }
    throw new XPathException("Unknown type: " + Type.getTypeName(type));
  }
View Full Code Here

      case Type.STRING :
        return new StringValue(getStringValue());
      case Type.BOOLEAN :
        return (value.compareTo(ZERO_BIGINTEGER) == 0 ) ? BooleanValue.FALSE : BooleanValue.TRUE;
      default :
        throw new XPathException(ErrorCodes.FORG0001,
          "cannot convert '"
                    +  Type.getTypeName(this.getType())
                    + " ("
                    + value
                    + ")' into "
View Full Code Here

   * @see org.exist.xquery.value.NumericValue#idiv(org.exist.xquery.value.NumericValue)
   */
  public ComputableValue div(ComputableValue other) throws XPathException {
    if (other instanceof IntegerValue) {
      if (((IntegerValue) other).isZero())
        {throw new XPathException(ErrorCodes.FOAR0001, "division by zero");}
      //http://www.w3.org/TR/xpath20/#mapping : numeric; but xs:decimal if both operands are xs:integer
      final BigDecimal d = new BigDecimal(value);      
      final BigDecimal od = new BigDecimal(((IntegerValue) other).value);
      final int scale = Math.max(18, Math.max(d.scale(), od.scale()))
      return new DecimalValue(d.divide(od, scale, BigDecimal.ROUND_HALF_DOWN));
View Full Code Here

  }

  public IntegerValue idiv(NumericValue other) throws XPathException {
    if (other.isZero())
      //If the divisor is (positive or negative) zero, then an error is raised [err:FOAR0001]
        {throw new XPathException(ErrorCodes.FOAR0001, "division by zero");}   
    final ComputableValue result = div(other);
    return new IntegerValue(((IntegerValue)result.convertTo(Type.INTEGER)).getLong());   
  }
View Full Code Here

TOP

Related Classes of org.exist.xquery.XPathException$FunctionStackElement

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.