railo.transformer.bytecode.util
Class ASMUtil

java.lang.Object
  extended by railo.transformer.bytecode.util.ASMUtil

public final class ASMUtil
extends Object


Field Summary
static short TYPE_ALL
           
static short TYPE_BOOLEAN
           
static short TYPE_NUMERIC
           
static short TYPE_STRING
           
 
Constructor Summary
ASMUtil()
           
 
Method Summary
static boolean containsComponent(Body body)
           
static String createMD5(ASMProperty[] props)
           
static String createOverfowMethod()
           
static byte[] createPojo(String className, ASMProperty[] properties, Class parent, Class[] interfaces, String srcName)
           
static Tag getAncestorComponent(Statement stat)
           
static FlowControl getAncestorFlowControlStatement(Statement stat)
          get ancestor LoopStatement
static Page getAncestorPage(Statement stat)
           
static Tag getAncestorTag(Tag tag, String fullName)
          Gibt ein �bergeordnetes Tag mit dem �bergebenen Full-Name (Namespace und Name) zur�ck, falls ein solches existiert, andernfalls wird null zur�ckgegeben.
static Statement getAncestorTryStatement(Statement stat)
           
static Boolean getAttributeBoolean(Tag tag, String attrName)
          extract the content of a attribut
static Boolean getAttributeBoolean(Tag tag, String attrName, Boolean defaultValue)
          extract the content of a attribut
static Literal getAttributeLiteral(Tag tag, String attrName)
          extract the content of a attribut
static Literal getAttributeLiteral(Tag tag, String attrName, Literal defaultValue)
          extract the content of a attribut
static String getAttributeString(Tag tag, String attrName)
          extract the content of a attribut
static String getAttributeString(Tag tag, String attrName, String defaultValue)
          extract the content of a attribut
static org.objectweb.asm.ClassWriter getClassWriter()
           
static String getId()
           
static Tag getParentTag(Tag tag)
          Gibt das �bergeordnete CFXD Tag Element zur�ck, falls dies nicht existiert wird null zur�ckgegeben.
static Statement getRoot(Statement stat)
           
static Class getValueTypeClass(org.objectweb.asm.Type type, Class defaultValue)
           
static boolean hasAncestorLoopStatement(Statement stat)
          has ancestor LoopStatement
static boolean hasAncestorTag(Tag tag, String fullName)
          Gibt zur�ck ob das direkt �bergeordnete Tag mit dem �bergebenen Full-Name (Namespace und Name) existiert.
static boolean hasAncestorTryStatement(Statement stat)
           
static boolean hasSisterTagAfter(Tag tag, String nameToFind)
          Pr�ft ob das das angegebene Tag in der gleichen Ebene nach dem angegebenen Tag vorkommt.
static boolean hasSisterTagWithSameName(Tag tag)
          Pr�ft ob das angegebene Tag innerhalb seiner Ebene einmalig ist oder nicht.
static void invokeMethod(org.objectweb.asm.commons.GeneratorAdapter adapter, org.objectweb.asm.Type type, org.objectweb.asm.commons.Method method)
           
static boolean isCFC(Statement s)
           
static boolean isDotKey(ExprString expr)
           
static boolean isEmpty(Body body)
           
static boolean isLiteralAttribute(Tag tag, String attrName, short type, boolean required, boolean throwWhenNot)
           
static boolean isOverfowMethod(String name)
           
static boolean isParentTag(Tag tag, Class clazz)
           
static boolean isParentTag(Tag tag, String fullName)
           
static boolean isRefType(org.objectweb.asm.Type type)
           
static boolean isRoot(Statement statement)
           
static void listAncestor(Statement stat)
           
static int loadFor(org.objectweb.asm.Type type)
           
static void pop(org.objectweb.asm.commons.GeneratorAdapter adapter, Expression expr, int mode)
           
static void pop(org.objectweb.asm.commons.GeneratorAdapter adapter, org.objectweb.asm.Type type)
           
static void remove(Tag tag)
          remove this tag from his parent body
static void removeLiterlChildren(Tag tag, boolean recursive)
           
static void replace(Tag src, Tag trg, boolean moveBody)
          replace src with trg
static int sizeOf(org.objectweb.asm.Type type)
           
