Interface SourceType
- All Known Implementing Classes:
JavaSourceType, NoneSourceType
public interface SourceType
Source file type.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptionextractProperties(SourceDocument document) Extract properties for the given file.static SourceTypeGets the source type of the given extension.
If there is no source type registered for the extension, the default type is returned.static Collection<SourceType> getAll()Gets all registered source types.Gets the file extension (including the dot).default booleanReturns whether this is the default source type.
The default type is used for files without an extension and for files whose extension has no dedicated source type.default booleanReturns whether generated code should be generated with smart indent.
With smart indent, the generated code will be aligned with the comment block containing the wurblet anchor.
-
Method Details
-
getFileExtension
String getFileExtension()Gets the file extension (including the dot).- Returns:
- the extension, never null
-
extractProperties
Extract properties for the given file.- Parameters:
document- the source document- Returns:
- the properties, never null
-
isDefault
default boolean isDefault()Returns whether this is the default source type.
The default type is used for files without an extension and for files whose extension has no dedicated source type.- Returns:
- true if default
-
isSmartIndent
default boolean isSmartIndent()Returns whether generated code should be generated with smart indent.
With smart indent, the generated code will be aligned with the comment block containing the wurblet anchor.- Returns:
- true if smart indent
-
getAll
-
get
Gets the source type of the given extension.
If there is no source type registered for the extension, the default type is returned.- Parameters:
extension- the file extension including the dot, null if the file has no extension- Returns:
- the source type
- Throws:
WurbelException- if no matching source type and no default type is configured
-