5Code Reflect API (1.0.0)

Download OpenAPI specification:Download

API that provides various explanations for Java code

/open-api

A visualization of the openapi documentation

Responses

/explanation

Returns a structured explanation for a given selection of code of a class.

Request Body schema: application/json

Explanation request

code
required
string
object (Selection)
language
required
string (Language)
Enum: "German" "English"

Responses

Request samples

Content type
application/json
{
  • "code": "public class Test {\r\n\r\n private static int number = 5;\r\n public static void main(String[] args){\r\n printLine(Test.number);\r\n }\r\n\r\n\r\n private static void printLine(int times){\r\n for(int i = 0; i < times; i++){\r\n System.out.println(i);\r\n }\r\n }\r\n}",
  • "selection": {
    },
  • "language": "German"
}

Response samples

Content type
application/json
{
  • "components": [
    ]
}

/analysis

Returns a PMD analysis of a given class.

Request Body schema: application/json

analysis request

code
required
string
language
required
string (Language)
Enum: "German" "English"

Responses

Request samples

Content type
application/json
{
  • "code": "public class Foo_Test {}",
  • "language": "German"
}

Response samples

Content type
application/json
{
  • "lines": [
    ]
}

/similarNames

Returns a list of similar names (variables, method names etc.) of a given class.

Request Body schema: application/json

similarNames request

code
required
string

Responses

Request samples

Content type
application/json
{
  • "code": "class Foo{ \r\nvoid y(){\r\nfor(int test = 0; tist < 10; test++){}\r\n}\r\n}"
}

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

/diagram

Returns a mermaid diagram for a given selection of a class.

Request Body schema: application/json
code
required
string
object (Selection)

Responses

Request samples

Content type
application/json
{
  • "code": "public class Foo {\r\n public static void main(String[] args) {\r\n for(int i = 0; i < 10; i++){\r\n System.out.println(\"Test\");\r\n System.out.println(\"i\");\r\n System.out.println(i);\r\n\r\n }\r\n }\r\n}",
  • "selection": {
    }
}

Response samples

Content type
application/json
{
  • "diagram": "graph TD;\ninit((\"int i = 0\"))-->start((\"#32;\"));\nstart-->bedingung{\"i &lt; 10\"};\nbedingung-- \"false\" -->ende[\"#32;\"];\nbedingung-- \"true\" -->body[\"System.out.println(#quot;Test#quot;); ...\"];\nbody-->weiter[\"i++\"];\nweiter-->start;\nlinkStyle default interpolate basis;\n"
}

/parse

Returns the result of the parsing with JavaParser

Request Body schema: text/plain

Code

string

Responses

Request samples

Content type
text/plain
public class Foo {
    private int i;
}

Response samples

Content type
application/json
{
  • "!": "com.github.javaparser.ast.CompilationUnit",
  • "range": {
    },
  • "tokenRange": {
    },
  • "imports": [ ],
  • "types": [
    ]
}