Package argo.jdom

Examples of argo.jdom.JsonNode


        switch (jsonNode.getType()) {
            case ARRAY:
                writer.append('[');
                final Iterator<JsonNode> elements = jsonNode.getElements().iterator();
                while (elements.hasNext()) {
                    final JsonNode node = elements.next();
                    writer.println();
                    addTabs(writer, indent + 1);
                    formatJsonNode(node, writer, indent + 1);
                    if (elements.hasNext()) {
                        writer.append(",");
View Full Code Here


    private String annotateConstants(String text)
    {
        Matcher rootMatch = CALL_REGEX.matcher(text);
        String pack, method, fullCall;
        JsonNode listNode;
        StringBuffer out = new StringBuffer(text.length());
        StringBuffer innerOut;

        // search with regex.
        while (rootMatch.find())
        {
            // helper variables
            fullCall = rootMatch.group();
            pack = rootMatch.group(1);
            method = rootMatch.group(2);

            Matcher constantMatcher = CONSTANT_REGEX.matcher(fullCall);
            innerOut = new StringBuffer(fullCall.length());

            // search for hardcoded numbers
            while (constantMatcher.find())
            {
                // helper variables and return variable.
                String constant = constantMatcher.group();
                String answer = null;

                // iterrate over the JSON
                for (JsonNode group : json.getElements())
                {
                    // the list part object
                    listNode = group.getElements().get(0);

                    // ensure that the package and method are defined
                    if (listNode.isNode(pack) && jsonArrayContains(listNode.getArrayNode(pack), method))
                    {
                        // now the map part object
                        listNode = group.getElements().get(1);

                        // itterrate through the map.
                        for (Map.Entry<JsonStringNode, JsonNode> entry : listNode.getFields().entrySet())
                        {
                            // find the actual constant for the number from the regex
                            if (entry.getValue().isNode(constant))
                            {
                                // construct the final line
View Full Code Here

    protected String getServerClassPath(File json)
    {
        try
        {
            JsonNode node = Constants.PARSER.parse(Files.newReader(json, Charset.defaultCharset()));

            StringBuilder buf = new StringBuilder();

            for (JsonNode lib : node.getArrayNode("versionInfo", "libraries"))
            {
                if (lib.isNode("serverreq") && lib.getBooleanValue("serverreq"))
                {
                    String[] pts = lib.getStringValue("name").split(":");
                    buf.append(String.format("libraries/%s/%s/%s/%s-%s.jar ", pts[0].replace('.', '/'), pts[1], pts[2], pts[1], pts[2]));
View Full Code Here

        writeFile();
    }

    private void parseJson() throws IOException, InvalidSyntaxException
    {
        JsonNode node = Constants.PARSER.parse(Files.newReader(getJson(), Charset.defaultCharset()));

        for (JsonNode lib : node.getArrayNode("libraries"))
        {
            if (lib.getStringValue("name").contains("fixed") || lib.isNode("natives") || lib.isNode("extract"))
            {
                continue;
            }
View Full Code Here

        switch (jsonNode.getType()) {
            case ARRAY:
                writer.append('[');
                final Iterator<JsonNode> elements = jsonNode.getElements().iterator();
                while (elements.hasNext()) {
                    final JsonNode node = elements.next();
                    writer.println();
                    addTabs(writer, indent + 1);
                    formatJsonNode(node, writer, indent + 1);
                    if (elements.hasNext()) {
                        writer.append(",");
View Full Code Here

TOP

Related Classes of argo.jdom.JsonNode

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.