Package cc.plural.jsonij

Examples of cc.plural.jsonij.Value


       
        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());
        Matcher matcher = pattern.matcher(matchValue.getString());
       
        if(matcher.matches()) {
            return matchValue;
        } else {
            return null;
View Full Code Here


        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(short[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(Short[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(long[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(Long[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(String[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(Object[] a) throws JSONMarshalerException {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

*/
public class JSONDocumentMarshaler {

    public Object marshalJSONDocument(JSON json, Class<?> objectClass) throws JSONMarshalerException {
        Object resultObject = null;
        Value jsonRoot = json.getRoot();
        if (jsonRoot.type() == Value.TYPE.OBJECT) {
            JSON.Object<CharSequence, Value> jsonObjectRoot = (JSON.Object<CharSequence, Value>) jsonRoot;
            resultObject = marshalJSONDocumentObject(jsonObjectRoot, objectClass);
        } else if (jsonRoot.type() == Value.TYPE.ARRAY) {
            JSON.Array<Value> jsonArrayRoot = (JSON.Array<Value>) jsonRoot;
            resultObject = marshalJSONDocumentArray(jsonArrayRoot, objectClass);
        } else {
            throw new RuntimeException("Not an Object or Array Type.");
        }
View Full Code Here

            for (Entry<CharSequence, Value> documentPropertyEntry : jsonObject.entrySet()) {
                CharSequence key = documentPropertyEntry.getKey();
                if (inspection.hasProperty(key.toString())) {
                    ClassProperty inspectorProperty = inspection.getProperty(key.toString());
                    Value documentValue = documentPropertyEntry.getValue();
                    try {
                        marshalJSONValue(documentValue, object, inspectorProperty);
                    } catch (IllegalAccessException ex) {
                        Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IllegalArgumentException ex) {
View Full Code Here

        } else {
            Class<?> componentClass = objectClass.getComponentType();
            ReflectType componentType = ReflectType.inspectObjectType(componentClass);
            Object array = Array.newInstance(componentClass, size);
            for (int i = 0; i < size; i++) {
                Value value = jsonArray.get(i);
                if (value.getValueType() == Value.TYPE.OBJECT) {
                    Array.set(array, i, marshalJSONDocumentObject((JSON.Object<CharSequence, Value>) value, componentClass));
                } else if (value.getValueType() == Value.TYPE.ARRAY) {
                    Array.set(array, i, marshalJSONDocumentArray((JSON.Array<Value>) value, componentClass));
                } else if (componentType == ReflectType.INTEGER) {
                    Array.set(array, i, jsonArray.get(i).getNumber().intValue());
                } else if (componentType == ReflectType.FLOAT) {
                    Array.set(array, i, jsonArray.get(i).getNumber().floatValue());
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.Value

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.