Liking cljdoc? Tell your friends :D

javaparser-clj.doc.examples

This namespace is a hack to force cljdoc to display generated docs.

This namespace is a hack to force cljdoc to display generated docs.
raw docstring

spring-controllerclj

The following java code:


package foo;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Component
@RestController
public class Bar {
	@PostMapping("/bar")
	public String bar() {
		return "bar";
	}
}

will turn into this after running it through read-java (with :range stripped):

{:node/kind :compilation-unit,
 :imports
 [{:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "Component",
    :qualifier ["org" "springframework" "stereotype"]}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "PostMapping",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "RestController",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]}}],
 :package
 {:node/kind :package-declaration,
  :name {:identifier "foo", :qualifier []}},
 :types
 [{:name "Bar",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :annotations
   [{:node/kind :marker-annotation-expr,
     :name {:identifier "Component", :qualifier []}}
    {:node/kind :marker-annotation-expr,
     :name {:identifier "RestController", :qualifier []}}],
   :interface? false,
   :members
   [{:name "bar",
     :type {:node/kind :class-or-interface-type, :name "String"},
     :modifiers [:public],
     :node/kind :method-declaration,
     :annotations
     [{:node/kind :single-member-annotation-expr,
       :member-value {:node/kind :string-literal-expr, :value "/bar"},
       :name {:identifier "PostMapping", :qualifier []}}],
     :body
     {:node/kind :block-stmt,
      :statements
      [{:node/kind :return-stmt,
        :expression
        {:node/kind :string-literal-expr, :value "bar"}}]}}]}]}

In case you want to see the entire thing with ranges:

{:node/kind :compilation-unit,
 :imports
 [{:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "Component",
    :qualifier ["org" "springframework" "stereotype"]},
   :range {:begin {:line 4, :column 1}, :end {:line 4, :column 48}}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "PostMapping",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]},
   :range {:begin {:line 5, :column 1}, :end {:line 5, :column 59}}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "RestController",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]},
   :range {:begin {:line 6, :column 1}, :end {:line 6, :column 62}}}],
 :package
 {:node/kind :package-declaration,
  :name {:identifier "foo", :qualifier []},
  :range {:begin {:line 2, :column 1}, :end {:line 2, :column 12}}},
 :range {:begin {:line 1, :column 1}, :end {:line 15, :column 1}},
 :types
 [{:name "Bar",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :annotations
   [{:node/kind :marker-annotation-expr,
     :name {:identifier "Component", :qualifier []},
     :range {:begin {:line 8, :column 1}, :end {:line 8, :column 10}}}
    {:node/kind :marker-annotation-expr,
     :name {:identifier "RestController", :qualifier []},
     :range
     {:begin {:line 9, :column 1}, :end {:line 9, :column 15}}}],
   :interface? false,
   :members
   [{:name "bar",
     :type
     {:node/kind :class-or-interface-type,
      :name "String",
      :range
      {:begin {:line 12, :column 9}, :end {:line 12, :column 14}}},
     :modifiers [:public],
     :node/kind :method-declaration,
     :annotations
     [{:node/kind :single-member-annotation-expr,
       :member-value
       {:node/kind :string-literal-expr,
        :range
        {:begin {:line 11, :column 15}, :end {:line 11, :column 20}},
        :value "/bar"},
       :name {:identifier "PostMapping", :qualifier []},
       :range
       {:begin {:line 11, :column 2}, :end {:line 11, :column 21}}}],
     :body
     {:node/kind :block-stmt,
      :range
      {:begin {:line 12, :column 22}, :end {:line 14, :column 2}},
      :statements
      [{:node/kind :return-stmt,
        :expression
        {:node/kind :string-literal-expr,
         :range
         {:begin {:line 13, :column 10}, :end {:line 13, :column 14}},
         :value "bar"},
        :range
        {:begin {:line 13, :column 3}, :end {:line 13, :column 15}}}]},
     :range
     {:begin {:line 11, :column 2}, :end {:line 14, :column 2}}}],
   :range {:begin {:line 8, :column 1}, :end {:line 15, :column 1}}}]}
