Package org.datanucleus.query.expression

Examples of org.datanucleus.query.expression.Literal


                Field fld = peil.getLiteralField();
                try
                {
                    // Get the value of the static field
                    Object value = fld.get(null);
                    expr[i] = new Literal(value);
                    expr[i].bind();
                }
                catch (Exception e)
                {
                    throw new NucleusUserException("Error processing static field " + fld.getName(), e);
View Full Code Here


  private void handleMatchesOperation(InvokeExpression invocation, Expression expr,
                                      QueryData qd) {
    Expression param = (Expression) invocation.getArguments().get(0);
    if (expr.getLeft() instanceof PrimaryExpression && param instanceof Literal) {
      String matchesExpr = getPrefixFromMatchesExpression(((Literal) param).getLiteral());
      addPrefix((PrimaryExpression) expr.getLeft(), new Literal(matchesExpr), matchesExpr, qd);
    } else if (expr.getLeft() instanceof PrimaryExpression &&
               param instanceof ParameterExpression) {
      ParameterExpression parameterExpression = (ParameterExpression) param;
      Object parameterValue = getParameterValue(qd, parameterExpression);
      String matchesExpr = getPrefixFromMatchesExpression(parameterValue);
      addPrefix((PrimaryExpression) expr.getLeft(), new Literal(matchesExpr), matchesExpr, qd);
    } else {
      // We don't know what this is.
      throw newUnsupportedQueryMethodException(invocation);
    }
  }
View Full Code Here

    byte[] bytes = val.getBytes();
    for (int i = bytes.length - 1; i >= 0; i--) {
      byte[] endKey = new byte[i + 1];
      System.arraycopy(bytes, 0, endKey, 0, i + 1);
      if (++endKey[i] != 0) {
        return new Literal(new String(endKey));
      }
    }
    return null;
  }
View Full Code Here

        arg1 = QueryUtils.getStringValue(arg1Obj);

        Boolean result = null;
        if (expr.getArguments().size() == 2)
        {
            Literal param2 = (Literal)expr.getArguments().get(1);
            int arg2 = -1;
            if (param2.getLiteral() instanceof Number)
            {
                arg2 = ((Number)param2.getLiteral()).intValue();
            }
            result = ((String)invokedValue).startsWith(arg1, arg2) ? Boolean.TRUE : Boolean.FALSE;
        }
        else
        {
View Full Code Here

        {
            throw new NucleusException(LOCALISER.msg("021011", method, invokedValue.getClass().getName()));
        }

        int arg1 = -1;
        Literal param1 = (Literal)expr.getArguments().get(0);
        if (param1.getLiteral() instanceof Number)
        {
            arg1 = ((Number)param1.getLiteral()).intValue();
        }

        String result = null;
        if (expr.getArguments().size() == 2)
        {
            Literal param2 = (Literal)expr.getArguments().get(1);
            int arg2 = -1;
            if (param2.getLiteral() instanceof Number)
            {
                arg2 = ((Number)param2.getLiteral()).intValue();
            }
            result = ((String)invokedValue).substring(arg1, arg2);
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.datanucleus.query.expression.Literal

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.