static Boolean toBoolean(Attribute attr, int line)
           
static Boolean toBoolean(Attribute attr, int line, Boolean defaultValue)
           
static org.objectweb.asm.Type toRefType(org.objectweb.asm.Type type)
           
static String toString(Expression exp)
           
static String toString(Expression exp, String defaultValue)
           
static org.objectweb.asm.Type toType(Class type, boolean axistype)
          translate a string cfml type definition to a Type Object
static org.objectweb.asm.Type toType(String cfType, boolean axistype)
          translate a string cfml type definition to a Type Object
static org.objectweb.asm.Type toValueType(org.objectweb.asm.Type type)
          return value type only when there is one
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_ALL

public static final short TYPE_ALL
See Also:
Constant Field Values

TYPE_BOOLEAN

public static final short TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_NUMERIC

public static final short TYPE_NUMERIC
See Also:
Constant Field Values

TYPE_STRING

public static final short TYPE_STRING
See Also:
Constant Field Values
Constructor Detail

ASMUtil

public ASMUtil()
Method Detail

hasAncestorTag

public static boolean hasAncestorTag(Tag tag,
                                     String fullName)
Gibt zur�ck ob das direkt �bergeordnete Tag mit dem �bergebenen Full-Name (Namespace und Name) existiert.

Parameters:
el - Startelement, von wo aus gesucht werden soll.
fullName - Name des gesuchten Tags.
Returns:
Existiert ein solches Tag oder nicht.

getParentTag

public static Tag getParentTag(Tag tag)
Gibt das �bergeordnete CFXD Tag Element zur�ck, falls dies nicht existiert wird null zur�ckgegeben.

Parameters:
el - Element von dem das parent Element zur�ckgegeben werden soll.
Returns:
�bergeordnete CFXD Tag Element

isParentTag

public static boolean isParentTag(Tag tag,
                                  String fullName)

isParentTag

public static boolean isParentTag(Tag tag,
                                  Class clazz)

hasAncestorLoopStatement

public static boolean hasAncestorLoopStatement(Statement stat)
has ancestor LoopStatement

Parameters:
stat -
Returns:

getAncestorFlowControlStatement

public static FlowControl getAncestorFlowControlStatement(Statement stat)
get ancestor LoopStatement

Parameters:
stat -
ingoreScript -
Returns:

hasAncestorTryStatement

public static boolean hasAncestorTryStatement(Statement stat)

getAncestorTryStatement

public static Statement getAncestorTryStatement(Statement stat)

getAncestorTag

public static Tag getAncestorTag(Tag tag,
                                 String fullName)
Gibt ein �bergeordnetes Tag mit dem �bergebenen Full-Name (Namespace und Name) zur�ck, falls ein solches existiert, andernfalls wird null zur�ckgegeben.

Parameters:
el - Startelement, von wo aus gesucht werden soll.
fullName - Name des gesuchten Tags.
Returns:
�bergeornetes Element oder null.

getAttributeBoolean

public static Boolean getAttributeBoolean(Tag tag,
                                          String attrName)
                                   throws EvaluatorException
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

getAttributeBoolean

public static Boolean getAttributeBoolean(Tag tag,
                                          String attrName,
                                          Boolean defaultValue)
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

getAttributeString

public static String getAttributeString(Tag tag,
                                        String attrName)
                                 throws EvaluatorException
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

getAttributeString

public static String getAttributeString(Tag tag,
                                        String attrName,
                                        String defaultValue)
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

getAttributeLiteral

public static Literal getAttributeLiteral(Tag tag,
                                          String attrName)
                                   throws EvaluatorException
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

getAttributeLiteral

public static Literal getAttributeLiteral(Tag tag,
                                          String attrName,
                                          Literal defaultValue)
extract the content of a attribut

Parameters:
cfxdTag -
attrName -
Returns:
attribute value
Throws:
EvaluatorException

hasSisterTagAfter

public static boolean hasSisterTagAfter(Tag tag,
                                        String nameToFind)
Pr�ft ob das das angegebene Tag in der gleichen Ebene nach dem angegebenen Tag vorkommt.

Parameters:
tag - Ausgangspunkt, nach diesem tag darf das angegebene nicht vorkommen.
nameToFind - Tag Name der nicht vorkommen darf
Returns:
kommt das Tag vor.

