ICodeType.DefImpl| Modifier and Type | Field and Description |
|---|---|
static ICodeType.DefImpl |
CSS |
static ICodeType.DefImpl |
CSV |
static ICodeType.DefImpl |
HTML |
static ICodeType.DefImpl |
JS |
static ICodeType.DefImpl |
JSON |
static ICodeType.DefImpl |
RAW |
static ICodeType.DefImpl |
XML |
| Modifier | Constructor and Description |
|---|---|
protected |
DefImpl(String id,
String commentStart,
String commentEnd,
Escape escape,
String suffix) |
protected |
DefImpl(String id,
String commentStart,
String commentEnd,
Escape escape,
String blockStart,
String blockEnd,
String suffix) |
| Modifier and Type | Method and Description |
|---|---|
Set<ICodeType> |
allowedExternalTypes()
Return a set of other types that could embed this type impl.
|
boolean |
allowInternalTypeBlock()
Return true if this file type impl allow another type be embedded inside.
|
String |
blockEnd()
Return a regex string indicate an end of a type block
|
String |
blockStart()
Some type could be embedded into another.
|
Object |
clone() |
String |
commentEnd()
Return comment end.
|
String |
commentStart()
Return comment start.
|
Escape |
escape()
Return escape scheme
|
ICodeType |
getParent()
Return parent type or null if there is no parent set on it
|
String |
newInstanceStr()
Return a string that could be write into the target java source code to create an instance of this type
|
String |
resourceNameSuffix()
Return recommended resource name suffix, e.g.
|
void |
setParent(ICodeType parent)
Set the parent type to the embedded type
|
String |
toString() |
public static final ICodeType.DefImpl RAW
public static final ICodeType.DefImpl HTML
public static final ICodeType.DefImpl XML
public static final ICodeType.DefImpl JS
public static final ICodeType.DefImpl CSS
public static final ICodeType.DefImpl JSON
public static final ICodeType.DefImpl CSV
protected DefImpl(String id, String commentStart, String commentEnd, Escape escape, String suffix)
public String newInstanceStr()
ICodeTypeReturn a string that could be write into the target java source code to create an instance of this type
newInstanceStr in interface ICodeTypepublic String commentStart()
ICodeTypeReturn comment start. E.g. for HTML, it should be <!–
commentStart in interface ICodeTypepublic String commentEnd()
ICodeTypeReturn comment end. For HTML it should be –>
commentEnd in interface ICodeTypepublic String blockStart()
ICodeTypeSome type could be embedded into another. E.g. JS and CSS could be embedded into HTML. This method returns a regex string the direct the start of the embedded type.
Note the regex string must support group and the group 1 must be the captured block start. For example, JS block start is <script> or <script type=“…”…>, then the blockStart method of JS type should be (<\s*script\s*.*?<).*
blockStart in interface ICodeTypepublic String blockEnd()
ICodeTypeReturn a regex string indicate an end of a type block
blockEnd in interface ICodeTypefor regex requirementpublic boolean allowInternalTypeBlock()
ICodeTypeReturn true if this file type impl allow another type be embedded inside. e.g. HTML should return true for this method because it allows JS and CSS be embedded inside
allowInternalTypeBlock in interface ICodeTypepublic void setParent(ICodeType parent)
ICodeTypeSet the parent type to the embedded type
public ICodeType getParent()
ICodeTypeReturn parent type or null if there is no parent set on it
public Set<ICodeType> allowedExternalTypes()
ICodeTypeReturn a set of other types that could embed this type impl. For example, JS should return a Set contains an HTML impl. If no other type is allowed to embed this type, then an empty set shall be returned
allowedExternalTypes in interface ICodeTypepublic String resourceNameSuffix()
ICodeTypeReturn recommended resource name suffix, e.g. “.html” etc
resourceNameSuffix in interface ICodeTypeCopyright © 2017–2021 OSGL (Open Source General Library). All rights reserved.