Class JavaInputReader

  • All Implemented Interfaces:
    com.devonfw.cobigen.api.extension.InputReader

    public class JavaInputReader
    extends Object
    implements com.devonfw.cobigen.api.extension.InputReader
    Extension for the InputReader Interface of the CobiGen, to be able to read Java classes into FreeMarker models
    • Constructor Detail

      • JavaInputReader

        public JavaInputReader()
    • Method Detail

      • isValidInput

        public boolean isValidInput​(Object input)
        Specified by:
        isValidInput in interface com.devonfw.cobigen.api.extension.InputReader
      • createModel

        public Map<String,​Object> createModel​(Object o)
        Specified by:
        createModel in interface com.devonfw.cobigen.api.extension.InputReader
      • getInputObjects

        public List<Object> getInputObjects​(Object input,
                                            Charset inputCharset)
        Specified by:
        getInputObjects in interface com.devonfw.cobigen.api.extension.InputReader
      • getInputObjectsRecursively

        public List<Object> getInputObjectsRecursively​(Object input,
                                                       Charset inputCharset)
        Specified by:
        getInputObjectsRecursively in interface com.devonfw.cobigen.api.extension.InputReader
      • getInputObjects

        public List<Object> getInputObjects​(Object input,
                                            Charset inputCharset,
                                            boolean recursively)
        Returns all input objects for the given container input.
        Parameters:
        input - container input (only PackageFolder instances will be supported)
        inputCharset - Charset to be used to read the children
        recursively - states, whether the children should be retrieved recursively
        Returns:
        the list of children. In this case File objects
      • getTemplateMethods

        public Map<String,​Object> getTemplateMethods​(Object input)
        Specified by:
        getTemplateMethods in interface com.devonfw.cobigen.api.extension.InputReader
      • read

        public Object read​(Path path,
                           Charset inputCharset,
                           Object... additionalArguments)
                    throws com.devonfw.cobigen.api.exception.InputReaderException
        Reads the data at the specified path.
        Specified by:
        read in interface com.devonfw.cobigen.api.extension.InputReader
        Parameters:
        path - the Path of the content to read
        additionalArguments -
        • In case of path pointing to a folder
          1. packageName: String, required
          2. classLoader: ClassLoader, required
          additional arguments are ignored
        • In case of path pointing to a file
        Throws:
        com.devonfw.cobigen.api.exception.InputReaderException
      • isMostLikelyReadable

        public boolean isMostLikelyReadable​(Path path)
        Specified by:
        isMostLikelyReadable in interface com.devonfw.cobigen.api.extension.InputReader