de.unkrig.commons.asm
Class StringConcatenator

java.lang.Object
  extended by de.unkrig.commons.asm.StringConcatenator

public class StringConcatenator
extends java.lang.Object

Bytecode generator for StringBuilder-based concatenation of strings.


Constructor Summary
StringConcatenator()
           
 
Method Summary
 StringConcatenator appendConstant(java.lang.String value)
          Registers the given constant string, which will be added on finish().
 StringConcatenator appendVariable(org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.Type type)
          Registers the given code fragment, which will be executed, and the result added on finish().
 StringConcatenator appendVariablePrettily(org.objectweb.asm.tree.InsnList code, org.objectweb.asm.Type type)
          Registers the given code fragment, which will be executed, and the result added on finish().
 org.objectweb.asm.tree.InsnList finish()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringConcatenator

public StringConcatenator()
Method Detail

appendConstant

public StringConcatenator appendConstant(java.lang.String value)
Registers the given constant string, which will be added on finish().

Returns:
this

appendVariable

public StringConcatenator appendVariable(org.objectweb.asm.tree.InsnList insns,
                                         org.objectweb.asm.Type type)
Registers the given code fragment, which will be executed, and the result added on finish().

Parameters:
insns - Instructions which must produce exactly one value of type on the operand stack
Returns:
this

appendVariablePrettily

public StringConcatenator appendVariablePrettily(org.objectweb.asm.tree.InsnList code,
                                                 org.objectweb.asm.Type type)
Registers the given code fragment, which will be executed, and the result added on finish(). If the type is an array, a string, StringBuffer, StringBuilder, CharSequence or a char, then it is 'pretty-printed' i nthe style of a Java constant.

Parameters:
code - Instructions which must produce exactly one value of type on the operand stack
Returns:
this

finish

public org.objectweb.asm.tree.InsnList finish()
Returns:
The InsnList that implements the creation of the string result