Package org.mvel2.compiler

Examples of org.mvel2.compiler.PropertyVerifier


            }

            if ( lastType == null || "java.lang.Object".equals( lastType.getName() ) || "java.lang.Class".equals( lastType.getName() ) ) {
                // attempt to use the property verifier to get
                // a better type  resolution (a recommend by cbrock, though egress gives consistent results)
                lastType = new PropertyVerifier( macroMvel,
                                                 compilationContext ).analyze();
            }

            if ( lastType == null ) {
                lastType = Object.class;
View Full Code Here


            }

            if ( lastType == null || "java.lang.Object".equals( lastType.getName() ) || "java.lang.Class".equals( lastType.getName() ) ) {
                // attempt to use the property verifier to get
                // a better type  resolution (a recommend by cbrock, though egress gives consistent results)
                lastType = new PropertyVerifier( expr, initialContext ).analyze();
            }

            if ( lastType == null ) {
                lastType = Object.class;
            }
View Full Code Here

    }
    return candidate;
  }

  public static Class getReturnType(Class clazz, String property, ParserContext ctx) {
    return new PropertyVerifier(property, ctx, clazz).analyze();
  }
View Full Code Here

            String residualProperty =
                cnsResid[1].trim();

            if (residualProperty.length() == 0) return;

            this.egressType = new PropertyVerifier(residualProperty, pCtx, egressType).analyze();
          }
        }
      }
    }
  }
View Full Code Here

            String residualProperty =
                    cnsResid[1].trim();

            if (residualProperty.length() == 0) return;

            this.egressType = new PropertyVerifier(residualProperty, pCtx, egressType).analyze();
          }
        }
      }
    }
  }
View Full Code Here

    }
    return null;
  }

  public static Class getReturnType(Class clazz, String property, ParserContext ctx) {
    return new PropertyVerifier(property, ctx, clazz).analyze();
  }
View Full Code Here

    char[] root = null;

    int split = findLastUnion();

    PropertyVerifier verifier = new PropertyVerifier(property, this.pCtx = pCtx);

    if (split != -1) {
      root = subset(property, 0, split++);
      //todo: must use the property verifier.
      property = subset(property, split, property.length - split);
    }

    if (root != null) {
      this.length = end = (this.expr = root).length;

      compileGetChain();
      ctx = this.val;
    }

    if (ctx == null) {
      throw new PropertyAccessException("could not access property: " + new String(property, this.start, length) + "; parent is null: "
          + new String(expr), expr, this.start);
    }

    try {
      this.length = end = (this.expr = property).length;
      int st;
      this.cursor = st = 0
      ;

      skipWhitespace();

      if (collection) {
        st = cursor;

        if (cursor == end)
          throw new PropertyAccessException("unterminated '['", expr, this.start);

        if (scanTo(']'))
          throw new PropertyAccessException("unterminated '['", expr, this.start);

        String ex = new String(property, st, cursor - st);

        if (ctx instanceof Map) {
          if (MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING && hasPropertyHandler(Map.class)) {
            propHandlerSet(ex, ctx, Map.class, value);
          }
          else {
            //noinspection unchecked
            ((Map) ctx).put(eval(ex, ctx, variableFactory), convert(value, returnType = verifier.analyze()));

            addAccessorNode(new MapAccessorNest(ex, returnType));
          }

          return rootNode;
        }
        else if (ctx instanceof List) {
          if (MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING && hasPropertyHandler(List.class)) {
            propHandlerSet(ex, ctx, List.class, value);
          }
          else {
            //noinspection unchecked
            ((List) ctx).set(eval(ex, ctx, variableFactory, Integer.class), convert(value, returnType = verifier.analyze()));

            addAccessorNode(new ListAccessorNest(ex, returnType));
          }

          return rootNode;
View Full Code Here

      }

      val = curr;

      if (pCtx.isStrictTypeEnforcement()) {
        this.returnType = new PropertyVerifier(this.expr, start, length, pCtx).analyze();
      }

      return rootNode;
    }
    catch (InvocationTargetException e) {
View Full Code Here

            }

            if ( lastType == null || "java.lang.Object".equals( lastType.getName() ) || "java.lang.Class".equals( lastType.getName() ) ) {
                // attempt to use the property verifier to get
                // a better type  resolution (a recommend by cbrock, though egress gives consistent results)
                lastType = new PropertyVerifier( expr, initialContext ).analyze();
            }

            if ( lastType == null ) {
                lastType = Object.class;
            }
View Full Code Here

            }

            if ( lastType == null || "java.lang.Object".equals( lastType.getName() ) || "java.lang.Class".equals( lastType.getName() ) ) {
                // attempt to use the property verifier to get
                // a better type  resolution (a recommend by cbrock, though egress gives consistent results)
                lastType = new PropertyVerifier( expr, initialContext ).analyze();
            }

            if ( lastType == null ) {
                lastType = Object.class;
            }
View Full Code Here

TOP

Related Classes of org.mvel2.compiler.PropertyVerifier

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.