Interface SourceType

All Known Implementing Classes:
JavaSourceType, NoneSourceType

public interface SourceType
Source file type.
Author:
harald
  • Method Summary

    Modifier and Type
    Method
    Description
    Extract properties for the given file.
    static SourceType
    get(String extension)
    Gets the source type of the given extension.
    If there is no source type registered for the extension, the default type is returned.
    Gets all registered source types.
    Gets the file extension (including the dot).
    default boolean
    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.
    default boolean
    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.
  • Method Details

    • getFileExtension

      String getFileExtension()
      Gets the file extension (including the dot).
      Returns:
      the extension, never null
    • extractProperties

      Properties extractProperties(SourceDocument document)
      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

      static Collection<SourceType> getAll()
      Gets all registered source types.
      Returns:
      the source types
    • get

      static SourceType get(String extension) throws WurbelException
      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