Class MetadataInputResolverContext
- java.lang.Object
-
- org.rodnansol.core.generator.resolver.MetadataInputResolverContext
-
public class MetadataInputResolverContext extends Object
Class that uses differentMetadataInputResolverinstances to resolve thespring-configuration-metadata.jsonfile from different inputs.- Since:
- 0.1.0
- Author:
- nandorholozsnyak
-
-
Field Summary
Fields Modifier and Type Field Description static MetadataInputResolverContextINSTANCE
-
Constructor Summary
Constructors Constructor Description MetadataInputResolverContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetInputStreamFromFile(Project project, File input)Returns the requested file from the given input.
-
-
-
Field Detail
-
INSTANCE
public static final MetadataInputResolverContext INSTANCE
-
-
Method Detail
-
getInputStreamFromFile
public InputStream getInputStreamFromFile(Project project, File input)
Returns the requested file from the given input.The input can be a file, a directory or a ZIP/JAR file, these are the supported inputs now and this method will use different
MetadataInputResolverinstances to resolve the metadata file.It will run the resolvers in the following order:
- JarFileMetadataInputResolver - First it will check if it is a ZIP/JAR file or not
- FileMetadataInputResolver - Second it will check if it is file or not
- DirectoryMetadataInputResolver - Third it will check if it is directory, if yes it will search the
Project.getPossibleMetadataFilePaths()for thespring-configuration-metadata.jsonfile
- Parameters:
project- project instance.input- input.- Returns:
- the file's content in an
InputStreaminstance. - Throws:
DocumentGenerationException- if none of the resolvers are able to find the file.
-
-