Class JavaInputReader

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

    public class JavaInputReader
    extends java.lang.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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String VALID_EXTENSION
      Valid file extension for the reader
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaInputReader()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> createModel​(java.lang.Object o)  
      java.util.List<java.lang.Object> getInputObjects​(java.lang.Object input, java.nio.charset.Charset inputCharset)  
      java.util.List<java.lang.Object> getInputObjects​(java.lang.Object input, java.nio.charset.Charset inputCharset, boolean recursively)
      Returns all input objects for the given container input.
      java.util.List<java.lang.Object> getInputObjectsRecursively​(java.lang.Object input, java.nio.charset.Charset inputCharset)  
      boolean isMostLikelyReadable​(java.nio.file.Path path)  
      boolean isValidInput​(java.lang.Object input)  
      java.lang.Object read​(java.nio.file.Path path, java.nio.charset.Charset inputCharset, java.lang.Object... additionalArguments)
      Reads the data at the specified path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VALID_EXTENSION

        public static final java.lang.String VALID_EXTENSION
        Valid file extension for the reader
        See Also:
        Constant Field Values
    • Constructor Detail

      • JavaInputReader

        public JavaInputReader()
    • Method Detail

      • isValidInput

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

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

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

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

        public java.util.List<java.lang.Object> getInputObjects​(java.lang.Object input,
                                                                java.nio.charset.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
      • read

        public java.lang.Object read​(java.nio.file.Path path,
                                     java.nio.charset.Charset inputCharset,
                                     java.lang.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​(java.nio.file.Path path)
        Specified by:
        isMostLikelyReadable in interface com.devonfw.cobigen.api.extension.InputReader