Package jsonij.json.jpath

Examples of jsonij.json.jpath.JPathRuntimeException


    }

    @Override
    public Value evaluate(FunctionArgument[] args, Value value) {
        if(Array.getLength(args) != 2) {
            throw new JPathRuntimeException("InvalidArgCount");
        }
       
        if(args[0] == null || args[0].type != ARGUMENT_TYPE.ATTRIBUTE) {
            throw new JPathRuntimeException("InvalidArg", args[0]);
        }
       
        if(args[1] == null || args[1].type != ARGUMENT_TYPE.VALUE) {
            throw new JPathRuntimeException("InvalidArg", args[1]);
        }
       
        String attributeName = ((AttributeArgument) args[0]).getAttributeName();
       
        if(!value.has(attributeName)) {
            return null;
        }
       
        Value regexValue = ((ValueArgument) args[1]).getValue();
       
        if(regexValue.getValueType() != Value.TYPE.STRING) {
            throw new JPathRuntimeException("InvalidArg", args[1]);
        }
       
        Value matchValue = value.get(attributeName);
       
        Pattern pattern = Pattern.compile(regexValue.getString());
View Full Code Here

TOP

Related Classes of jsonij.json.jpath.JPathRuntimeException

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.