org.rythmengine.extension
Class ICodeType.DefImpl

java.lang.Object
  extended by org.rythmengine.extension.ICodeType.DefImpl
All Implemented Interfaces:
Cloneable, ICodeType
Enclosing interface:
ICodeType

public static class ICodeType.DefImpl
extends Object
implements ICodeType, Cloneable


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.rythmengine.extension.ICodeType
ICodeType.DefImpl
 
Field Summary
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
           
 
Constructor Summary
protected ICodeType.DefImpl(String id, String commentStart, String commentEnd, Escape escape, String suffix)
           
protected ICodeType.DefImpl(String id, String commentStart, String commentEnd, Escape escape, String blockStart, String blockEnd, String suffix)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RAW

public static final ICodeType.DefImpl RAW

HTML

public static final ICodeType.DefImpl HTML

XML

public static final ICodeType.DefImpl XML

JS

public static final ICodeType.DefImpl JS

CSS

public static final ICodeType.DefImpl CSS

JSON

public static final ICodeType.DefImpl JSON

CSV

public static final ICodeType.DefImpl CSV
Constructor Detail

ICodeType.DefImpl

protected ICodeType.DefImpl(String id,
                            String commentStart,
                            String commentEnd,
                            Escape escape,
                            String suffix)

ICodeType.DefImpl

protected ICodeType.DefImpl(String id,
                            String commentStart,
                            String commentEnd,
                            Escape escape,
                            String blockStart,
                            String blockEnd,
                            String suffix)
Method Detail

newInstanceStr

public String newInstanceStr()
Description copied from interface: ICodeType
Return a string that could be write into the target java source code to create an instance of this type

Specified by:
newInstanceStr in interface ICodeType
Returns:
the java code

commentStart

public String commentStart()
Description copied from interface: ICodeType
Return comment start. E.g. for HTML, it should be <!--

Specified by:
commentStart in interface ICodeType
Returns:
comment start

commentEnd

public String commentEnd()
Description copied from interface: ICodeType
Return comment end. For HTML it should be -->

Specified by:
commentEnd in interface ICodeType
Returns:
comment end

escape

public Escape escape()
Description copied from interface: ICodeType
Return escape scheme

Specified by:
escape in interface ICodeType
Returns:
escape

blockStart

public String blockStart()
Description copied from interface: ICodeType
Some 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*.*?\<).*

Specified by:
blockStart in interface ICodeType
Returns:
block start

blockEnd

public String blockEnd()
Description copied from interface: ICodeType
Return a regex string indicate an end of a type block

Specified by:
blockEnd in interface ICodeType
Returns:
block end
See Also:
for regex requirement

allowInternalTypeBlock

public boolean allowInternalTypeBlock()
Description copied from interface: ICodeType
Return 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

Specified by:
allowInternalTypeBlock in interface ICodeType
Returns:
true if this type allows embedded type

setParent

public void setParent(ICodeType parent)
Description copied from interface: ICodeType
Set the parent type to the embedded type

Specified by:
setParent in interface ICodeType

getParent

public ICodeType getParent()
Description copied from interface: ICodeType
Return parent type or null if there is no parent set on it

Specified by:
getParent in interface ICodeType
Returns:
parent type

allowedExternalTypes

public Set<ICodeType> allowedExternalTypes()
Description copied from interface: ICodeType
Return 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

Specified by:
allowedExternalTypes in interface ICodeType
Returns:
true if this type allows external type

resourceNameSuffix

public String resourceNameSuffix()
Description copied from interface: ICodeType
Return recommended resource name suffix, e.g. ".html" etc

Specified by:
resourceNameSuffix in interface ICodeType
Returns:
proposed resource name suffix

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object


Copyright © 2013. All Rights Reserved.