Package com.googlecode.funclate

Examples of com.googlecode.funclate.Model


                        }
                    }).toList()).toString();
        }

        public static CompletionResult fromJson(String json) {
            Model model = parse(json);
            return new CompletionResult(model.get("expression", String.class),
                    Integer.valueOf(model.get("position", String.class)),
                    sequence(model.getValues("candidates", Model.class))
                            .map(new Mapper<Model, CompletionCandidate>() {
                                public CompletionCandidate call(Model model) throws Exception {
                                    return new CompletionCandidate(model.get("value", String.class), sequence(model.getValues("forms", String.class)));
                                }
                            }));
        }
View Full Code Here


        this.port = port;
        this.client = new ClientHttpHandler();
    }

    public synchronized ExpressionTemplate template(String expression) throws Exception {
        Model model = parse(client.handle(get(url("template")).query("expression", expression).build()).entity().toString());
        return new ExpressionTemplate(model.get("template", String.class), model.get("token", String.class));
    }
View Full Code Here

        String json = client.handle(post(url("execute")).form("expression", expr).build()).entity().toString();

        if (json.isEmpty())
            return none();

        Model model = parse(json);
        Sequence<Model> logs = sequence(model.getValues("logs", Model.class));
        String expression = model.get("expression", String.class);

        return some(new EvaluationResult(expression, logs.map(modelToEvaluationLog())));
    }
View Full Code Here

        }
    }

    public synchronized Sequence<String> history() throws Exception {
        Response history = client.handle(get(url("history")).build());
        Model model = parse(history.entity().toString());
        return sequence(model.getValues("history", String.class));
    }
View Full Code Here

TOP

Related Classes of com.googlecode.funclate.Model

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.