The following java code:
```java

package foo;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Component
@RestController
public class Bar {
	@PostMapping("/bar")
	public String bar() {
		return "bar";
	}
}
```
will turn into this after running it through `read-java` (with `:range` stripped):
```clojure
{:node/kind :compilation-unit,
 :imports
 [{:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "Component",
    :qualifier ["org" "springframework" "stereotype"]}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "PostMapping",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "RestController",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]}}],
 :package
 {:node/kind :package-declaration,
  :name {:identifier "foo", :qualifier []}},
 :types
 [{:name "Bar",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :annotations
   [{:node/kind :marker-annotation-expr,
     :name {:identifier "Component", :qualifier []}}
    {:node/kind :marker-annotation-expr,
     :name {:identifier "RestController", :qualifier []}}],
   :interface? false,
   :members
   [{:name "bar",
     :type {:node/kind :class-or-interface-type, :name "String"},
     :modifiers [:public],
     :node/kind :method-declaration,
     :annotations
     [{:node/kind :single-member-annotation-expr,
       :member-value {:node/kind :string-literal-expr, :value "/bar"},
       :name {:identifier "PostMapping", :qualifier []}}],
     :body
     {:node/kind :block-stmt,
      :statements
      [{:node/kind :return-stmt,
        :expression
        {:node/kind :string-literal-expr, :value "bar"}}]}}]}]}
```

In case you want to see the entire thing with ranges:
```clojure
{:node/kind :compilation-unit,
 :imports
 [{:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "Component",
    :qualifier ["org" "springframework" "stereotype"]},
   :range {:begin {:line 4, :column 1}, :end {:line 4, :column 48}}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "PostMapping",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]},
   :range {:begin {:line 5, :column 1}, :end {:line 5, :column 59}}}
  {:node/kind :import-declaration,
   :asterisk? false,
   :static? false,
   :name
   {:identifier "RestController",
    :qualifier ["org" "springframework" "web" "bind" "annotation"]},
   :range {:begin {:line 6, :column 1}, :end {:line 6, :column 62}}}],
 :package
 {:node/kind :package-declaration,
  :name {:identifier "foo", :qualifier []},
  :range {:begin {:line 2, :column 1}, :end {:line 2, :column 12}}},
 :range {:begin {:line 1, :column 1}, :end {:line 15, :column 1}},
 :types
 [{:name "Bar",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :annotations
   [{:node/kind :marker-annotation-expr,
     :name {:identifier "Component", :qualifier []},
     :range {:begin {:line 8, :column 1}, :end {:line 8, :column 10}}}
    {:node/kind :marker-annotation-expr,
     :name {:identifier "RestController", :qualifier []},
     :range
     {:begin {:line 9, :column 1}, :end {:line 9, :column 15}}}],
   :interface? false,
   :members
   [{:name "bar",
     :type
     {:node/kind :class-or-interface-type,
      :name "String",
      :range
      {:begin {:line 12, :column 9}, :end {:line 12, :column 14}}},
     :modifiers [:public],
     :node/kind :method-declaration,
     :annotations
     [{:node/kind :single-member-annotation-expr,
       :member-value
       {:node/kind :string-literal-expr,
        :range
        {:begin {:line 11, :column 15}, :end {:line 11, :column 20}},
        :value "/bar"},
       :name {:identifier "PostMapping", :qualifier []},
       :range
       {:begin {:line 11, :column 2}, :end {:line 11, :column 21}}}],
     :body
     {:node/kind :block-stmt,
      :range
      {:begin {:line 12, :column 22}, :end {:line 14, :column 2}},
      :statements
      [{:node/kind :return-stmt,
        :expression
        {:node/kind :string-literal-expr,
         :range
         {:begin {:line 13, :column 10}, :end {:line 13, :column 14}},
         :value "bar"},
        :range
        {:begin {:line 13, :column 3}, :end {:line 13, :column 15}}}]},
     :range
     {:begin {:line 11, :column 2}, :end {:line 14, :column 2}}}],
   :range {:begin {:line 8, :column 1}, :end {:line 15, :column 1}}}]}
```
raw docstring

typical-mainclj

The following java code:


package a.b.c;

public class TypicalMain {
	public static void main(String[] args) {
		System.out.println("Hello, World!");
	}
}

will turn into this after running it through read-java (with :range stripped):

