From 71b563fada9a2d158d230bddbe0491b4890362a8 Mon Sep 17 00:00:00 2001 From: cschar Date: Tue, 11 Jun 2024 17:46:40 -0400 Subject: [PATCH] add docs --- CHANGELOG.md | 1 + README_dev_notes.md | 2 +- docs/_includes/options.md | 214 +++++++++++++++++- docs/index.markdown | 202 +---------------- .../pmode3/config/CopyPasteVoidConfig.java | 11 + .../cschar/pmode3/config/DrosteConfig.java | 20 ++ .../cschar/pmode3/config/LanternConfig.java | 31 ++- .../cschar/pmode3/config/LinkerConfig.java | 34 ++- .../cschar/pmode3/config/LizardConfig.java | 25 ++ .../pmode3/config/LockedLayerConfig.java | 4 +- .../pmode3/config/MultiLayerChanceConfig.java | 24 +- .../pmode3/config/MultiLayerConfig.java | 22 ++ .../com/cschar/pmode3/config/SoundConfig.java | 17 +- .../tools/JsonConfigMarkdownDoclet.java | 18 +- .../tools/JsonConfigMarkdownDoclet2.java | 108 --------- 15 files changed, 396 insertions(+), 337 deletions(-) delete mode 100644 src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet2.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d91f7b..ad75d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ # power-mode-zeranthium Changelog ## [Unreleased] +- 2024.2-eap update ## [3.3.0] - 2024-05-18 - 2024.1 update diff --git a/README_dev_notes.md b/README_dev_notes.md index 6e1b23d..927b74e 100644 --- a/README_dev_notes.md +++ b/README_dev_notes.md @@ -95,7 +95,7 @@ ex: `build/idea-sandbox/IC-2024.2/log/idea.log` ``` ./gradlew :javadoc --rerun --quiet -./gradlew :javadoc --rerun --quiet > ./docsv2/_includes/options.md +./gradlew :javadoc --rerun --quiet > ./docs/_includes/options.md ``` ---------------------------------------------------------------- diff --git a/docs/_includes/options.md b/docs/_includes/options.md index 5c4c5c2..4518da4 100644 --- a/docs/_includes/options.md +++ b/docs/_includes/options.md @@ -1,10 +1,7 @@ - - - -

LockedLayerConfig

+

LockedLayerConfig {% octicon link height:16 %}

``` -val1: Unused +val1: unused ``` ``` @@ -17,7 +14,7 @@ val2: screenposition ``` ``` -val3: Unused +val3: unused ``` ```json @@ -32,8 +29,71 @@ val3: Unused } ``` +

MultiLayerChanceConfig {% octicon link height:16 %}

+ +``` +val1: chance of spawn 1-1000 +``` + +``` +val2: unused +``` + +``` +val3: unused +``` + +``` +fromBottom: used as a flag to spawn from bottom or top +``` + +```json +"MULTI_LAYER_CHANCE": { + "tableData": [ + {"customPath":"./MULTI_LAYER/layer1", + "alpha":1,"scale":1.0, + "val1":1000, + "fromBottom": true + "enabled":false, "speedRate":2 }, + {"customPath":"./MULTI_LAYER/layer2", ... } + {"customPath":"./MULTI_LAYER/layer3", ... } + ] + } +``` + +

CopyPasteVoidConfig {% octicon link height:16 %}

+ +```json +//TODO +``` + +

DrosteConfig {% octicon link height:16 %}

+ +``` +val1: Offset for each new expanding layer (10-400) +``` + +``` +val2: +``` -

TapAnimConfig

+``` +val3: +``` + +```json +"DROSTE": { + "tableData": [ + {"customPath":"./DROSTE/layer1", + "alpha":1, "scale":1.0, + "val1":20, + "enabled":true,"speedRate":2, "isCyclic": true}, + {"customPath":"./DROSTE/layer2", ...} + ] + } +``` + +

TapAnimConfig {% octicon link height:16 %}