hasSisterTagWithSameName

public static boolean hasSisterTagWithSameName(Tag tag)
Pr�ft ob das angegebene Tag innerhalb seiner Ebene einmalig ist oder nicht.

Parameters:
tag - Ausgangspunkt, nach diesem tag darf das angegebene nicht vorkommen.
Returns:
kommt das Tag vor.

remove

public static void remove(Tag tag)
remove this tag from his parent body

Parameters:
tag -

replace

public static void replace(Tag src,
                           Tag trg,
                           boolean moveBody)
replace src with trg

Parameters:
src -
trg -

getAncestorPage

public static Page getAncestorPage(Statement stat)
                            throws BytecodeException
Throws:
BytecodeException

listAncestor

public static void listAncestor(Statement stat)
                         throws BytecodeException
Throws:
BytecodeException

getAncestorComponent

public static Tag getAncestorComponent(Statement stat)
                                throws BytecodeException
Throws:
BytecodeException

getRoot

public static Statement getRoot(Statement stat)

isRoot

public static boolean isRoot(Statement statement)

invokeMethod

public static void invokeMethod(org.objectweb.asm.commons.GeneratorAdapter adapter,
                                org.objectweb.asm.Type type,
                                org.objectweb.asm.commons.Method method)

createPojo

public static byte[] createPojo(String className,
                                ASMProperty[] properties,
                                Class parent,
                                Class[] interfaces,
                                String srcName)
                         throws PageException
Throws:
PageException

loadFor

public static int loadFor(org.objectweb.asm.Type type)

sizeOf

public static int sizeOf(org.objectweb.asm.Type type)

toType

public static org.objectweb.asm.Type toType(String cfType,
                                            boolean axistype)
                                     throws PageException
translate a string cfml type definition to a Type Object

Parameters:
cfType -
axistype -
Returns:
Throws:
PageException

toType

public static org.objectweb.asm.Type toType(Class type,
                                            boolean axistype)
translate a string cfml type definition to a Type Object

Parameters:
cfType -
axistype -
Returns:
Throws:
PageException

createMD5

public static String createMD5(ASMProperty[] props)

removeLiterlChildren

public static void removeLiterlChildren(Tag tag,
                                        boolean recursive)

getId

public static String getId()

isEmpty

public static boolean isEmpty(Body body)

pop

public static void pop(org.objectweb.asm.commons.GeneratorAdapter adapter,
                       Expression expr,
                       int mode)
Parameters:
adapter -
expr -
mode -

pop

public static void pop(org.objectweb.asm.commons.GeneratorAdapter adapter,
                       org.objectweb.asm.Type type)

getClassWriter

public static org.objectweb.asm.ClassWriter getClassWriter()

createOverfowMethod

public static String createOverfowMethod()

isOverfowMethod

public static boolean isOverfowMethod(String name)

isDotKey

public static boolean isDotKey(ExprString expr)

toString

public static String toString(Expression exp,
                              String defaultValue)

toString

public static String toString(Expression exp)
                       throws BytecodeException
Throws:
BytecodeException

toBoolean

public static Boolean toBoolean(Attribute attr,
                                int line)
                         throws BytecodeException
Throws:
BytecodeException

toBoolean

public static Boolean toBoolean(Attribute attr,
                                int line,
                                Boolean defaultValue)

isCFC

public static boolean isCFC(Statement s)

isLiteralAttribute

public static boolean isLiteralAttribute(Tag tag,
                                         String attrName,
                                         short type,
                                         boolean required,
                                         boolean throwWhenNot)
                                  throws EvaluatorException
Throws:
EvaluatorException

isRefType

public static boolean isRefType(org.objectweb.asm.Type type)

toRefType

public static org.objectweb.asm.Type toRefType(org.objectweb.asm.Type type)

toValueType

public static org.objectweb.asm.Type toValueType(org.objectweb.asm.Type type)
return value type only when there is one

Parameters:
type -
Returns:

getValueTypeClass

public static Class getValueTypeClass(org.objectweb.asm.Type type,
                                      Class defaultValue)

containsComponent

public static boolean containsComponent(Body body)


Copyright © 2012 Railo