{:node/kind :compilation-unit,
 :package
 {:node/kind :package-declaration,
  :name {:identifier "c", :qualifier ["a" "b"]}},
 :types
 [{:name "TypicalMain",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :interface? false,
   :members
   [{:name "main",
     :type {:node/kind :void-type},
     :modifiers [:public :static],
     :node/kind :method-declaration,
     :body
     {:node/kind :block-stmt,
      :statements
      [{:node/kind :expression-stmt,
        :expression
        {:node/kind :method-call-expr,
         :arguments
         [{:node/kind :string-literal-expr, :value "Hello, World!"}],
         :name "println",
         :scope
         {:node/kind :field-access-expr,
          :name "out",
          :scope {:node/kind :name-expr, :name "System"}}}}]},
     :parameters
     [{:name "args",
       :var-args? false,
       :type
       {:node/kind :array-type,
        :component-type
        {:node/kind :class-or-interface-type, :name "String"},
        :origin :type},
       :node/kind :parameter}]}]}]}

In case you want to see the entire thing with ranges:

{:node/kind :compilation-unit,
 :package
 {:node/kind :package-declaration,
  :name {:identifier "c", :qualifier ["a" "b"]},
  :range {:begin {:line 2, :column 1}, :end {:line 2, :column 14}}},
 :range {:begin {:line 1, :column 1}, :end {:line 8, :column 1}},
 :types
 [{:name "TypicalMain",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :interface? false,
   :members
   [{:name "main",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 5, :column 16}, :end {:line 5, :column 19}}},
     :modifiers [:public :static],
     :node/kind :method-declaration,
     :body
     {:node/kind :block-stmt,
      :range {:begin {:line 5, :column 41}, :end {:line 7, :column 2}},
      :statements
      [{:node/kind :expression-stmt,
        :expression
        {:node/kind :method-call-expr,
         :arguments
         [{:node/kind :string-literal-expr,
           :range
           {:begin {:line 6, :column 22}, :end {:line 6, :column 36}},
           :value "Hello, World!"}],
         :name "println",
         :range
         {:begin {:line 6, :column 3}, :end {:line 6, :column 37}},
         :scope
         {:node/kind :field-access-expr,
          :name "out",
          :range
          {:begin {:line 6, :column 3}, :end {:line 6, :column 12}},
          :scope
          {:node/kind :name-expr,
           :name "System",
           :range
           {:begin {:line 6, :column 3}, :end {:line 6, :column 8}}}}},
        :range
        {:begin {:line 6, :column 3}, :end {:line 6, :column 38}}}]},
     :parameters
     [{:name "args",
       :var-args? false,
       :type
       {:node/kind :array-type,
        :component-type
        {:node/kind :class-or-interface-type,
         :name "String",
         :range
         {:begin {:line 5, :column 26}, :end {:line 5, :column 31}}},
        :origin :type,
        :range
        {:begin {:line 5, :column 26}, :end {:line 5, :column 33}}},
       :node/kind :parameter,
       :range
       {:begin {:line 5, :column 26}, :end {:line 5, :column 38}}}],
     :range {:begin {:line 5, :column 2}, :end {:line 7, :column 2}}}],
   :range {:begin {:line 4, :column 1}, :end {:line 8, :column 1}}}]}
The following java code:
```java

package a.b.c;

public class TypicalMain {
	public static void main(String[] args) {
		System.out.println("Hello, World!");
	}
}
```
will turn into this after running it through `read-java` (with `:range` stripped):
```clojure
{:node/kind :compilation-unit,
 :package
 {:node/kind :package-declaration,
  :name {:identifier "c", :qualifier ["a" "b"]}},
 :types
 [{:name "TypicalMain",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :interface? false,
   :members
   [{:name "main",
     :type {:node/kind :void-type},
     :modifiers [:public :static],
     :node/kind :method-declaration,
     :body
     {:node/kind :block-stmt,
      :statements
      [{:node/kind :expression-stmt,
        :expression
        {:node/kind :method-call-expr,
         :arguments
         [{:node/kind :string-literal-expr, :value "Hello, World!"}],
         :name "println",
         :scope
         {:node/kind :field-access-expr,
          :name "out",
          :scope {:node/kind :name-expr, :name "System"}}}}]},
     :parameters
     [{:name "args",
       :var-args? false,
       :type
       {:node/kind :array-type,
        :component-type
        {:node/kind :class-or-interface-type, :name "String"},
        :origin :type},
       :node/kind :parameter}]}]}]}
```