``` val1: yoffset from caret @@ -60,6 +120,144 @@ val3: unused } ``` +

MultiLayerConfig {% octicon link height:16 %}

+ +``` +val1: unused +``` + +``` +val2: max particles 1-10 +``` + +``` +val3: unused +``` + +```json +"MULTI_LAYER": { + "moveWithCaretEnabled": true, + "moveSpeed": 0.1, + "tableData": [ + {"customPath":"./MULTI_LAYER/layer1", + "alpha":1,"scale":1.0, + "val2":10, + "enabled":false, "speedRate":2, "isCyclic": true}, + {"customPath":"./MULTI_LAYER/layer2", ... } + {"customPath":"./MULTI_LAYER/layer3", ... } + ] + } +``` -

LanternConfig

+

LinkerConfig {% octicon link height:16 %}

+ +``` +val1: Offset to start on links +``` + +``` +val2: Repeat every N links +``` + +``` +val3: unused +``` + +```json +"LINKER":{ + "tracerEnabled": false, + "isCyclicEnabled" false, + "distanceToCenter": 290, + "tableData":[ + { + "defaultPath": "./linker1/", + "val2": 100, + "isCyclic": false, + "alpha": 1, + "val1": 1, + "scale": 0.3, + "enabled": true, + "speedRate": 2 + } + ] + } +``` + +

LizardConfig {% octicon link height:16 %}

+ +``` +val1: weight for spawn chance (1-1000) +``` + +``` +val2: unused +``` + +``` +val3: unused +``` + +```json +"LIZARD": { + "tableData": [ + {"customPath":"./lizard", + "alpha":1, + "val1":2, + "scale":0.4, + "enabled":true, + "speedRate":3}, + {"customPath":"./lizard2", ...}, + {"customPath":"./lizard3", ...} + ] + } +``` + +

LanternConfig {% octicon link height:16 %}

+ +``` +val1: Offset to start on links +``` + +``` +val2: Repeat every N links +``` + +``` +val3: max length of links per sprite type +``` + +```json +"LANTERN":{ + "maxParticles": 40, + "tracerEnabled": false, + "isCyclicEnabled": false, + "tableData":[ + { + "defaultPath": "./lantern1/", + + "isCyclic": false, + "alpha": 1, + "val1": 1, + "val2": 2, + "val3": 12, + "scale": 0.3, + "enabled": true, + "speedRate": 2 + } + ] + } +``` + +

SoundConfig {% octicon link height:16 %}

+ +```json +"SOUND": { + "tableData": [ + {"weight": 20, "customPath": "./SOUND/sound1.mp3"}, + {"weight": 20, "customPath": "./SOUND/sound2.mp3"}, + {"weight": 20, "customPath": "./SOUND/sound3.mp3"}, + {"weight": 20, "customPath": "./SOUND/sound4.mp3"} + ] + } +``` diff --git a/docs/index.markdown b/docs/index.markdown index b78a690..3c070f5 100644 --- a/docs/index.markdown +++ b/docs/index.markdown @@ -96,207 +96,7 @@ See individual settings section for Option specific de

Option Settings

-

Lizard

+{% include options.md %} -``` -val1: weight for spawn chance (1-1000) -``` - -```json -"LIZARD": { - "tableData": [ - {"customPath":"./lizard", - "alpha":1, - "val1":2, - "scale":0.4, - "enabled":true, - "speedRate":3}, - {"customPath":"./lizard2", ...}, - {"customPath":"./lizard3", ...} - ] - } -``` - -

Multi Layer

- -``` -val2: max particles 1-10 -``` - -```json -"MULTI_LAYER": { - "moveWithCaretEnabled": true, - "moveSpeed": 0.1, - "tableData": [ - {"customPath":"./MULTI_LAYER/layer1", - "alpha":1,"scale":1.0, - "val2":10, - "enabled":false, "speedRate":2, "isCyclic": true}, - {"customPath":"./MULTI_LAYER/layer2", ... } - {"customPath":"./MULTI_LAYER/layer3", ... } - ] - } -``` - -

