Package org.wurbelizer.wurbel
Interface SourceRegion
- All Known Implementing Classes:
AbstractSourceRegion
,CoffeeBytesRegion
,NetbeansRegion
,VisualStudioRegion
public interface SourceRegion
Generates comments to mark generated code as named regions.
Source region types must be registed in META-INF/services/org.wurbelizer.wurbel.SourceRegion
.
The wurbelizer already provides some implementations with 'netbeans'
being by default.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateBegin
(SourceRegion.FoldType foldType, String guardName, SourceWurbletSubElement wurbletElement) Creates the start comment.createEnd
(SourceRegion.FoldType foldType, String guardName, SourceWurbletSubElement wurbletElement) Creates the end comment.static SourceRegion
Gets the source region of given type.static Collection
<SourceRegion> getAll()
Gets all registered source regions.getBeginName
(String comment) Gets the region's name (wurblet tag) if this is the start comment is of this region type.getEndName
(String comment) Gets the region's name (wurblet tag) if this is the end comment is of this region type.default boolean
Returns whether this is the default region type.boolean
Returns whether this is the end comment for the given region's name.type()
Gets the unique name of the region type.
-
Method Details
-
type
String type()Gets the unique name of the region type.- Returns:
- the type name
-
isDefault
default boolean isDefault()Returns whether this is the default region type.- Returns:
- true if default
-
createBegin
String createBegin(SourceRegion.FoldType foldType, String guardName, SourceWurbletSubElement wurbletElement) Creates the start comment.- Parameters:
foldType
- the fold type, null if noneguardName
- the name of the guarded sectionwurbletElement
- the wurblet element- Returns:
- the comment
-
createEnd
String createEnd(SourceRegion.FoldType foldType, String guardName, SourceWurbletSubElement wurbletElement) Creates the end comment.- Parameters:
foldType
- the fold type, null if noneguardName
- the name of the guarded sectionwurbletElement
- the wurblet element- Returns:
- the comment
-
getBeginName
Gets the region's name (wurblet tag) if this is the start comment is of this region type.- Parameters:
comment
- the comment string- Returns:
- the region's name if is of this type
-
getEndName
Gets the region's name (wurblet tag) if this is the end comment is of this region type.- Parameters:
comment
- the comment string- Returns:
- the region's name if is of this type
-
isEnd
Returns whether this is the end comment for the given region's name.- Parameters:
comment
- the comment stringname
- the region's name- Returns:
- true if matching end comment
-
getAll
Gets all registered source regions.- Returns:
- the source regions
-
get
Gets the source region of given type.- Parameters:
type
- the type, null if default type- Returns:
- the region of given type
- Throws:
WurbelException
- if no matching region type configured
-