In case you want to see the entire thing with ranges:
```clojure
{:node/kind :compilation-unit,
 :package
 {:node/kind :package-declaration,
  :name {:identifier "c", :qualifier ["a" "b"]},
  :range {:begin {:line 2, :column 1}, :end {:line 2, :column 14}}},
 :range {:begin {:line 1, :column 1}, :end {:line 8, :column 1}},
 :types
 [{:name "TypicalMain",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :interface? false,
   :members
   [{:name "main",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 5, :column 16}, :end {:line 5, :column 19}}},
     :modifiers [:public :static],
     :node/kind :method-declaration,
     :body
     {:node/kind :block-stmt,
      :range {:begin {:line 5, :column 41}, :end {:line 7, :column 2}},
      :statements
      [{:node/kind :expression-stmt,
        :expression
        {:node/kind :method-call-expr,
         :arguments
         [{:node/kind :string-literal-expr,
           :range
           {:begin {:line 6, :column 22}, :end {:line 6, :column 36}},
           :value "Hello, World!"}],
         :name "println",
         :range
         {:begin {:line 6, :column 3}, :end {:line 6, :column 37}},
         :scope
         {:node/kind :field-access-expr,
          :name "out",
          :range
          {:begin {:line 6, :column 3}, :end {:line 6, :column 12}},
          :scope
          {:node/kind :name-expr,
           :name "System",
           :range
           {:begin {:line 6, :column 3}, :end {:line 6, :column 8}}}}},
        :range
        {:begin {:line 6, :column 3}, :end {:line 6, :column 38}}}]},
     :parameters
     [{:name "args",
       :var-args? false,
       :type
       {:node/kind :array-type,
        :component-type
        {:node/kind :class-or-interface-type,
         :name "String",
         :range
         {:begin {:line 5, :column 26}, :end {:line 5, :column 31}}},
        :origin :type,
        :range
        {:begin {:line 5, :column 26}, :end {:line 5, :column 33}}},
       :node/kind :parameter,
       :range
       {:begin {:line 5, :column 26}, :end {:line 5, :column 38}}}],
     :range {:begin {:line 5, :column 2}, :end {:line 7, :column 2}}}],
   :range {:begin {:line 4, :column 1}, :end {:line 8, :column 1}}}]}
```
raw docstring

well-documented-interfaceclj

The following java code:


/*
 * Copyright (C) 2007-2010 Júlio Vilmar Gesser.
 * Copyright (C) 2011, 2013-2021 The JavaParser Team.
 *
 * This file is part of JavaParser.
 *
 * JavaParser can be used either under the terms of
 * a) the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * b) the terms of the Apache License
 *
 * You should have received a copy of both licenses in LICENCE.LGPL and
 * LICENCE.APACHE. Please refer to those files for details.
 *
 * JavaParser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 */

package com.github.javaparser.ast.observer;

/**
 * Observable element.
 */
public interface Observable {

    /**
     * Register an observer.
     */
    void register(AstObserver observer);

    /**
     * Unregister an observer. If the given observer was not registered there are no effects.
     */
    void unregister(AstObserver observer);

    /**
     * Was this observer registered?
     * Note that equals is used to determine if the given observer was registered.
     */
    boolean isRegistered(AstObserver observer);
}

will turn into this after running it through read-java (with :range stripped):