Multi Layer Chance

- -``` -val1: chance of spawn 1-1000 -fromBottom: used as a flag to spawn from bottom or top -``` - -```json -"MULTI_LAYER_CHANCE": { - "tableData": [ - {"customPath":"./MULTI_LAYER/layer1", - "alpha":1,"scale":1.0, - "val1":1000, - "enabled":false, "speedRate":2, "fromBottom": true}, - {"customPath":"./MULTI_LAYER/layer2", ... } - {"customPath":"./MULTI_LAYER/layer3", ... } - ] - } -``` - -

Linker

- -``` -val2: Repeat every N links -val1: Offset to start on links -``` - -```json -"LINKER":{ - "tracerEnabled": false, - "isCyclicEnabled" false, - "distanceToCenter": 290, - "tableData":[ - { - "defaultPath": "./linker1/", - "val2": 100, - "isCyclic": false, - "alpha": 1, - "val1": 1, - "scale": 0.3, - "enabled": true, - "speedRate": 2 - } - ] - } -``` -

Droste

- -``` -val1: Offset for each new expanding layer (10-400) -``` - -```json - -"DROSTE": { - "tableData": [ - {"customPath":"./DROSTE/layer1", - "alpha":1, "scale":1.0, - "val1":20, - "enabled":true,"speedRate":2, "isCyclic": true}, - {"customPath":"./DROSTE/layer2", ...} - ] - }, - -``` - - -

copyPasteVOID

-TODO -

Locked layer

- -``` -val2: Screen position -Stretch -> 0 -Top/Right -> 1 -Top/Left -> 2 -Bot/Right -> 3 -Bot/Left -> 4 -``` - -```json -"LOCKED_LAYER": { - "tableData": [ - {"customPath":"./lockedlayer1", - "alpha":1, "scale":1.0, - "val2": 3, - "enabled":true,"speedRate":2, "isCyclic": true}, - {"customPath":"./lockedlayer2", ...} - ] - } -``` - -

Lantern

- -``` -val3: max length of links per sprite type -val2: Repeat every N links -val1: Offset to start on links -``` - -```json -"LANTERN":{ - "maxParticles": 40, - "tracerEnabled": false, - "isCyclicEnabled": false, - "tableData":[ - { - "defaultPath": "./lantern1/", - - "isCyclic": false, - "alpha": 1, - "val1": 1, - "val2": 2, - "val3": 12, - "scale": 0.3, - "enabled": true, - "speedRate": 2 - } - ] - } -``` - -

Tap Anim

- -``` -val1: yoffset from caret -val2: xoffset from caret -``` - -```json - -"TAP_ANIM": { - "tableData": [ - {"customPath":"./TAP_ANIM/layer1", "alpha":1, - "val1":15, - "val2":-30, - "scale":0.8, - "enabled":true,"speedRate":4, "isCyclic": true} - ] - } - -``` - - -

Sound

- -```json - "SOUND": { - "tableData": [ - {"weight": 20, "customPath": "./SOUND/sound1.mp3"}, - {"weight": 20, "customPath": "./SOUND/sound2.mp3"}, - {"weight": 20, "customPath": "./SOUND/sound3.mp3"}, - {"weight": 20, "customPath": "./SOUND/sound4.mp3"} - ] - } -```

Action Sound

