Skip to content
roland sainty edited this page Jan 22, 2021 · 5 revisions
Package api

Class ApiStructuresExtractor

java.lang.Object
api.ApiStructuresExtractor

public class ApiStructuresExtractor
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    ApiStructuresExtractor​(com.google.gson.JsonElement dictionary)
    Set a JsonElement as a dictionary and set an Index list , an Index Class list, an Index Enum list, an Asset list
  • Method Summary

    All MethodsStatic MethodsInstance MethodsConcrete Methods
    Modifier and Type Method Description
    void assetToString​(java.lang.String assetToExtract)
    Extract the values of the API ASSET using a String ID without the prefix set as CONST.
    void classToString​(java.lang.String classToExtract)
    Extract the parameters of a API Class using a String ID without the prefix set as CONST.
    static java.util.LinkedHashMap<java.lang.String,​java.lang.String> clean​(com.google.gson.JsonArray structure)
    Clean a jsonArray of VSC snippet's tags
    static java.util.List<java.lang.String> cleanEnumTemplate​(com.google.gson.JsonArray templates)
    Parse the Capital letter as VALUES of Enums.
    static void consoleDisplayLinkedMapToString​(java.util.LinkedHashMap<java.lang.String,​java.lang.String> parameters)
    Display in Console, line per line, each parameter and parmeter type contained in this map of parameters.
    java.util.LinkedList<java.lang.String> entryList()
    Provide a List Strings of structures NAMES corresponding to Class or Enum describe in the Json VSC Snippets file.
    void enumToString​(java.lang.String enumToExtract)
    Extract the values of an API ENUM using an id without the prefix, set as CONST.
    java.util.LinkedHashMap<java.lang.String,​java.lang.String> extractClass​(java.lang.String classToExtract)
    Extract a Class of the Api using a String ID whitout the prefix set as CONST.
    java.lang.String extractParamDefaultValue​(java.lang.String param)
    Extract the default Value from a String param Type that contain it.
    java.lang.String extractParamType​(java.lang.String param)
    Extract an expected parameter type from String param, first word of the String.
    com.google.gson.JsonArray extractTemplates​(java.lang.String templateToExtract)
    Extract a specific API Template contained in the Json VSC Snippets file.
    java.util.LinkedList<java.lang.String> getDictionaryAssetIndex()  
    java.util.LinkedList<java.lang.String> getDictionaryClassIndex()  
    java.util.LinkedList<java.lang.String> getDictionaryEnumIndex()  
    java.util.List<java.lang.String> getDictionaryIndex()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ApiStructuresExtractor

      public ApiStructuresExtractor​(com.google.gson.JsonElement dictionary)
      Set a JsonElement as a dictionary and set an Index list , an Index Class list, an Index Enum list, an Asset list
      Parameters:
      dictionary - A JsonElement result of a JsonParser.parseReader( Reader) to JsonObject
  • Method Details

    • clean

      public static java.util.LinkedHashMap<java.lang.String,​java.lang.String> clean​(com.google.gson.JsonArray structure)
      Clean a jsonArray of VSC snippet's tags
      Parameters:
      structure - JsonArray of parameter Set
      Returns:
      LinkedHasMap (Parameter Label ; String Parameter Type and default Value)
    • consoleDisplayLinkedMapToString

      public static void consoleDisplayLinkedMapToString​(java.util.LinkedHashMap<java.lang.String,​java.lang.String> parameters)
      Display in Console, line per line, each parameter and parmeter type contained in this map of parameters.
      Parameters:
      parameters - a LinkedHashMap String, String of structure s parameters.
    • cleanEnumTemplate

      public static java.util.List<java.lang.String> cleanEnumTemplate​(com.google.gson.JsonArray templates)
      Parse the Capital letter as VALUES of Enums. Enums do not have an equal char.So can be identify by a lenght of 1
      Parameters:
      templates - JsonArray of JsonElement containing a code to parse
      Returns:
      linkedList of String, the Enums Values
    • entryList

      public java.util.LinkedList<java.lang.String> entryList()
      Provide a List Strings of structures NAMES corresponding to Class or Enum describe in the Json VSC Snippets file. Here the code compare this list to the Entry summary of a dictionary.
      Returns:
      a List Strings of the entry contained in the JsonElement dictionary
    • extractTemplates

      public com.google.gson.JsonArray extractTemplates​(java.lang.String templateToExtract)
      Extract a specific API Template contained in the Json VSC Snippets file. Here the code compare this template as a definition in a dictionary
      Parameters:
      templateToExtract - String template to extract
      Returns:
      JsonArray extracted Template
    • classToString

      public void classToString​(java.lang.String classToExtract)
      Extract the parameters of a API Class using a String ID without the prefix set as CONST.
      Parameters:
      classToExtract - a String Name, id of the class to display
    • extractParamDefaultValue

      public java.lang.String extractParamDefaultValue​(java.lang.String param)
      Extract the default Value from a String param Type that contain it. ex: TEXTURE_WRAP (default: TEXTURE_WRAP.CLAMP) returns TEXTURE_WRAP.CLAMP
      Parameters:
      param - String Param containing the default value.
      Returns:
      String the default value.
    • extractParamType

      public java.lang.String extractParamType​(java.lang.String param)
      Extract an expected parameter type from String param, first word of the String.
      Parameters:
      param - String Param containing the expected Type.
      Returns:
      a String, expected parameter type.
    • extractClass

      public java.util.LinkedHashMap<java.lang.String,​java.lang.String> extractClass​(java.lang.String classToExtract)
      Extract a Class of the Api using a String ID whitout the prefix set as CONST.
      Parameters:
      classToExtract - a String id of the Class to extract
      Returns:
      a LinkedHashMap param, param type
    • enumToString

      public void enumToString​(java.lang.String enumToExtract)
      Extract the values of an API ENUM using an id without the prefix, set as CONST.
      Parameters:
      enumToExtract - a String, id of the Enum to display
    • assetToString

      public void assetToString​(java.lang.String assetToExtract)
      Extract the values of the API ASSET using a String ID without the prefix set as CONST.
      Parameters:
      assetToExtract - a String, id of the Asset to display
    • getDictionaryIndex

      public java.util.List<java.lang.String> getDictionaryIndex()
    • getDictionaryClassIndex

      public java.util.LinkedList<java.lang.String> getDictionaryClassIndex()
    • getDictionaryEnumIndex

      public java.util.LinkedList<java.lang.String> getDictionaryEnumIndex()
    • getDictionaryAssetIndex

      public java.util.LinkedList<java.lang.String> getDictionaryAssetIndex()