{:node/kind :compilation-unit,
 :comment
 {:node/kind :block-comment,
  :content
  "\n * Copyright (C) 2007-2010 Júlio Vilmar Gesser.\n * Copyright (C) 2011, 2013-2021 The JavaParser Team.\n *\n * This file is part of JavaParser.\n *\n * JavaParser can be used either under the terms of\n * a) the GNU Lesser General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n * b) the terms of the Apache License\n *\n * You should have received a copy of both licenses in LICENCE.LGPL and\n * LICENCE.APACHE. Please refer to those files for details.\n *\n * JavaParser is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Lesser General Public License for more details.\n "},
 :package
 {:node/kind :package-declaration,
  :name
  {:identifier "observer",
   :qualifier ["com" "github" "javaparser" "ast"]}},
 :types
 [{:name "Observable",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :comment
   {:node/kind :javadoc-comment,
    :content "\n * Observable element.\n "},
   :interface? true,
   :members
   [{:name "register",
     :type {:node/kind :void-type},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content "\n     * Register an observer.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}
    {:name "unregister",
     :type {:node/kind :void-type},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Unregister an observer. If the given observer was not registered there are no effects.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}
    {:name "isRegistered",
     :type {:node/kind :primitive-type, :type :boolean},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Was this observer registered?\n     * Note that equals is used to determine if the given observer was registered.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}]}]}

In case you want to see the entire thing with ranges:

{:node/kind :compilation-unit,
 :comment
 {:node/kind :block-comment,
  :content
  "\n * Copyright (C) 2007-2010 Júlio Vilmar Gesser.\n * Copyright (C) 2011, 2013-2021 The JavaParser Team.\n *\n * This file is part of JavaParser.\n *\n * JavaParser can be used either under the terms of\n * a) the GNU Lesser General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n * b) the terms of the Apache License\n *\n * You should have received a copy of both licenses in LICENCE.LGPL and\n * LICENCE.APACHE. Please refer to those files for details.\n *\n * JavaParser is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Lesser General Public License for more details.\n ",
  :range {:begin {:line 2, :column 1}, :end {:line 21, :column 3}}},
 :package
 {:node/kind :package-declaration,
  :name
  {:identifier "observer",
   :qualifier ["com" "github" "javaparser" "ast"]},
  :range {:begin {:line 23, :column 1}, :end {:line 23, :column 43}}},
 :range {:begin {:line 1, :column 1}, :end {:line 45, :column 1}},
 :types
 [{:name "Observable",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :comment
   {:node/kind :javadoc-comment,
    :content "\n * Observable element.\n ",
    :range {:begin {:line 25, :column 1}, :end {:line 27, :column 3}}},
   :interface? true,
   :members
   [{:name "register",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 33, :column 5}, :end {:line 33, :column 8}}},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content "\n     * Register an observer.\n     ",
      :range
      {:begin {:line 30, :column 5}, :end {:line 32, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 33, :column 19}, :end {:line 33, :column 29}}},
       :node/kind :parameter,
       :range
       {:begin {:line 33, :column 19}, :end {:line 33, :column 38}}}],
     :range
     {:begin {:line 33, :column 5}, :end {:line 33, :column 40}}}
    {:name "unregister",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 38, :column 5}, :end {:line 38, :column 8}}},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Unregister an observer. If the given observer was not registered there are no effects.\n     ",
      :range
      {:begin {:line 35, :column 5}, :end {:line 37, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 38, :column 21}, :end {:line 38, :column 31}}},
       :node/kind :parameter,
       :range
       {:begin {:line 38, :column 21}, :end {:line 38, :column 40}}}],
     :range
     {:begin {:line 38, :column 5}, :end {:line 38, :column 42}}}
    {:name "isRegistered",
     :type
     {:node/kind :primitive-type,
      :range
      {:begin {:line 44, :column 5}, :end {:line 44, :column 11}},
      :type :boolean},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Was this observer registered?\n     * Note that equals is used to determine if the given observer was registered.\n     ",
      :range
      {:begin {:line 40, :column 5}, :end {:line 43, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 44, :column 26}, :end {:line 44, :column 36}}},
       :node/kind :parameter,
       :range
       {:begin {:line 44, :column 26}, :end {:line 44, :column 45}}}],
     :range
     {:begin {:line 44, :column 5}, :end {:line 44, :column 47}}}],
   :range {:begin {:line 28, :column 1}, :end {:line 45, :column 1}}}]}
The following java code:
```java

/*
 * Copyright (C) 2007-2010 Júlio Vilmar Gesser.
 * Copyright (C) 2011, 2013-2021 The JavaParser Team.
 *
 * This file is part of JavaParser.
 *
 * JavaParser can be used either under the terms of
 * a) the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * b) the terms of the Apache License
 *
 * You should have received a copy of both licenses in LICENCE.LGPL and
 * LICENCE.APACHE. Please refer to those files for details.
 *
 * JavaParser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 */

package com.github.javaparser.ast.observer;

/**
 * Observable element.
 */
public interface Observable {

    /**
     * Register an observer.
     */
    void register(AstObserver observer);

    /**
     * Unregister an observer. If the given observer was not registered there are no effects.
     */
    void unregister(AstObserver observer);

    /**
     * Was this observer registered?
     * Note that equals is used to determine if the given observer was registered.
     */
    boolean isRegistered(AstObserver observer);
}
```
will turn into this after running it through `read-java` (with `:range` stripped):
```clojure
{:node/kind :compilation-unit,
 :comment
 {:node/kind :block-comment,
  :content
  "\n * Copyright (C) 2007-2010 Júlio Vilmar Gesser.\n * Copyright (C) 2011, 2013-2021 The JavaParser Team.\n *\n * This file is part of JavaParser.\n *\n * JavaParser can be used either under the terms of\n * a) the GNU Lesser General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n * b) the terms of the Apache License\n *\n * You should have received a copy of both licenses in LICENCE.LGPL and\n * LICENCE.APACHE. Please refer to those files for details.\n *\n * JavaParser is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Lesser General Public License for more details.\n "},
 :package
 {:node/kind :package-declaration,
  :name
  {:identifier "observer",
   :qualifier ["com" "github" "javaparser" "ast"]}},
 :types
 [{:name "Observable",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :comment
   {:node/kind :javadoc-comment,
    :content "\n * Observable element.\n "},
   :interface? true,
   :members
   [{:name "register",
     :type {:node/kind :void-type},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content "\n     * Register an observer.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}
    {:name "unregister",
     :type {:node/kind :void-type},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Unregister an observer. If the given observer was not registered there are no effects.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}
    {:name "isRegistered",
     :type {:node/kind :primitive-type, :type :boolean},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Was this observer registered?\n     * Note that equals is used to determine if the given observer was registered.\n     "},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type, :name "AstObserver"},
       :node/kind :parameter}]}]}]}
```

