Class JavaInputReader
- java.lang.Object
-
- com.devonfw.cobigen.javaplugin.inputreader.JavaInputReader
-
- All Implemented Interfaces:
com.devonfw.cobigen.api.extension.InputReader
public class JavaInputReader extends Object implements com.devonfw.cobigen.api.extension.InputReader
Extension for theInputReaderInterface of the CobiGen, to be able to read Java classes into FreeMarker models
-
-
Constructor Summary
Constructors Constructor Description JavaInputReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>createModel(Object o)List<Object>getInputObjects(Object input, Charset inputCharset)List<Object>getInputObjects(Object input, Charset inputCharset, boolean recursively)Returns all input objects for the given container input.List<Object>getInputObjectsRecursively(Object input, Charset inputCharset)Map<String,Object>getTemplateMethods(Object input)booleanisMostLikelyReadable(Path path)booleanisValidInput(Object input)Objectread(Path path, Charset inputCharset, Object... additionalArguments)Reads the data at the specified path.
-
-
-
Method Detail
-
isValidInput
public boolean isValidInput(Object input)
- Specified by:
isValidInputin interfacecom.devonfw.cobigen.api.extension.InputReader
-
createModel
public Map<String,Object> createModel(Object o)
- Specified by:
createModelin interfacecom.devonfw.cobigen.api.extension.InputReader
-
getInputObjects
public List<Object> getInputObjects(Object input, Charset inputCharset)
- Specified by:
getInputObjectsin interfacecom.devonfw.cobigen.api.extension.InputReader
-
getInputObjectsRecursively
public List<Object> getInputObjectsRecursively(Object input, Charset inputCharset)
- Specified by:
getInputObjectsRecursivelyin interfacecom.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 (onlyPackageFolderinstances will be supported)inputCharset-Charsetto be used to read the childrenrecursively- states, whether the children should be retrieved recursively- Returns:
- the list of children. In this case
Fileobjects
-
getTemplateMethods
public Map<String,Object> getTemplateMethods(Object input)
- Specified by:
getTemplateMethodsin interfacecom.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:
readin interfacecom.devonfw.cobigen.api.extension.InputReader- Parameters:
path- the Path of the content to readadditionalArguments-- In case of path pointing to a folder
- packageName: String, required
- classLoader: ClassLoader, required
- In case of path pointing to a file
- In case of path pointing to a folder
- Throws:
com.devonfw.cobigen.api.exception.InputReaderException
-
isMostLikelyReadable
public boolean isMostLikelyReadable(Path path)
- Specified by:
isMostLikelyReadablein interfacecom.devonfw.cobigen.api.extension.InputReader
-
-