Todo - - - -{% include options.md %} \ No newline at end of file diff --git a/src/main/java/com/cschar/pmode3/config/CopyPasteVoidConfig.java b/src/main/java/com/cschar/pmode3/config/CopyPasteVoidConfig.java index 13239b6..0ac6995 100644 --- a/src/main/java/com/cschar/pmode3/config/CopyPasteVoidConfig.java +++ b/src/main/java/com/cschar/pmode3/config/CopyPasteVoidConfig.java @@ -10,12 +10,15 @@ import com.intellij.openapi.options.ConfigurationException; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.table.JBTable; +import org.json.JSONException; +import org.json.JSONObject; import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; import java.awt.*; +import java.nio.file.Path; import java.util.ArrayList; public class CopyPasteVoidConfig extends BaseConfigJPanel { @@ -143,6 +146,14 @@ public JComponent createConfigTable(){ return sp; } + /** + * @exampleConfig + * //TODO + */ + private void loadJSONConfig() { + // placeholder + } + public void loadValues(){ this.fadeColorEnabledCheckBox.setSelected(Config.getBoolProperty(settings, PowerMode3.ConfigType.COPYPASTEVOID,"fadeColorEnabled", true)); diff --git a/src/main/java/com/cschar/pmode3/config/DrosteConfig.java b/src/main/java/com/cschar/pmode3/config/DrosteConfig.java index 4327616..de73e26 100644 --- a/src/main/java/com/cschar/pmode3/config/DrosteConfig.java +++ b/src/main/java/com/cschar/pmode3/config/DrosteConfig.java @@ -142,6 +142,26 @@ public static void setSpriteDataAnimated(ArrayList data){ ParticleSpriteDroste.spriteDataAnimated = data; } + /** + * + * @val1 Offset for each new expanding layer (10-400) + * @val2 + * @val3 + * + * + * @exampleConfig + * + * "DROSTE": { + * "tableData": [ + * {"customPath":"./DROSTE/layer1", + * "alpha":1, "scale":1.0, + * "val1":20, + * "enabled":true,"speedRate":2, "isCyclic": true}, + * {"customPath":"./DROSTE/layer2", ...} + * ] + * } + * + */ public static void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { JSONArray tableData = configData.getJSONArray("tableData"); diff --git a/src/main/java/com/cschar/pmode3/config/LanternConfig.java b/src/main/java/com/cschar/pmode3/config/LanternConfig.java index 15e3f81..fdf9217 100644 --- a/src/main/java/com/cschar/pmode3/config/LanternConfig.java +++ b/src/main/java/com/cschar/pmode3/config/LanternConfig.java @@ -229,7 +229,36 @@ public void loadValues(){ } - /** currently only used when loading packs... not in resource loader */ + /** + * + * @val1 Offset to start on links + * @val2 Repeat every N links + * @val3 max length of links per sprite type + * + * + * @exampleConfig + * + * "LANTERN":{ + * "maxParticles": 40, + * "tracerEnabled": false, + * "isCyclicEnabled": false, + * "tableData":[ + * { + * "defaultPath": "./lantern1/", + * + * "isCyclic": false, + * "alpha": 1, + * "val1": 1, + * "val2": 2, + * "val3": 12, + * "scale": 0.3, + * "enabled": true, + * "speedRate": 2 + * } + * ] + * } + * + */ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { PowerMode3 settings = PowerMode3.getInstance(); diff --git a/src/main/java/com/cschar/pmode3/config/LinkerConfig.java b/src/main/java/com/cschar/pmode3/config/LinkerConfig.java index 20ca4d4..a51d12c 100644 --- a/src/main/java/com/cschar/pmode3/config/LinkerConfig.java +++ b/src/main/java/com/cschar/pmode3/config/LinkerConfig.java @@ -434,6 +434,34 @@ public static void setSpriteDataAnimated(ArrayList data){ ParticleSpriteLinkerAnchor.spriteDataAnimated = data; } + /** + * + * @val1 Offset to start on links + * @val2 Repeat every N links + * @val3 unused + * + * + * @exampleConfig + * "LINKER":{ + * "tracerEnabled": false, + * "isCyclicEnabled" false, + * "distanceToCenter": 290, + * "tableData":[ + * { + * "defaultPath": "./linker1/", + * "val2": 100, + * "isCyclic": false, + * "alpha": 1, + * "val1": 1, + * "scale": 0.3, + * "enabled": true, + * "speedRate": 2 + * } + * ] + * } + * + * + */ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { PowerMode3 settings = PowerMode3.getInstance(); @@ -480,10 +508,10 @@ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONEx spriteDataAnimated.get(i).defaultPath, parentPath.resolve(jo.getString("customPath")).toString(), jo.getBoolean("isCyclic"), - jo.getInt("val2"), //val2 //repeat every n links + jo.getInt("val2"), //val2 //repeat every n links (float) jo.getDouble("alpha"), - jo.getInt("val1"), - 0); //val1 //offset to start on links + jo.getInt("val1"), //val1 //offset to start on links + 0); spriteDataAnimated.set(i, sd); diff --git a/src/main/java/com/cschar/pmode3/config/LizardConfig.java b/src/main/java/com/cschar/pmode3/config/LizardConfig.java index 711cb7e..f679232 100644 --- a/src/main/java/com/cschar/pmode3/config/LizardConfig.java +++ b/src/main/java/com/cschar/pmode3/config/LizardConfig.java @@ -268,6 +268,31 @@ public static void setSpriteDataAnimated(ArrayList data){ ParticleSpriteLizardAnchor.spriteDataAnimated = data; } + /** + * + * @val1 weight for spawn chance (1-1000) + * @val2 unused + * @val3 unused + * + * @exampleConfig + * + * "LIZARD": { + * "tableData": [ + * {"customPath":"./lizard", + * "alpha":1, + * "val1":2, + * "scale":0.4, + * "enabled":true, + * "speedRate":3}, + * {"customPath":"./lizard2", ...}, + * {"customPath":"./lizard3", ...} + * ] + * } + * + * + * + * + */ public static void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { JSONArray tableData = configData.getJSONArray("tableData"); diff --git a/src/main/java/com/cschar/pmode3/config/LockedLayerConfig.java b/src/main/java/com/cschar/pmode3/config/LockedLayerConfig.java index a7c566a..a360844 100644 --- a/src/main/java/com/cschar/pmode3/config/LockedLayerConfig.java +++ b/src/main/java/com/cschar/pmode3/config/LockedLayerConfig.java @@ -149,7 +149,7 @@ public static void setSpriteDataAnimated(ArrayList data){ /** * - * @val1 Unused + * @val1 unused * * @val2 * screenposition @@ -158,7 +158,7 @@ public static void setSpriteDataAnimated(ArrayList data){ Top/Left -> 2 Bot/Right -> 3 Bot/Left -> 4 - @val3 Unused + @val3 unused @exampleConfig diff --git a/src/main/java/com/cschar/pmode3/config/MultiLayerChanceConfig.java b/src/main/java/com/cschar/pmode3/config/MultiLayerChanceConfig.java index 08ad10a..86567e7 100644 --- a/src/main/java/com/cschar/pmode3/config/MultiLayerChanceConfig.java +++ b/src/main/java/com/cschar/pmode3/config/MultiLayerChanceConfig.java @@ -143,7 +143,29 @@ public static void setSpriteDataAnimated(ArrayList data){ } - + /** + * + * @val1 chance of spawn 1-1000 + * @val2 unused + * @val3 unused + * + * @extra + * fromBottom: used as a flag to spawn from bottom or top + * + * @exampleConfig + * + * "MULTI_LAYER_CHANCE": { + * "tableData": [ + * {"customPath":"./MULTI_LAYER/layer1", + * "alpha":1,"scale":1.0, + * "val1":1000, + * "fromBottom": true + * "enabled":false, "speedRate":2 }, + * {"customPath":"./MULTI_LAYER/layer2", ... } + * {"customPath":"./MULTI_LAYER/layer3", ... } + * ] + * } + */ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { diff --git a/src/main/java/com/cschar/pmode3/config/MultiLayerConfig.java b/src/main/java/com/cschar/pmode3/config/MultiLayerConfig.java index ec3457a..8df1690 100644 --- a/src/main/java/com/cschar/pmode3/config/MultiLayerConfig.java +++ b/src/main/java/com/cschar/pmode3/config/MultiLayerConfig.java @@ -174,6 +174,28 @@ public static float CARET_MOVE_SPEED(PowerMode3 settings){ return Config.getFloatProperty(settings, PowerMode3.ConfigType.MULTI_LAYER, "moveSpeed", 0.1f); } + /** + * + * @val1 unused + * @val2 max particles 1-10 + * @val3 unused + * + * + * @exampleConfig + * "MULTI_LAYER": { + * "moveWithCaretEnabled": true, + * "moveSpeed": 0.1, + * "tableData": [ + * {"customPath":"./MULTI_LAYER/layer1", + * "alpha":1,"scale":1.0, + * "val2":10, + * "enabled":false, "speedRate":2, "isCyclic": true}, + * {"customPath":"./MULTI_LAYER/layer2", ... } + * {"customPath":"./MULTI_LAYER/layer3", ... } + * ] + * } + * + */ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { if(configData.has("moveWithCaretEnabled")) { diff --git a/src/main/java/com/cschar/pmode3/config/SoundConfig.java b/src/main/java/com/cschar/pmode3/config/SoundConfig.java index 1844f0c..cb2fbd7 100644 --- a/src/main/java/com/cschar/pmode3/config/SoundConfig.java +++ b/src/main/java/com/cschar/pmode3/config/SoundConfig.java @@ -142,11 +142,18 @@ public static void setSoundData(ArrayList data){ } - - - - - + /** + * + * @exampleConfig + * "SOUND": { + * "tableData": [ + * {"weight": 20, "customPath": "./SOUND/sound1.mp3"}, + * {"weight": 20, "customPath": "./SOUND/sound2.mp3"}, + * {"weight": 20, "customPath": "./SOUND/sound3.mp3"}, + * {"weight": 20, "customPath": "./SOUND/sound4.mp3"} + * ] + * } + */ public void loadJSONConfig(JSONObject configData, Path parentPath) throws JSONException { JSONArray tableData = configData.getJSONArray("tableData"); diff --git a/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet.java b/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet.java index e2e2acc..dcbecae 100644 --- a/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet.java +++ b/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet.java @@ -23,14 +23,14 @@ public void printElement(DocTrees trees, Element e, TypeElement typeElem) { if (docCommentTree != null) { if(e.toString().contains("loadJSONConfig")) { - System.out.println("===================[FOUND DOCSTRING for loadJSONConfig]===================="); - - System.out.printf("

%s

\n\n", typeElem.getSimpleName()); +// System.out.println("===================[FOUND DOCSTRING for loadJSONConfig]===================="); + // have to escape % with another % + System.out.printf("

%s {%% octicon link height:16 %%}

\n\n", typeElem.getSimpleName(), typeElem.getSimpleName(), typeElem.getSimpleName()); +// System.out.printf("### %s {#%s} \n\n", typeElem.getSimpleName(), typeElem.getSimpleName()); +// System.out.printf("[Link to the subsection](#%s)\n", typeElem.getSimpleName()); for (DocTree blockTag : docCommentTree.getBlockTags()) { -// System.out.println("\t" + blockTag.getClass().getName()); -// System.out.println("\t" + blockTag.getKind()); -// System.out.println("\t" + blockTag); + var type = blockTag.toString().split(" ", 2)[0]; var content = blockTag.toString().split(" ", 2)[1]; @@ -45,6 +45,10 @@ public void printElement(DocTrees trees, Element e, TypeElement typeElem) { + content + "\n```\n"); } + if (type.equals("@extra")) { + System.out.println("``` \n" + content + "\n```\n"); + } + if (type.equals("@exampleConfig")) { System.out.println("```json \n" + content + "\n```\n"); } @@ -62,7 +66,7 @@ public boolean run(DocletEnvironment docEnv) { //DocTree is a tag - System.out.println("\n\n ===== processing ===== "); +// System.out.println("\n\n ===== processing ===== "); // for(Element e : docEnv.getIncludedElements()){ // System.out.println("elements: " + e.getKind().toString() + " : " + e.getSimpleName()); // diff --git a/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet2.java b/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet2.java deleted file mode 100644 index 640e255..0000000 --- a/src/main/java/com/cschar/pmode3/tools/JsonConfigMarkdownDoclet2.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.cschar.pmode3.tools; - -import com.sun.source.doctree.DocCommentTree; -import com.sun.source.doctree.DocTree; -import com.sun.source.util.DocTrees; -import jdk.javadoc.doclet.DocletEnvironment; -import jdk.javadoc.doclet.StandardDoclet; - -import javax.lang.model.element.Element; -import javax.lang.model.element.TypeElement; -import javax.lang.model.util.ElementFilter; - - -public class JsonConfigMarkdownDoclet2 extends StandardDoclet { - - public void printElement(DocTrees trees, Element e) { - DocCommentTree docCommentTree = trees.getDocCommentTree(e); - if (docCommentTree != null) { - - if(e.toString().contains("loadJSONConfig")){ -// System.out.println("===================[FOUND DOCSTRING for loadJSONConfig]===================="); - - for( DocTree blockTag : docCommentTree.getBlockTags()){ -// System.out.println("\t" + blockTag.getClass().getName()); -// System.out.println("\t" + blockTag.getKind()); -// System.out.println("\t" + blockTag); - - var type = blockTag.toString().split(" ", 2)[0]; - var content = blockTag.toString().split(" ", 2)[1]; -// System.out.println("\t" + "type: \n\t\t" + type); -// System.out.println("\t" + "content: \n\t\t" + content); - - if ( type.equals("@val1") || - type.equals("@val2") || - type.equals("@val3")) { - System.out.println("``` \n" + content + "\n```\n"); - } - - if ( type.equals("@exampleConfig")) { - System.out.println("```json \n" + content + "\n```\n"); - } - } - - } - -// System.out.println("Element (" + e.getKind() + ": " -// + e + ") has the following comments:"); -// System.out.println("Entire body: \n " + docCommentTree.getFullBody()); -// System.out.println("Block tags:"); -// for( DocTree blockTag : docCommentTree.getBlockTags()){ -// System.out.println("\t" + blockTag); -// } - } - } - - - @Override - public boolean run(DocletEnvironment docEnv) { -// reporter.print(Kind.NOTE, "overviewfile: " + overviewfile); - // get the DocTrees utility class to access document comments - DocTrees docTrees = docEnv.getDocTrees(); - //DocTree is a tag -// docEnv.getJavaFileManager(). - - - - System.out.println("\n\n ===== processing ===== "); -// for(Element e : docEnv.getIncludedElements()){ -// System.out.println("elements: " + e.getKind().toString() + " : " + e.getSimpleName()); -// -// if (e.getKind().toString().equals("PACKAGE")) { -// System.out.println("\t---- package found ---"); -// for(Element i : e.getEnclosedElements()){ -// System.out.println("\telement: " + i.getKind() + " : " + i.getSimpleName()); -// } -// } -// -// if (e.getKind().toString().equals("MODULE")) { -// System.out.println("\t---- module found ---"); -// for(Element i : e.getEnclosedElements()){ -// System.out.println("\telement: " + i.getKind() + " : " + i.getSimpleName()); -// } -// } -// } - -// System.out.println(docEnv.getClass().descriptorString()); - - - - for (TypeElement t : ElementFilter.typesIn(docEnv.getIncludedElements())) { -// System.out.println(t.getKind() + ":" + t); - for (Element e : t.getEnclosedElements()) { - printElement(docTrees, e); - } - -// printElement(docTrees, t.getEnclosingElement()); - - - } - return true; - } - - @Override - public String getName() { - return "JsonConfigMarkdownDoclet"; - } - -}