Package clojure.lang

Examples of clojure.lang.Var.invoke()


    = Pattern.compile("\\(\\s*(?:in-)?ns\\s+([^\\s\\)#\\[\\'\\{]+)");

  public static String findDeclaringNamespace(String sourceText) {
    Var sexp = RT.var("paredit.parser", "sexp");
    try {
      return (String) findDeclaringNamespace((Map) sexp.invoke(sourceText));
    } catch (Exception e) {
      return null;
    }
  }
  public static String findDeclaringNamespace(Map tree) {
View Full Code Here


              // Get a reference to the gamer-generating function.
              Var gamerVar = RT.var("gamer_namespace", getClojureGamerName());

              // Call it!
              theClojureGamer = (Gamer)gamerVar.invoke();
          } catch(Exception e) {
              GamerLogger.logError("GamePlayer", "Caught exception in Clojure initialization:");
              GamerLogger.logStackTrace("GamePlayer", e);
          }
      }
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    RT.loadResourceScript("speclj/main.clj");
    Var main = RT.var("speclj.main", "-main");
    Var apply = RT.var("clojure.core", "apply");
    apply.invoke(main, args);
  }
}
View Full Code Here

            String location = PolyglotModelUtil.getLocation(options);

            final Var USE = Var.intern(RT.CLOJURE_NS, Symbol.create("use"));
            final Symbol READER = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.reader");
            final Symbol LEININGEN = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.leiningen");
            USE.invoke(READER);
            USE.invoke(LEININGEN);
            clojure.lang.Compiler.load(input, location, location);
            final Var MODEL = Var.intern(Namespace.findOrCreate(READER), Symbol.create("*MODEL*"));
            return  (Model) ((Atom) MODEL.get()).deref();
        }
View Full Code Here

            final Var USE = Var.intern(RT.CLOJURE_NS, Symbol.create("use"));
            final Symbol READER = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.reader");
            final Symbol LEININGEN = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.leiningen");
            USE.invoke(READER);
            USE.invoke(LEININGEN);
            clojure.lang.Compiler.load(input, location, location);
            final Var MODEL = Var.intern(Namespace.findOrCreate(READER), Symbol.create("*MODEL*"));
            return  (Model) ((Atom) MODEL.get()).deref();
        }
        catch (Exception e) {
View Full Code Here

    public void write(Writer writer, Map<String, Object> stringObjectMap, Model model) throws IOException {
        try {
            final Var REQUIRE = Var.intern(RT.CLOJURE_NS, Symbol.create("require"));
            final Symbol REFLECTOR = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.writer");
            REQUIRE.invoke(REFLECTOR);
            final Var WRITER = Var.intern(Namespace.findOrCreate(REFLECTOR), Symbol.create("write-model"));
            WRITER.invoke(model, writer);
        } catch (Exception e) {
            e.printStackTrace();
            // Don't use new IOException(e) because it doesn't exist in Java 5
View Full Code Here

        try {
            final Var REQUIRE = Var.intern(RT.CLOJURE_NS, Symbol.create("require"));
            final Symbol REFLECTOR = Symbol.create("org.sonatype.maven.polyglot.clojure.dsl.writer");
            REQUIRE.invoke(REFLECTOR);
            final Var WRITER = Var.intern(Namespace.findOrCreate(REFLECTOR), Symbol.create("write-model"));
            WRITER.invoke(model, writer);
        } catch (Exception e) {
            e.printStackTrace();
            // Don't use new IOException(e) because it doesn't exist in Java 5
            throw (IOException) new IOException(e.toString()).initCause(e);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.