In case you want to see the entire thing with ranges:
```clojure
{:node/kind :compilation-unit,
 :comment
 {:node/kind :block-comment,
  :content
  "\n * Copyright (C) 2007-2010 Júlio Vilmar Gesser.\n * Copyright (C) 2011, 2013-2021 The JavaParser Team.\n *\n * This file is part of JavaParser.\n *\n * JavaParser can be used either under the terms of\n * a) the GNU Lesser General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n * b) the terms of the Apache License\n *\n * You should have received a copy of both licenses in LICENCE.LGPL and\n * LICENCE.APACHE. Please refer to those files for details.\n *\n * JavaParser is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Lesser General Public License for more details.\n ",
  :range {:begin {:line 2, :column 1}, :end {:line 21, :column 3}}},
 :package
 {:node/kind :package-declaration,
  :name
  {:identifier "observer",
   :qualifier ["com" "github" "javaparser" "ast"]},
  :range {:begin {:line 23, :column 1}, :end {:line 23, :column 43}}},
 :range {:begin {:line 1, :column 1}, :end {:line 45, :column 1}},
 :types
 [{:name "Observable",
   :modifiers [:public],
   :node/kind :class-or-interface-declaration,
   :comment
   {:node/kind :javadoc-comment,
    :content "\n * Observable element.\n ",
    :range {:begin {:line 25, :column 1}, :end {:line 27, :column 3}}},
   :interface? true,
   :members
   [{:name "register",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 33, :column 5}, :end {:line 33, :column 8}}},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content "\n     * Register an observer.\n     ",
      :range
      {:begin {:line 30, :column 5}, :end {:line 32, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 33, :column 19}, :end {:line 33, :column 29}}},
       :node/kind :parameter,
       :range
       {:begin {:line 33, :column 19}, :end {:line 33, :column 38}}}],
     :range
     {:begin {:line 33, :column 5}, :end {:line 33, :column 40}}}
    {:name "unregister",
     :type
     {:node/kind :void-type,
      :range
      {:begin {:line 38, :column 5}, :end {:line 38, :column 8}}},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Unregister an observer. If the given observer was not registered there are no effects.\n     ",
      :range
      {:begin {:line 35, :column 5}, :end {:line 37, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 38, :column 21}, :end {:line 38, :column 31}}},
       :node/kind :parameter,
       :range
       {:begin {:line 38, :column 21}, :end {:line 38, :column 40}}}],
     :range
     {:begin {:line 38, :column 5}, :end {:line 38, :column 42}}}
    {:name "isRegistered",
     :type
     {:node/kind :primitive-type,
      :range
      {:begin {:line 44, :column 5}, :end {:line 44, :column 11}},
      :type :boolean},
     :node/kind :method-declaration,
     :comment
     {:node/kind :javadoc-comment,
      :content
      "\n     * Was this observer registered?\n     * Note that equals is used to determine if the given observer was registered.\n     ",
      :range
      {:begin {:line 40, :column 5}, :end {:line 43, :column 7}}},
     :parameters
     [{:name "observer",
       :var-args? false,
       :type
       {:node/kind :class-or-interface-type,
        :name "AstObserver",
        :range
        {:begin {:line 44, :column 26}, :end {:line 44, :column 36}}},
       :node/kind :parameter,
       :range
       {:begin {:line 44, :column 26}, :end {:line 44, :column 45}}}],
     :range
     {:begin {:line 44, :column 5}, :end {:line 44, :column 47}}}],
   :range {:begin {:line 28, :column 1}, :end {:line 45, :column 1}}}]}
```
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close