public enum SourceType extends Enum<SourceType>
Lexer and Parser, and provides convenience
methods such as parsing source files and identifying a source C4 level.| Enum Constant and Description |
|---|
C4_L1
A C4 System Context grammar.
|
C4_L2
A C4 Container grammar.
|
C4_L3
A C4 Component grammar.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<? extends org.antlr.v4.runtime.Parser> |
createParser(Path sourcePath,
Charset charset,
org.antlr.v4.runtime.BaseErrorListener errorListener)
Parses the given C4 source file and returns an
Optional of the created Parser or empty if any
exception occurs. |
String |
getC4Level()
Returns the associated C4 level of the current enumeration value.
|
Class<org.antlr.v4.runtime.Parser> |
getParserType()
Returns the associated
Parser type of the current enumeration value. |
static Optional<SourceType> |
getSourceTypeFromFilename(Path fullyQualifiedName)
Guesses the given source file C4 level and returns an
Optional of the matching enumeration value if any, or
empty. |
static SourceType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SourceType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SourceType C4_L1
public static final SourceType C4_L2
public static final SourceType C4_L3
public static SourceType[] values()
for (SourceType c : SourceType.values()) System.out.println(c);
public static SourceType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Optional<SourceType> getSourceTypeFromFilename(Path fullyQualifiedName)
Optional of the matching enumeration value if any, or
empty.fullyQualifiedName - the C4 source file to guess the level from.Optional of the matching enumeration if any or empty.public Optional<? extends org.antlr.v4.runtime.Parser> createParser(Path sourcePath, Charset charset, org.antlr.v4.runtime.BaseErrorListener errorListener)
Optional of the created Parser or empty if any
exception occurs. Parsing errors are reported to the given BaseErrorListener instance.public String getC4Level()
public Class<org.antlr.v4.runtime.Parser> getParserType()
Parser type of the current enumeration value.Parser type.Copyright © 2020. All rights reserved.