signature:
public class ArraysUtil { /** * Converts to object array . */
public static Short [ ] valuesOf ( short [ ] array ) { } }

implementation: Short [ ] dest = new Short [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Short . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Converts to primitive array . */
public static int [ ] values ( Integer [ ] array ) { } }

implementation: int [ ] dest = new int [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { Integer v = array [ i ] ; if ( v != null ) { dest [ i ] = v . intValue ( ) ; } } return dest ;


signature:
public class ArraysUtil { /** * Converts to object array . */
public static Integer [ ] valuesOf ( int [ ] array ) { } }

implementation: Integer [ ] dest = new Integer [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Integer . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Converts to primitive array . */
public static long [ ] values ( Long [ ] array ) { } }

implementation: long [ ] dest = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { Long v = array [ i ] ; if ( v != null ) { dest [ i ] = v . longValue ( ) ; } } return dest ;


signature:
public class ArraysUtil { /** * Converts to object array . */
public static Long [ ] valuesOf ( long [ ] array ) { } }

implementation: Long [ ] dest = new Long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Long . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Converts to primitive array . */
public static float [ ] values ( Float [ ] array ) { } }

implementation: float [ ] dest = new float [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { Float v = array [ i ] ; if ( v != null ) { dest [ i ] = v . floatValue ( ) ; } } return dest ;


signature:
public class ArraysUtil { /** * Converts to object array . */
public static Float [ ] valuesOf ( float [ ] array ) { } }

implementation: Float [ ] dest = new Float [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Float . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Converts to primitive array . */
public static double [ ] values ( Double [ ] array ) { } }

implementation: double [ ] dest = new double [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { Double v = array [ i ] ; if ( v != null ) { dest [ i ] = v . doubleValue ( ) ; } } return dest ;


signature:
public class ArraysUtil { /** * Converts to object array . */
public static Double [ ] valuesOf ( double [ ] array ) { } }

implementation: Double [ ] dest = new Double [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Double . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Converts to primitive array . */
public static boolean [ ] values ( Boolean [ ] array ) { } }

implementation: boolean [ ] dest = new boolean [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { Boolean v = array [ i ] ; if ( v != null ) { dest [ i ] = v . booleanValue ( ) ; } } return dest ;


signature:
public class ArraysUtil { /** * Converts to object array . */
public static Boolean [ ] valuesOf ( boolean [ ] array ) { } }

implementation: Boolean [ ] dest = new Boolean [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { dest [ i ] = Boolean . valueOf ( array [ i ] ) ; } return dest ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in an array from specified given position and upto given length . */
public static int indexOf ( byte [ ] array , byte value , int startIndex , int endIndex ) { } }

implementation: for ( int i = startIndex ; i < endIndex ; i ++ ) { if ( array [ i ] == value ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence of an element in an array . */
public static int indexOf ( char [ ] array , char value ) { } }

implementation: for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == value ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence of value in < code > float < / code > array . */
public static int indexOf ( float [ ] array , float value ) { } }

implementation: for ( int i = 0 ; i < array . length ; i ++ ) { if ( Float . compare ( array [ i ] , value ) == 0 ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in < code > float < / code > array from specified given position and upto given length . */
public static int indexOf ( float [ ] array , float value , int startIndex , int endIndex ) { } }

implementation: for ( int i = startIndex ; i < endIndex ; i ++ ) { if ( Float . compare ( array [ i ] , value ) == 0 ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence of value in < code > double < / code > array . */
public static int indexOf ( double [ ] array , double value ) { } }

implementation: for ( int i = 0 ; i < array . length ; i ++ ) { if ( Double . compare ( array [ i ] , value ) == 0 ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in < code > double < / code > array from specified given position and upto given length . */
public static int indexOf ( double [ ] array , double value , int startIndex , int endIndex ) { } }

implementation: for ( int i = startIndex ; i < endIndex ; i ++ ) { if ( Double . compare ( array [ i ] , value ) == 0 ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in an array . */
public static int indexOf ( Object [ ] array , Object value ) { } }

implementation: for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] . equals ( value ) ) { return i ; } } return - 1 ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in an array from specified given position . */
public static int indexOf ( byte [ ] array , byte [ ] sub , int startIndex ) { } }

implementation: return indexOf ( array , sub , startIndex , array . length ) ;


signature:
public class ArraysUtil { /** * Finds the first occurrence in an array from specified given position and upto given length . */
public static int indexOf ( double [ ] array , double [ ] sub , int startIndex , int endIndex ) { } }

implementation: int sublen = sub . length ; if ( sublen == 0 ) { return startIndex ; } int total = endIndex - sublen + 1 ; double c = sub [ 0 ] ; mainloop : for ( int i = startIndex ; i < total ; i ++ ) { if ( Double . compare ( array [ i ] , c ) != 0 ) { continue ; } int j = 1 ; int k = i + 1 ; while ( j < sublen ) { if ( Double . compare ( sub [ j ] , array [ k ] ) != 0 ) { continue mainloop ; } j ++ ; k ++ ; } return i ; } return - 1 ;


signature:
public class ArraysUtil { /** * Converts an array to string array . */
public static String [ ] toStringArray ( Object [ ] array ) { } }

implementation: if ( array == null ) { return null ; } String [ ] result = new String [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = StringUtil . toString ( array [ i ] ) ; } return result ;


signature:
public class ArraysUtil { /** * Converts an array to string array . */
public static String [ ] toStringArray ( String [ ] array ) { } }

implementation: if ( array == null ) { return null ; } String [ ] result = new String [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = String . valueOf ( array [ i ] ) ; } return result ;


signature:
public class LagartoDOMBuilder { /** * Enables XHTML mode . */
public LagartoDOMBuilder enableXhtmlMode ( ) { } }

implementation:
config . ignoreWhitespacesBetweenTags = false ; // collect all whitespaces
config . setCaseSensitive ( true ) ; // XHTML is case sensitive
config . setEnableRawTextModes ( false ) ; // all tags are parsed in the same way
config . enabledVoidTags = true ; // list of void tags
config . selfCloseVoidTags = true ; // self close void tags
config . impliedEndTags = false ; // no implied tag ends
config . setEnableConditionalComments ( false ) ; // don ' t enable IE conditional comments
config . setParseXmlTags ( false ) ; // enable XML mode in parsing
return this ;


signature:
public class LagartoDOMBuilder { /** * Creates DOM tree from provided content . */
@ Override public Document parse ( final char [ ] content ) { } }

implementation: LagartoParser lagartoParser = new LagartoParser ( content ) ; return doParse ( lagartoParser ) ;


signature:
public class LagartoDOMBuilder { /** * Parses the content using provided lagarto parser . */
protected Document doParse ( final LagartoParser lagartoParser ) { } }

implementation: lagartoParser . setConfig ( config ) ; LagartoDOMBuilderTagVisitor domBuilderTagVisitor = new LagartoDOMBuilderTagVisitor ( this ) ; lagartoParser . parse ( domBuilderTagVisitor ) ; return domBuilderTagVisitor . getDocument ( ) ;


signature: public class MethodWriter { @ Override public void visitParameter ( final String name , final int access ) { } }

implementation: if ( parameters == null ) { parameters = new ByteVector ( ) ; } ++ parametersCount ; parameters . putShort ( ( name == null ) ? 0 : symbolTable . addConstantUtf8 ( name ) ) . putShort ( access ) ;


signature:
public class MethodWriter { /** * Computes all the stack map frames of the method , from scratch . */
private void computeAllFrames ( ) { } }

implementation:
// Complete the control flow graph with exception handler blocks .
Handler handler = firstHandler ; while ( handler != null ) { String catchTypeDescriptor = handler . catchTypeDescriptor == null ? "java/lang/Throwable" : handler . catchTypeDescriptor ; int catchType = Frame . getAbstractTypeFromInternalName ( symbolTable , catchTypeDescriptor ) ; // Mark handlerBlock as an exception handler .
Label handlerBlock = handler . handlerPc . getCanonicalInstance ( ) ; handlerBlock . flags |= Label . FLAG_JUMP_TARGET ; // Add handlerBlock as a successor of all the basic blocks in the exception handler range .
Label handlerRangeBlock = handler . startPc . getCanonicalInstance ( ) ; Label handlerRangeEnd = handler . endPc . getCanonicalInstance ( ) ; while ( handlerRangeBlock != handlerRangeEnd ) { handlerRangeBlock . outgoingEdges = new Edge ( catchType , handlerBlock , handlerRangeBlock . outgoingEdges ) ; handlerRangeBlock = handlerRangeBlock . nextBasicBlock ; } handler = handler . nextHandler ; } // Create and visit the first ( implicit ) frame .
Frame firstFrame = firstBasicBlock . frame ; firstFrame . setInputFrameFromDescriptor ( symbolTable , accessFlags , descriptor , this . maxLocals ) ; firstFrame . accept ( this ) ; // Fix point algorithm : add the first basic block to a list of blocks to process ( i . e . blocks
// whose stack map frame has changed ) and , while there are blocks to process , remove one from
// the list and update the stack map frames of its successor blocks in the control flow graph
// ( which might change them , in which case these blocks must be processed too , and are thus
// added to the list of blocks to process ) . Also compute the maximum stack size of the method ,
// as a by - product .
Label listOfBlocksToProcess = firstBasicBlock ; listOfBlocksToProcess . nextListElement = Label . EMPTY_LIST ; int maxStackSize = 0 ; while ( listOfBlocksToProcess != Label . EMPTY_LIST ) { // Remove a basic block from the list of blocks to process .
Label basicBlock = listOfBlocksToProcess ; listOfBlocksToProcess = listOfBlocksToProcess . nextListElement ; basicBlock . nextListElement = null ; // By definition , basicBlock is reachable .
basicBlock . flags |= Label . FLAG_REACHABLE ; // Update the ( absolute ) maximum stack size .
int maxBlockStackSize = basicBlock . frame . getInputStackSize ( ) + basicBlock . outputStackMax ; if ( maxBlockStackSize > maxStackSize ) { maxStackSize = maxBlockStackSize ; } // Update the successor blocks of basicBlock in the control flow graph .
Edge outgoingEdge = basicBlock . outgoingEdges ; while ( outgoingEdge != null ) { Label successorBlock = outgoingEdge . successor . getCanonicalInstance ( ) ; boolean successorBlockChanged = basicBlock . frame . merge ( symbolTable , successorBlock . frame , outgoingEdge . info ) ; if ( successorBlockChanged && successorBlock . nextListElement == null ) { // If successorBlock has changed it must be processed . Thus , if it is not already in the
// list of blocks to process , add it to this list .
successorBlock . nextListElement = listOfBlocksToProcess ; listOfBlocksToProcess = successorBlock ; } outgoingEdge = outgoingEdge . nextEdge ; } } // Loop over all the basic blocks and visit the stack map frames that must be stored in the
// StackMapTable attribute . Also replace unreachable code with NOP * ATHROW , and remove it from
// exception handler ranges .
Label basicBlock = firstBasicBlock ; while ( basicBlock != null ) { if ( ( basicBlock . flags & ( Label . FLAG_JUMP_TARGET | Label . FLAG_REACHABLE ) ) == ( Label . FLAG_JUMP_TARGET | Label . FLAG_REACHABLE ) ) { basicBlock . frame . accept ( this ) ; } if ( ( basicBlock . flags & Label . FLAG_REACHABLE ) == 0 ) { // Find the start and end bytecode offsets of this unreachable block .
Label nextBasicBlock = basicBlock . nextBasicBlock ; int startOffset = basicBlock . bytecodeOffset ; int endOffset = ( nextBasicBlock == null ? code . length : nextBasicBlock . bytecodeOffset ) - 1 ; if ( endOffset >= startOffset ) { // Replace its instructions with NOP . . . NOP ATHROW .
for ( int i = startOffset ; i < endOffset ; ++ i ) { code . data [ i ] = Opcodes . NOP ; } code . data [ endOffset ] = ( byte ) Opcodes . ATHROW ; // Emit a frame for this unreachable block , with no local and a Throwable on the stack
// ( so that the ATHROW could consume this Throwable if it were reachable ) .
int frameIndex = visitFrameStart ( startOffset , /* numLocal = */
0 , /* numStack = */
1 ) ; currentFrame [ frameIndex ] = Frame . getAbstractTypeFromInternalName ( symbolTable , "java/lang/Throwable" ) ; visitFrameEnd ( ) ; // Remove this unreachable basic block from the exception handler ranges .
firstHandler = Handler . removeRange ( firstHandler , basicBlock , nextBasicBlock ) ; // The maximum stack size is now at least one , because of the Throwable declared above .
maxStackSize = Math . max ( maxStackSize , 1 ) ; } } basicBlock = basicBlock . nextBasicBlock ; } this . maxStack = maxStackSize ;


signature:
public class MethodWriter { /** * Computes the maximum stack size of the method . */
private void computeMaxStackAndLocal ( ) { } }

implementation:
// Complete the control flow graph with exception handler blocks .
Handler handler = firstHandler ; while ( handler != null ) { Label handlerBlock = handler . handlerPc ; Label handlerRangeBlock = handler . startPc ; Label handlerRangeEnd = handler . endPc ; // Add handlerBlock as a successor of all the basic blocks in the exception handler range .
while ( handlerRangeBlock != handlerRangeEnd ) { if ( ( handlerRangeBlock . flags & Label . FLAG_SUBROUTINE_CALLER ) == 0 ) { handlerRangeBlock . outgoingEdges = new Edge ( Edge . EXCEPTION , handlerBlock , handlerRangeBlock . outgoingEdges ) ; } else { // If handlerRangeBlock is a JSR block , add handlerBlock after the first two outgoing
// edges to preserve the hypothesis about JSR block successors order ( see
// { @ link # visitJumpInsn } ) .
handlerRangeBlock . outgoingEdges . nextEdge . nextEdge = new Edge ( Edge . EXCEPTION , handlerBlock , handlerRangeBlock . outgoingEdges . nextEdge . nextEdge ) ; } handlerRangeBlock = handlerRangeBlock . nextBasicBlock ; } handler = handler . nextHandler ; } // Complete the control flow graph with the successor blocks of subroutines , if needed .
if ( hasSubroutines ) { // First step : find the subroutines . This step determines , for each basic block , to which
// subroutine ( s ) it belongs . Start with the main " subroutine " :
short numSubroutines = 1 ; firstBasicBlock . markSubroutine ( numSubroutines ) ; // Then , mark the subroutines called by the main subroutine , then the subroutines called by
// those called by the main subroutine , etc .
for ( short currentSubroutine = 1 ; currentSubroutine <= numSubroutines ; ++ currentSubroutine ) { Label basicBlock = firstBasicBlock ; while ( basicBlock != null ) { if ( ( basicBlock . flags & Label . FLAG_SUBROUTINE_CALLER ) != 0 && basicBlock . subroutineId == currentSubroutine ) { Label jsrTarget = basicBlock . outgoingEdges . nextEdge . successor ; if ( jsrTarget . subroutineId == 0 ) { // If this subroutine has not been marked yet , find its basic blocks .
jsrTarget . markSubroutine ( ++ numSubroutines ) ; } } basicBlock = basicBlock . nextBasicBlock ; } } // Second step : find the successors in the control flow graph of each subroutine basic block
// ' r ' ending with a RET instruction . These successors are the virtual successors of the basic
// blocks ending with JSR instructions ( see { @ link # visitJumpInsn ) } that can reach ' r ' .
Label basicBlock = firstBasicBlock ; while ( basicBlock != null ) { if ( ( basicBlock . flags & Label . FLAG_SUBROUTINE_CALLER ) != 0 ) { // By construction , jsr targets are stored in the second outgoing edge of basic blocks
// that ends with a jsr instruction ( see { @ link # FLAG _ SUBROUTINE _ CALLER } ) .
Label subroutine = basicBlock . outgoingEdges . nextEdge . successor ; subroutine . addSubroutineRetSuccessors ( basicBlock ) ; } basicBlock = basicBlock . nextBasicBlock ; } } // Data flow algorithm : put the first basic block in a list of blocks to process ( i . e . blocks
// whose input stack size has changed ) and , while there are blocks to process , remove one
// from the list , update the input stack size of its successor blocks in the control flow
// graph , and add these blocks to the list of blocks to process ( if not already done ) .
Label listOfBlocksToProcess = firstBasicBlock ; listOfBlocksToProcess . nextListElement = Label . EMPTY_LIST ; int maxStackSize = maxStack ; while ( listOfBlocksToProcess != Label . EMPTY_LIST ) { // Remove a basic block from the list of blocks to process . Note that we don ' t reset
// basicBlock . nextListElement to null on purpose , to make sure we don ' t reprocess already
// processed basic blocks .
Label basicBlock = listOfBlocksToProcess ; listOfBlocksToProcess = listOfBlocksToProcess . nextListElement ; // Compute the ( absolute ) input stack size and maximum stack size of this block .
int inputStackTop = basicBlock . inputStackSize ; int maxBlockStackSize = inputStackTop + basicBlock . outputStackMax ; // Update the absolute maximum stack size of the method .
if ( maxBlockStackSize > maxStackSize ) { maxStackSize = maxBlockStackSize ; } // Update the input stack size of the successor blocks of basicBlock in the control flow
// graph , and add these blocks to the list of blocks to process , if not already done .
Edge outgoingEdge = basicBlock . outgoingEdges ; if ( ( basicBlock . flags & Label . FLAG_SUBROUTINE_CALLER ) != 0 ) { // Ignore the first outgoing edge of the basic blocks ending with a jsr : these are virtual
// edges which lead to the instruction just after the jsr , and do not correspond to a
// possible execution path ( see { @ link # visitJumpInsn } and
// { @ link Label # FLAG _ SUBROUTINE _ CALLER } ) .
outgoingEdge = outgoingEdge . nextEdge ; } while ( outgoingEdge != null ) { Label successorBlock = outgoingEdge . successor ; if ( successorBlock . nextListElement == null ) { successorBlock . inputStackSize = ( short ) ( outgoingEdge . info == Edge . EXCEPTION ? 1 : inputStackTop + outgoingEdge . info ) ; successorBlock . nextListElement = listOfBlocksToProcess ; listOfBlocksToProcess = successorBlock ; } outgoingEdge = outgoingEdge . nextEdge ; } } this . maxStack = maxStackSize ;


signature:
public class MethodWriter { /** * Adds a successor to { @ link # currentBasicBlock } in the control flow graph .
 * @ param info information about the control flow edge to be added .
 * @ param successor the successor block to be added to the current basic block . */
private void addSuccessorToCurrentBasicBlock ( final int info , final Label successor ) { } }

implementation: currentBasicBlock . outgoingEdges = new Edge ( info , successor , currentBasicBlock . outgoingEdges ) ;


signature:
public class MethodWriter { /** * Ends the current basic block . This method must be used in the case where the current basic
 * block does not have any successor .
 * < p > WARNING : this method must be called after the currently visited instruction has been put in
 * { @ link # code } ( if frames are computed , this method inserts a new Label to start a new basic
 * block after the current instruction ) . */
private void endCurrentBasicBlockWithNoSuccessor ( ) { } }

implementation: if ( compute == COMPUTE_ALL_FRAMES ) { Label nextBasicBlock = new Label ( ) ; nextBasicBlock . frame = new Frame ( nextBasicBlock ) ; nextBasicBlock . resolve ( code . data , code . length ) ; lastBasicBlock . nextBasicBlock = nextBasicBlock ; lastBasicBlock = nextBasicBlock ; currentBasicBlock = null ; } else if ( compute == COMPUTE_MAX_STACK_AND_LOCAL ) { currentBasicBlock . outputStackMax = ( short ) maxRelativeStackSize ; currentBasicBlock = null ; }


signature:
public class MethodWriter { /** * Starts the visit of a new stack map frame , stored in { @ link # currentFrame } .
 * @ param offset the bytecode offset of the instruction to which the frame corresponds .
 * @ param numLocal the number of local variables in the frame .
 * @ param numStack the number of stack elements in the frame .
 * @ return the index of the next element to be written in this frame . */
int visitFrameStart ( final int offset , final int numLocal , final int numStack ) { } }

implementation: int frameLength = 3 + numLocal + numStack ; if ( currentFrame == null || currentFrame . length < frameLength ) { currentFrame = new int [ frameLength ] ; } currentFrame [ 0 ] = offset ; currentFrame [ 1 ] = numLocal ; currentFrame [ 2 ] = numStack ; return 3 ;


signature:
public class MethodWriter { /** * Ends the visit of { @ link # currentFrame } by writing it in the StackMapTable entries and by
 * updating the StackMapTable number _ of _ entries ( except if the current frame is the first one ,
 * which is implicit in StackMapTable ) . Then resets { @ link # currentFrame } to { @ literal null } . */
void visitFrameEnd ( ) { } }

implementation: if ( previousFrame != null ) { if ( stackMapTableEntries == null ) { stackMapTableEntries = new ByteVector ( ) ; } putFrame ( ) ; ++ stackMapTableNumberOfEntries ; } previousFrame = currentFrame ; currentFrame = null ;


signature:
public class MethodWriter { /** * Compresses and writes { @ link # currentFrame } in a new StackMapTable entry . */
private void putFrame ( ) { } }

implementation:
final int numLocal = currentFrame [ 1 ] ; final int numStack = currentFrame [ 2 ] ; if ( symbolTable . getMajorVersion ( ) < Opcodes . V1_6 ) { // Generate a StackMap attribute entry , which are always uncompressed .
stackMapTableEntries . putShort ( currentFrame [ 0 ] ) . putShort ( numLocal ) ; putAbstractTypes ( 3 , 3 + numLocal ) ; stackMapTableEntries . putShort ( numStack ) ; putAbstractTypes ( 3 + numLocal , 3 + numLocal + numStack ) ; return ; } final int offsetDelta = stackMapTableNumberOfEntries == 0 ? currentFrame [ 0 ] : currentFrame [ 0 ] - previousFrame [ 0 ] - 1 ; final int previousNumlocal = previousFrame [ 1 ] ; final int numLocalDelta = numLocal - previousNumlocal ; int type = Frame . FULL_FRAME ; if ( numStack == 0 ) { switch ( numLocalDelta ) { case - 3 : case - 2 : case - 1 : type = Frame . CHOP_FRAME ; break ; case 0 : type = offsetDelta < 64 ? Frame . SAME_FRAME : Frame . SAME_FRAME_EXTENDED ; break ; case 1 : case 2 : case 3 : type = Frame . APPEND_FRAME ; break ; default : // Keep the FULL _ FRAME type .
break ; } } else if ( numLocalDelta == 0 && numStack == 1 ) { type = offsetDelta < 63 ? Frame . SAME_LOCALS_1_STACK_ITEM_FRAME : Frame . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED ; } if ( type != Frame . FULL_FRAME ) { // Verify if locals are the same as in the previous frame .
int frameIndex = 3 ; for ( int i = 0 ; i < previousNumlocal && i < numLocal ; i ++ ) { if ( currentFrame [ frameIndex ] != previousFrame [ frameIndex ] ) { type = Frame . FULL_FRAME ; break ; } frameIndex ++ ; } } switch ( type ) { case Frame . SAME_FRAME : stackMapTableEntries . putByte ( offsetDelta ) ; break ; case Frame . SAME_LOCALS_1_STACK_ITEM_FRAME : stackMapTableEntries . putByte ( Frame . SAME_LOCALS_1_STACK_ITEM_FRAME + offsetDelta ) ; putAbstractTypes ( 3 + numLocal , 4 + numLocal ) ; break ; case Frame . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED : stackMapTableEntries . putByte ( Frame . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED ) . putShort ( offsetDelta ) ; putAbstractTypes ( 3 + numLocal , 4 + numLocal ) ; break ; case Frame . SAME_FRAME_EXTENDED : stackMapTableEntries . putByte ( Frame . SAME_FRAME_EXTENDED ) . putShort ( offsetDelta ) ; break ; case Frame . CHOP_FRAME : stackMapTableEntries . putByte ( Frame . SAME_FRAME_EXTENDED + numLocalDelta ) . putShort ( offsetDelta ) ; break ; case Frame . APPEND_FRAME : stackMapTableEntries . putByte ( Frame . SAME_FRAME_EXTENDED + numLocalDelta ) . putShort ( offsetDelta ) ; putAbstractTypes ( 3 + previousNumlocal , 3 + numLocal ) ; break ; case Frame . FULL_FRAME : default : stackMapTableEntries . putByte ( Frame . FULL_FRAME ) . putShort ( offsetDelta ) . putShort ( numLocal ) ; putAbstractTypes ( 3 , 3 + numLocal ) ; stackMapTableEntries . putShort ( numStack ) ; putAbstractTypes ( 3 + numLocal , 3 + numLocal + numStack ) ; break ; }


signature:
public class MethodWriter { /** * Puts some abstract types of { @ link # currentFrame } in { @ link # stackMapTableEntries } , using the
 * JVMS verification _ type _ info format used in StackMapTable attributes .
 * @ param start index of the first type in { @ link # currentFrame } to write .
 * @ param end index of last type in { @ link # currentFrame } to write ( exclusive ) . */
private void putAbstractTypes ( final int start , final int end ) { } }

implementation: for ( int i = start ; i < end ; ++ i ) { Frame . putAbstractType ( symbolTable , currentFrame [ i ] , stackMapTableEntries ) ; }


signature:
public class MethodWriter { /** * Puts the given public API frame element type in { @ link # stackMapTableEntries } , using the JVMS
 * verification _ type _ info format used in StackMapTable attributes .
 * @ param type a frame element type described using the same format as in { @ link
 * MethodVisitor # visitFrame } , i . e . either { @ link Opcodes # TOP } , { @ link Opcodes # INTEGER } , { @ link
 * Opcodes # FLOAT } , { @ link Opcodes # LONG } , { @ link Opcodes # DOUBLE } , { @ link Opcodes # NULL } , or
 * { @ link Opcodes # UNINITIALIZED _ THIS } , or the internal name of a class , or a Label designating
 * a NEW instruction ( for uninitialized types ) . */
private void putFrameType ( final Object type ) { } }

implementation: if ( type instanceof Integer ) { stackMapTableEntries . putByte ( ( ( Integer ) type ) . intValue ( ) ) ; } else if ( type instanceof String ) { stackMapTableEntries . putByte ( Frame . ITEM_OBJECT ) . putShort ( symbolTable . addConstantClass ( ( String ) type ) . index ) ; } else { stackMapTableEntries . putByte ( Frame . ITEM_UNINITIALIZED ) . putShort ( ( ( Label ) type ) . bytecodeOffset ) ; }


signature:
public class MethodWriter { /** * Returns whether the attributes of this method can be copied from the attributes of the given
 * method ( assuming there is no method visitor between the given ClassReader and this
 * MethodWriter ) . This method should only be called just after this MethodWriter has been created ,
 * and before any content is visited . It returns true if the attributes corresponding to the
 * constructor arguments ( at most a Signature , an Exception , a Deprecated and a Synthetic
 * attribute ) are the same as the corresponding attributes in the given method .
 * @ param source the source ClassReader from which the attributes of this method might be copied .
 * @ param methodInfoOffset the offset in ' source . b ' of the method _ info JVMS structure from which
 * the attributes of this method might be copied .
 * @ param methodInfoLength the length in ' source . b ' of the method _ info JVMS structure from which
 * the attributes of this method might be copied .
 * @ param hasSyntheticAttribute whether the method _ info JVMS structure from which the attributes
 * of this method might be copied contains a Synthetic attribute .
 * @ param hasDeprecatedAttribute whether the method _ info JVMS structure from which the attributes
 * of this method might be copied contains a Deprecated attribute .
 * @ param descriptorIndex the descriptor _ index field of the method _ info JVMS structure from which
 * the attributes of this method might be copied .
 * @ param signatureIndex the constant pool index contained in the Signature attribute of the
 * method _ info JVMS structure from which the attributes of this method might be copied , or 0.
 * @ param exceptionsOffset the offset in ' source . b ' of the Exceptions attribute of the method _ info
 * JVMS structure from which the attributes of this method might be copied , or 0.
 * @ return whether the attributes of this method can be copied from the attributes of the
 * method _ info JVMS structure in ' source . b ' , between ' methodInfoOffset ' and ' methodInfoOffset '
 * + ' methodInfoLength ' . */
boolean canCopyMethodAttributes ( final ClassReader source , final int methodInfoOffset , final int methodInfoLength , final boolean hasSyntheticAttribute , final boolean hasDeprecatedAttribute , final int descriptorIndex , final int signatureIndex , final int exceptionsOffset ) { } }

implementation:
// If the method descriptor has changed , with more locals than the max _ locals field of the
// original Code attribute , if any , then the original method attributes can ' t be copied . A
// conservative check on the descriptor changes alone ensures this ( being more precise is not
// worth the additional complexity , because these cases should be rare - - if a transform changes
// a method descriptor , most of the time it needs to change the method ' s code too ) .
if ( source != symbolTable . getSource ( ) || descriptorIndex != this . descriptorIndex || signatureIndex != this . signatureIndex || hasDeprecatedAttribute != ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) ) { return false ; } boolean needSyntheticAttribute = symbolTable . getMajorVersion ( ) < Opcodes . V1_5 && ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 ; if ( hasSyntheticAttribute != needSyntheticAttribute ) { return false ; } if ( exceptionsOffset == 0 ) { if ( numberOfExceptions != 0 ) { return false ; } } else if ( source . readUnsignedShort ( exceptionsOffset ) == numberOfExceptions ) { int currentExceptionOffset = exceptionsOffset + 2 ; for ( int i = 0 ; i < numberOfExceptions ; ++ i ) { if ( source . readUnsignedShort ( currentExceptionOffset ) != exceptionIndexTable [ i ] ) { return false ; } currentExceptionOffset += 2 ; } } // Don ' t copy the attributes yet , instead store their location in the source class reader so
// they can be copied later , in { @ link # putMethodInfo } . Note that we skip the 6 header bytes
// of the method _ info JVMS structure .
this . sourceOffset = methodInfoOffset + 6 ; this . sourceLength = methodInfoLength - 6 ; return true ;


signature:
public class MethodWriter { /** * Returns the size of the method _ info JVMS structure generated by this MethodWriter . Also add the
 * names of the attributes of this method in the constant pool .
 * @ return the size in bytes of the method _ info JVMS structure . */
int computeMethodInfoSize ( ) { } }

implementation:
// If this method _ info must be copied from an existing one , the size computation is trivial .
if ( sourceOffset != 0 ) { // sourceLength excludes the first 6 bytes for access _ flags , name _ index and descriptor _ index .
return 6 + sourceLength ; } // 2 bytes each for access _ flags , name _ index , descriptor _ index and attributes _ count .
int size = 8 ; // For ease of reference , we use here the same attribute order as in Section 4.7 of the JVMS .
if ( code . length > 0 ) { if ( code . length > 65535 ) { throw new MethodTooLargeException ( symbolTable . getClassName ( ) , name , descriptor , code . length ) ; } symbolTable . addConstantUtf8 ( Constants . CODE ) ; // The Code attribute has 6 header bytes , plus 2 , 2 , 4 and 2 bytes respectively for max _ stack ,
// max _ locals , code _ length and attributes _ count , plus the bytecode and the exception table .
size += 16 + code . length + Handler . getExceptionTableSize ( firstHandler ) ; if ( stackMapTableEntries != null ) { boolean useStackMapTable = symbolTable . getMajorVersion ( ) >= Opcodes . V1_6 ; symbolTable . addConstantUtf8 ( useStackMapTable ? Constants . STACK_MAP_TABLE : "StackMap" ) ; // 6 header bytes and 2 bytes for number _ of _ entries .
size += 8 + stackMapTableEntries . length ; } if ( lineNumberTable != null ) { symbolTable . addConstantUtf8 ( Constants . LINE_NUMBER_TABLE ) ; // 6 header bytes and 2 bytes for line _ number _ table _ length .
size += 8 + lineNumberTable . length ; } if ( localVariableTable != null ) { symbolTable . addConstantUtf8 ( Constants . LOCAL_VARIABLE_TABLE ) ; // 6 header bytes and 2 bytes for local _ variable _ table _ length .
size += 8 + localVariableTable . length ; } if ( localVariableTypeTable != null ) { symbolTable . addConstantUtf8 ( Constants . LOCAL_VARIABLE_TYPE_TABLE ) ; // 6 header bytes and 2 bytes for local _ variable _ type _ table _ length .
size += 8 + localVariableTypeTable . length ; } if ( lastCodeRuntimeVisibleTypeAnnotation != null ) { size += lastCodeRuntimeVisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) ; } if ( lastCodeRuntimeInvisibleTypeAnnotation != null ) { size += lastCodeRuntimeInvisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) ; } if ( firstCodeAttribute != null ) { size += firstCodeAttribute . computeAttributesSize ( symbolTable , code . data , code . length , maxStack , maxLocals ) ; } } if ( numberOfExceptions > 0 ) { symbolTable . addConstantUtf8 ( Constants . EXCEPTIONS ) ; size += 8 + 2 * numberOfExceptions ; } boolean useSyntheticAttribute = symbolTable . getMajorVersion ( ) < Opcodes . V1_5 ; if ( ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 && useSyntheticAttribute ) { symbolTable . addConstantUtf8 ( Constants . SYNTHETIC ) ; size += 6 ; } if ( signatureIndex != 0 ) { symbolTable . addConstantUtf8 ( Constants . SIGNATURE ) ; size += 8 ; } if ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) { symbolTable . addConstantUtf8 ( Constants . DEPRECATED ) ; size += 6 ; } if ( lastRuntimeVisibleAnnotation != null ) { size += lastRuntimeVisibleAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_ANNOTATIONS ) ; } if ( lastRuntimeInvisibleAnnotation != null ) { size += lastRuntimeInvisibleAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; } if ( lastRuntimeVisibleParameterAnnotations != null ) { size += AnnotationWriter . computeParameterAnnotationsSize ( Constants . RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS , lastRuntimeVisibleParameterAnnotations , visibleAnnotableParameterCount == 0 ? lastRuntimeVisibleParameterAnnotations . length : visibleAnnotableParameterCount ) ; } if ( lastRuntimeInvisibleParameterAnnotations != null ) { size += AnnotationWriter . computeParameterAnnotationsSize ( Constants . RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS , lastRuntimeInvisibleParameterAnnotations , invisibleAnnotableParameterCount == 0 ? lastRuntimeInvisibleParameterAnnotations . length : invisibleAnnotableParameterCount ) ; } if ( lastRuntimeVisibleTypeAnnotation != null ) { size += lastRuntimeVisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) ; } if ( lastRuntimeInvisibleTypeAnnotation != null ) { size += lastRuntimeInvisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) ; } if ( defaultValue != null ) { symbolTable . addConstantUtf8 ( Constants . ANNOTATION_DEFAULT ) ; size += 6 + defaultValue . length ; } if ( parameters != null ) { symbolTable . addConstantUtf8 ( Constants . METHOD_PARAMETERS ) ; // 6 header bytes and 1 byte for parameters _ count .
size += 7 + parameters . length ; } if ( firstAttribute != null ) { size += firstAttribute . computeAttributesSize ( symbolTable ) ; } return size ;


signature:
public class MethodWriter { /** * Puts the content of the method _ info JVMS structure generated by this MethodWriter into the
 * given ByteVector .
 * @ param output where the method _ info structure must be put . */
void putMethodInfo ( final ByteVector output ) { } }

implementation:
boolean useSyntheticAttribute = symbolTable . getMajorVersion ( ) < Opcodes . V1_5 ; int mask = useSyntheticAttribute ? Opcodes . ACC_SYNTHETIC : 0 ; output . putShort ( accessFlags & ~ mask ) . putShort ( nameIndex ) . putShort ( descriptorIndex ) ; // If this method _ info must be copied from an existing one , copy it now and return early .
if ( sourceOffset != 0 ) { output . putByteArray ( symbolTable . getSource ( ) . b , sourceOffset , sourceLength ) ; return ; } // For ease of reference , we use here the same attribute order as in Section 4.7 of the JVMS .
int attributeCount = 0 ; if ( code . length > 0 ) { ++ attributeCount ; } if ( numberOfExceptions > 0 ) { ++ attributeCount ; } if ( ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 && useSyntheticAttribute ) { ++ attributeCount ; } if ( signatureIndex != 0 ) { ++ attributeCount ; } if ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) { ++ attributeCount ; } if ( lastRuntimeVisibleAnnotation != null ) { ++ attributeCount ; } if ( lastRuntimeInvisibleAnnotation != null ) { ++ attributeCount ; } if ( lastRuntimeVisibleParameterAnnotations != null ) { ++ attributeCount ; } if ( lastRuntimeInvisibleParameterAnnotations != null ) { ++ attributeCount ; } if ( lastRuntimeVisibleTypeAnnotation != null ) { ++ attributeCount ; } if ( lastRuntimeInvisibleTypeAnnotation != null ) { ++ attributeCount ; } if ( defaultValue != null ) { ++ attributeCount ; } if ( parameters != null ) { ++ attributeCount ; } if ( firstAttribute != null ) { attributeCount += firstAttribute . getAttributeCount ( ) ; } // For ease of reference , we use here the same attribute order as in Section 4.7 of the JVMS .
output . putShort ( attributeCount ) ; if ( code . length > 0 ) { // 2 , 2 , 4 and 2 bytes respectively for max _ stack , max _ locals , code _ length and
// attributes _ count , plus the bytecode and the exception table .
int size = 10 + code . length + Handler . getExceptionTableSize ( firstHandler ) ; int codeAttributeCount = 0 ; if ( stackMapTableEntries != null ) { // 6 header bytes and 2 bytes for number _ of _ entries .
size += 8 + stackMapTableEntries . length ; ++ codeAttributeCount ; } if ( lineNumberTable != null ) { // 6 header bytes and 2 bytes for line _ number _ table _ length .
size += 8 + lineNumberTable . length ; ++ codeAttributeCount ; } if ( localVariableTable != null ) { // 6 header bytes and 2 bytes for local _ variable _ table _ length .
size += 8 + localVariableTable . length ; ++ codeAttributeCount ; } if ( localVariableTypeTable != null ) { // 6 header bytes and 2 bytes for local _ variable _ type _ table _ length .
size += 8 + localVariableTypeTable . length ; ++ codeAttributeCount ; } if ( lastCodeRuntimeVisibleTypeAnnotation != null ) { size += lastCodeRuntimeVisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) ; ++ codeAttributeCount ; } if ( lastCodeRuntimeInvisibleTypeAnnotation != null ) { size += lastCodeRuntimeInvisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) ; ++ codeAttributeCount ; } if ( firstCodeAttribute != null ) { size += firstCodeAttribute . computeAttributesSize ( symbolTable , code . data , code . length , maxStack , maxLocals ) ; codeAttributeCount += firstCodeAttribute . getAttributeCount ( ) ; } output . putShort ( symbolTable . addConstantUtf8 ( Constants . CODE ) ) . putInt ( size ) . putShort ( maxStack ) . putShort ( maxLocals ) . putInt ( code . length ) . putByteArray ( code . data , 0 , code . length ) ; Handler . putExceptionTable ( firstHandler , output ) ; output . putShort ( codeAttributeCount ) ; if ( stackMapTableEntries != null ) { boolean useStackMapTable = symbolTable . getMajorVersion ( ) >= Opcodes . V1_6 ; output . putShort ( symbolTable . addConstantUtf8 ( useStackMapTable ? Constants . STACK_MAP_TABLE : "StackMap" ) ) . putInt ( 2 + stackMapTableEntries . length ) . putShort ( stackMapTableNumberOfEntries ) . putByteArray ( stackMapTableEntries . data , 0 , stackMapTableEntries . length ) ; } if ( lineNumberTable != null ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . LINE_NUMBER_TABLE ) ) . putInt ( 2 + lineNumberTable . length ) . putShort ( lineNumberTableLength ) . putByteArray ( lineNumberTable . data , 0 , lineNumberTable . length ) ; } if ( localVariableTable != null ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . LOCAL_VARIABLE_TABLE ) ) . putInt ( 2 + localVariableTable . length ) . putShort ( localVariableTableLength ) . putByteArray ( localVariableTable . data , 0 , localVariableTable . length ) ; } if ( localVariableTypeTable != null ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . LOCAL_VARIABLE_TYPE_TABLE ) ) . putInt ( 2 + localVariableTypeTable . length ) . putShort ( localVariableTypeTableLength ) . putByteArray ( localVariableTypeTable . data , 0 , localVariableTypeTable . length ) ; } if ( lastCodeRuntimeVisibleTypeAnnotation != null ) { lastCodeRuntimeVisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) , output ) ; } if ( lastCodeRuntimeInvisibleTypeAnnotation != null ) { lastCodeRuntimeInvisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) , output ) ; } if ( firstCodeAttribute != null ) { firstCodeAttribute . putAttributes ( symbolTable , code . data , code . length , maxStack , maxLocals , output ) ; } } if ( numberOfExceptions > 0 ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . EXCEPTIONS ) ) . putInt ( 2 + 2 * numberOfExceptions ) . putShort ( numberOfExceptions ) ; for ( int exceptionIndex : exceptionIndexTable ) { output . putShort ( exceptionIndex ) ; } } if ( ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 && useSyntheticAttribute ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . SYNTHETIC ) ) . putInt ( 0 ) ; } if ( signatureIndex != 0 ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . SIGNATURE ) ) . putInt ( 2 ) . putShort ( signatureIndex ) ; } if ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . DEPRECATED ) ) . putInt ( 0 ) ; } if ( lastRuntimeVisibleAnnotation != null ) { lastRuntimeVisibleAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_ANNOTATIONS ) , output ) ; } if ( lastRuntimeInvisibleAnnotation != null ) { lastRuntimeInvisibleAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_ANNOTATIONS ) , output ) ; } if ( lastRuntimeVisibleParameterAnnotations != null ) { AnnotationWriter . putParameterAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS ) , lastRuntimeVisibleParameterAnnotations , visibleAnnotableParameterCount == 0 ? lastRuntimeVisibleParameterAnnotations . length : visibleAnnotableParameterCount , output ) ; } if ( lastRuntimeInvisibleParameterAnnotations != null ) { AnnotationWriter . putParameterAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS ) , lastRuntimeInvisibleParameterAnnotations , invisibleAnnotableParameterCount == 0 ? lastRuntimeInvisibleParameterAnnotations . length : invisibleAnnotableParameterCount , output ) ; } if ( lastRuntimeVisibleTypeAnnotation != null ) { lastRuntimeVisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) , output ) ; } if ( lastRuntimeInvisibleTypeAnnotation != null ) { lastRuntimeInvisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) , output ) ; } if ( defaultValue != null ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . ANNOTATION_DEFAULT ) ) . putInt ( defaultValue . length ) . putByteArray ( defaultValue . data , 0 , defaultValue . length ) ; } if ( parameters != null ) { output . putShort ( symbolTable . addConstantUtf8 ( Constants . METHOD_PARAMETERS ) ) . putInt ( 1 + parameters . length ) . putByte ( parametersCount ) . putByteArray ( parameters . data , 0 , parameters . length ) ; } if ( firstAttribute != null ) { firstAttribute . putAttributes ( symbolTable , output ) ; }


signature:
public class MethodWriter { /** * Collects the attributes of this method into the given set of attribute prototypes .
 * @ param attributePrototypes a set of attribute prototypes . */
final void collectAttributePrototypes ( final Attribute . Set attributePrototypes ) { } }

implementation: attributePrototypes . addAttributes ( firstAttribute ) ; attributePrototypes . addAttributes ( firstCodeAttribute ) ;


signature:
public class InvokeProxettaFactory { /** * { @ inheritDoc } */
@ Override protected WorkData process ( final ClassReader cr , final TargetClassInfoReader targetClassInfoReader ) { } }

implementation: InvokeClassBuilder icb = new InvokeClassBuilder ( destClassWriter , proxetta . getAspects ( new InvokeAspect [ 0 ] ) , resolveClassNameSuffix ( ) , requestedProxyClassName , targetClassInfoReader ) ; cr . accept ( icb , 0 ) ; return icb . getWorkData ( ) ;


signature:
public class ContextInjectorComponent { /** * Inject context into target . */
public void injectContext ( final Object targetObject ) { } }

implementation:
final Class targetType = targetObject . getClass ( ) ; final ScopeData scopeData = scopeDataInspector . inspectClassScopesWithCache ( targetType ) ; final Targets targets = new Targets ( targetObject , scopeData ) ; // inject no context
scopeResolver . forEachScope ( madvocScope -> madvocScope . inject ( targets ) ) ; // inject special case
scopeResolver . forScope ( ParamsScope . class , scope -> scope . inject ( targets ) ) ; // inject servlet context
final ServletContext servletContext = madvocController . getApplicationContext ( ) ; if ( servletContext != null ) { scopeResolver . forEachScope ( madvocScope -> madvocScope . inject ( servletContext , targets ) ) ; }


signature:
public class CSSelly { /** * Parses selector string .
 * Returns < code > null < / code > if no selector can be parsed . */
public List < CssSelector > parse ( ) { } }

implementation:
try { lexer . yylex ( ) ; if ( lexer . selectors . isEmpty ( ) ) { return null ; } // fixes last combinator
CssSelector last = lexer . selectors . get ( lexer . selectors . size ( ) - 1 ) ; if ( last . getCombinator ( ) == Combinator . DESCENDANT ) { last . setCombinator ( null ) ; } // set previous css selector
CssSelector prevCssSelector = null ; for ( CssSelector cssSelector : lexer . selectors ) { if ( prevCssSelector != null ) { cssSelector . setPrevCssSelector ( prevCssSelector ) ; } prevCssSelector = cssSelector ; } return lexer . selectors ; } catch ( IOException ioex ) { throw new CSSellyException ( ioex ) ; }


signature:
public class CSSelly { /** * Parses string of selectors ( separated with < b > , < / b > ) . Returns
 * list of { @ link CssSelector } lists in the same order . */
public static List < List < CssSelector > > parse ( final String query ) { } }

implementation: String [ ] singleQueries = StringUtil . splitc ( query , ',' ) ; List < List < CssSelector > > selectors = new ArrayList < > ( singleQueries . length ) ; for ( String singleQuery : singleQueries ) { selectors . add ( new CSSelly ( singleQuery ) . parse ( ) ) ; } return selectors ;


signature:
public class PseudoClassSelector { /** * Registers pseudo class . */
public static void registerPseudoClass ( final Class < ? extends PseudoClass > pseudoClassType ) { } }

implementation: PseudoClass pseudoClass ; try { pseudoClass = ClassUtil . newInstance ( pseudoClassType ) ; } catch ( Exception ex ) { throw new CSSellyException ( ex ) ; } PSEUDO_CLASS_MAP . put ( pseudoClass . getPseudoClassName ( ) , pseudoClass ) ;


signature:
public class PseudoClassSelector { /** * Lookups pseudo class for given pseudo class name . */
public static PseudoClass lookupPseudoClass ( final String pseudoClassName ) { } }

implementation: PseudoClass pseudoClass = PSEUDO_CLASS_MAP . get ( pseudoClassName ) ; if ( pseudoClass == null ) { throw new CSSellyException ( "Unsupported pseudo class: " + pseudoClassName ) ; } return pseudoClass ;


signature:
public class PseudoClassSelector { /** * Accepts node within selected results . Invoked after results are matched . */
@ Override public boolean accept ( final List < Node > currentResults , final Node node , final int index ) { } }

implementation: return pseudoClass . match ( currentResults , node , index ) ;


signature:
public class AsyncActionExecutor { /** * Invokes an action asynchronously by submitting it to the thread pool . */
public void invoke ( final ActionRequest actionRequest ) { } }

implementation: if ( executorService == null ) { throw new MadvocException ( "No action is marked as async!" ) ; } final HttpServletRequest servletRequest = actionRequest . getHttpServletRequest ( ) ; log . debug ( ( ) -> "Async call to: " + actionRequest ) ; final AsyncContext asyncContext = servletRequest . startAsync ( ) ; executorService . submit ( ( ) -> { try { actionRequest . invoke ( ) ; } catch ( Exception ex ) { log . error ( "Invoking async action path failed: " , ExceptionUtil . unwrapThrowable ( ex ) ) ; } finally { asyncContext . complete ( ) ; } } ) ;


signature:
public class StreamUtil { /** * Closes silently the closable object . If it is { @ link Flushable } , it
 * will be flushed first . No exception will be thrown if an I / O error occurs . */
public static void close ( final Closeable closeable ) { } }

implementation: if ( closeable != null ) { if ( closeable instanceof Flushable ) { try { ( ( Flushable ) closeable ) . flush ( ) ; } catch ( IOException ignored ) { } } try { closeable . close ( ) ; } catch ( IOException ignored ) { } }


signature:
public class StreamUtil { /** * Copies specified number of characters from { @ link Reader } to { @ link Writer } using buffer .
 * { @ link Reader } and { @ link Writer } don ' t have to be wrapped to buffered , since copying is already optimized .
 * @ param input { @ link Reader } to read .
 * @ param output { @ link Writer } to write to .
 * @ param count The number of characters to read .
 * @ return The total number of characters read .
 * @ throws IOException if there is an error reading or writing . */
public static int copy ( final Reader input , final Writer output , final int count ) throws IOException { } }

implementation: if ( count == ALL ) { return copy ( input , output ) ; } int numToRead = count ; char [ ] buffer = new char [ numToRead ] ; int totalRead = ZERO ; int read ; while ( numToRead > ZERO ) { read = input . read ( buffer , ZERO , bufferSize ( numToRead ) ) ; if ( read == NEGATIVE_ONE ) { break ; } output . write ( buffer , ZERO , read ) ; numToRead = numToRead - read ; totalRead = totalRead + read ; } output . flush ( ) ; return totalRead ;


signature:
public class StreamUtil { /** * Copies specified number of bytes from { @ link InputStream } to { @ link OutputStream } using buffer .
 * { @ link InputStream } and { @ link OutputStream } don ' t have to be wrapped to buffered , since copying is already optimized .
 * @ param input { @ link InputStream } to read .
 * @ param output { @ link OutputStream } to write to .
 * @ param count The number of bytes to read .
 * @ return The total number of bytes read .
 * @ throws IOException if there is an error reading or writing . */
public static int copy ( final InputStream input , final OutputStream output , final int count ) throws IOException { } }

implementation: if ( count == ALL ) { return copy ( input , output ) ; } int numToRead = count ; byte [ ] buffer = new byte [ numToRead ] ; int totalRead = ZERO ; int read ; while ( numToRead > ZERO ) { read = input . read ( buffer , ZERO , bufferSize ( numToRead ) ) ; if ( read == NEGATIVE_ONE ) { break ; } output . write ( buffer , ZERO , read ) ; numToRead = numToRead - read ; totalRead = totalRead + read ; } output . flush ( ) ; return totalRead ;


signature:
public class StreamUtil { /** * Reads all available bytes from { @ link InputStream } as a byte array .
 * Uses { @ link InputStream # available ( ) } to determine the size of input stream .
 * This is the fastest method for reading { @ link InputStream } to byte array , but
 * depends on { @ link InputStream } implementation of { @ link InputStream # available ( ) } .
 * @ param input { @ link InputStream } to read .
 * @ return byte [ ]
 * @ throws IOException if total read is less than { @ link InputStream # available ( ) } ; */
public static byte [ ] readAvailableBytes ( final InputStream input ) throws IOException { } }

implementation: int numToRead = input . available ( ) ; byte [ ] buffer = new byte [ numToRead ] ; int totalRead = ZERO ; int read ; while ( ( totalRead < numToRead ) && ( read = input . read ( buffer , totalRead , numToRead - totalRead ) ) >= ZERO ) { totalRead = totalRead + read ; } if ( totalRead < numToRead ) { throw new IOException ( "Failed to completely read InputStream" ) ; } return buffer ;


signature:
public class StreamUtil { /** * Copies { @ link Reader } to { @ link OutputStream } using buffer and specified encoding .
 * @ see # copy ( Reader , Writer , int ) */
public static < T extends OutputStream > T copy ( final Reader input , final T output , final String encoding , final int count ) throws IOException { } }

implementation: try ( Writer out = outputStreamWriterOf ( output , encoding ) ) { copy ( input , out , count ) ; return output ; }


signature:
public class StreamUtil { /** * Copies { @ link InputStream } to a new { @ link FastByteArrayOutputStream } using buffer and specified encoding .
 * @ see # copy ( InputStream , OutputStream , int ) */
public static FastByteArrayOutputStream copyToOutputStream ( final InputStream input , final int count ) throws IOException { } }

implementation: try ( FastByteArrayOutputStream output = createFastByteArrayOutputStream ( ) ) { copy ( input , output , count ) ; return output ; }


signature:
public class StreamUtil { /** * Copies { @ link Reader } to a new { @ link FastByteArrayOutputStream } using buffer and specified encoding .
 * @ see # copy ( Reader , OutputStream , String , int ) */
public static FastByteArrayOutputStream copyToOutputStream ( final Reader input , final String encoding , final int count ) throws IOException { } }

implementation: try ( FastByteArrayOutputStream output = createFastByteArrayOutputStream ( ) ) { copy ( input , output , encoding , count ) ; return output ; }


signature:
public class StreamUtil { /** * Copies { @ link InputStream } to a new { @ link FastCharArrayWriter } using buffer and specified encoding .
 * @ see # copy ( InputStream , Writer , String , int ) */
public static FastCharArrayWriter copy ( final InputStream input , final String encoding , final int count ) throws IOException { } }

implementation: try ( FastCharArrayWriter output = createFastCharArrayWriter ( ) ) { copy ( input , output , encoding , count ) ; return output ; }


signature:
public class StreamUtil { /** * Copies { @ link Reader } to a new { @ link FastCharArrayWriter } using buffer and specified encoding .
 * @ see # copy ( Reader , Writer , int ) */
public static FastCharArrayWriter copy ( final Reader input , final int count ) throws IOException { } }

implementation: try ( FastCharArrayWriter output = createFastCharArrayWriter ( ) ) { copy ( input , output , count ) ; return output ; }


signature:
public class StreamUtil { /** * Returns new { @ link InputStreamReader } using specified { @ link InputStream } and encoding .
 * @ param input { @ link InputStream }
 * @ param encoding Encoding as { @ link String } to use for { @ link InputStreamReader } .
 * @ return new { @ link InputStreamReader }
 * @ throws UnsupportedEncodingException if encoding is not valid . */
public static InputStreamReader inputStreamReadeOf ( final InputStream input , final String encoding ) throws UnsupportedEncodingException { } }

implementation: return new InputStreamReader ( input , encoding ) ;


signature:
public class StreamUtil { /** * Returns new { @ link OutputStreamWriter } using specified { @ link OutputStream } and encoding .
 * @ param output { @ link OutputStream }
 * @ param encoding Encoding as { @ link String } to use for { @ link OutputStreamWriter } .
 * @ return new { @ link OutputStreamWriter }
 * @ throws UnsupportedEncodingException if encoding is not valid . */
public static OutputStreamWriter outputStreamWriterOf ( final OutputStream output , final String encoding ) throws UnsupportedEncodingException { } }

implementation: return new OutputStreamWriter ( output , encoding ) ;


signature:
public class BeanVisitor { /** * Returns all bean property names . */
protected String [ ] getAllBeanPropertyNames ( final Class type , final boolean declared ) { } }

implementation: ClassDescriptor classDescriptor = ClassIntrospector . get ( ) . lookup ( type ) ; PropertyDescriptor [ ] propertyDescriptors = classDescriptor . getAllPropertyDescriptors ( ) ; ArrayList < String > names = new ArrayList < > ( propertyDescriptors . length ) ; for ( PropertyDescriptor propertyDescriptor : propertyDescriptors ) { MethodDescriptor getter = propertyDescriptor . getReadMethodDescriptor ( ) ; if ( getter != null ) { if ( getter . matchDeclared ( declared ) ) { names . add ( propertyDescriptor . getName ( ) ) ; } } else if ( includeFields ) { FieldDescriptor field = propertyDescriptor . getFieldDescriptor ( ) ; if ( field != null ) { if ( field . matchDeclared ( declared ) ) { names . add ( field . getName ( ) ) ; } } } } return names . toArray ( new String [ 0 ] ) ;


signature:
public class BeanVisitor { /** * Returns an array of bean properties . If bean is a < code > Map < / code > ,
 * all its keys will be returned . */
protected String [ ] resolveProperties ( final Object bean , final boolean declared ) { } }

implementation: String [ ] properties ; if ( bean instanceof Map ) { Set keys = ( ( Map ) bean ) . keySet ( ) ; properties = new String [ keys . size ( ) ] ; int ndx = 0 ; for ( Object key : keys ) { properties [ ndx ] = key . toString ( ) ; ndx ++ ; } } else { properties = getAllBeanPropertyNames ( bean . getClass ( ) , declared ) ; } return properties ;


signature:
public class BeanVisitor { /** * Starts visiting properties . */
public void visit ( ) { } }

implementation: String [ ] properties = resolveProperties ( source , declared ) ; for ( String name : properties ) { if ( name == null ) { continue ; } if ( ! rules . match ( name , blacklist ) ) { continue ; } Object value ; String propertyName = name ; if ( isSourceMap ) { propertyName = LEFT_SQ_BRACKET + name + RIGHT_SQ_BRACKET ; } if ( declared ) { value = BeanUtil . declared . getProperty ( source , propertyName ) ; } else { value = BeanUtil . pojo . getProperty ( source , propertyName ) ; } if ( value == null && ignoreNullValues ) { continue ; } if ( value instanceof String && StringUtil . isEmpty ( ( String ) value ) ) { continue ; } visitProperty ( name , value ) ; }


signature:
public class BeanVisitor { /** * Compares property name to the rules . */
@ Override public boolean accept ( final String propertyName , final String rule , final boolean include ) { } }

implementation: return propertyName . equals ( rule ) ;


signature:
public class CachingIntrospector { /** * { @ inheritDoc } */
@ Override public ClassDescriptor lookup ( final Class type ) { } }

implementation: return cache . get ( type , ( ) -> new ClassDescriptor ( type , scanAccessible , enhancedProperties , includeFieldsAsProperties , propertyFieldPrefix ) ) ;


signature:
public class MethodResolver { /** * Resolve method injection points in given class . */
public MethodInjectionPoint [ ] resolve ( final Class type ) { } }

implementation:
// lookup methods
ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; List < MethodInjectionPoint > list = new ArrayList < > ( ) ; MethodDescriptor [ ] allMethods = cd . getAllMethodDescriptors ( ) ; for ( MethodDescriptor methodDescriptor : allMethods ) { Method method = methodDescriptor . getMethod ( ) ; if ( ClassUtil . isBeanPropertySetter ( method ) ) { // ignore setters
continue ; } if ( method . getParameterTypes ( ) . length == 0 ) { // ignore methods with no argument
continue ; } BeanReferences [ ] references = referencesResolver . readAllReferencesFromAnnotation ( method ) ; if ( references != null ) { MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint ( method , references ) ; list . add ( methodInjectionPoint ) ; } } final MethodInjectionPoint [ ] methodInjectionPoints ; if ( list . isEmpty ( ) ) { methodInjectionPoints = MethodInjectionPoint . EMPTY ; } else { methodInjectionPoints = list . toArray ( new MethodInjectionPoint [ 0 ] ) ; } return methodInjectionPoints ;


signature:
public class HtmlStaplerFilter { /** * Reads filter config parameters and set into destination target . */
protected void readFilterConfigParameters ( final FilterConfig filterConfig , final Object target , final String ... parameters ) { } }

implementation: for ( String parameter : parameters ) { String value = filterConfig . getInitParameter ( parameter ) ; if ( value != null ) { BeanUtil . declared . setProperty ( target , parameter , value ) ; } }


signature:
public class HtmlStaplerFilter { /** * Creates { @ link HtmlStaplerBundlesManager } instance . */
protected HtmlStaplerBundlesManager createBundleManager ( final ServletContext servletContext , final Strategy strategy ) { } }

implementation: String webRoot = servletContext . getRealPath ( StringPool . EMPTY ) ; String contextPath = ServletUtil . getContextPath ( servletContext ) ; return new HtmlStaplerBundlesManager ( contextPath , webRoot , strategy ) ;


signature:
public class HtmlStaplerFilter { /** * Outputs bundle file to the response . */
protected void sendBundleFile ( final HttpServletResponse resp , final File bundleFile ) throws IOException { } }

implementation: OutputStream out = resp . getOutputStream ( ) ; FileInputStream fileInputStream = new FileInputStream ( bundleFile ) ; try { StreamUtil . copy ( fileInputStream , out ) ; } finally { StreamUtil . close ( fileInputStream ) ; }


signature:
public class AutomagicDbOomConfigurator { /** * Configures { @ link DbEntityManager } with specified class path . */
public void configure ( ) { } }

implementation: long elapsed = System . currentTimeMillis ( ) ; final ClassScanner classScanner = new ClassScanner ( ) ; classScanner . detectEntriesMode ( true ) ; classScanner . scanDefaultClasspath ( ) ; classScannerConsumers . accept ( classScanner ) ; registerAsConsumer ( classScanner ) ; try { classScanner . start ( ) ; } catch ( Exception ex ) { throw new DbOomException ( "Scan classpath error" , ex ) ; } elapsed = System . currentTimeMillis ( ) - elapsed ; if ( log . isInfoEnabled ( ) ) { log . info ( "DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager . getTotalNames ( ) ) ; }


signature:
public class AutomagicDbOomConfigurator { /** * Registers a class consumer that registers only those annotated with { @ link DbTable } .
 * Because of performance purposes , classes are not dynamically loaded ; instead , their
 * file content is examined . */
public void registerAsConsumer ( final ClassScanner classScanner ) { } }

implementation: classScanner . registerEntryConsumer ( classPathEntry -> { if ( ! classPathEntry . isTypeSignatureInUse ( DB_TABLE_ANNOTATION_BYTES ) ) { return ; } final Class < ? > beanClass ; try { beanClass = classPathEntry . loadClass ( ) ; } catch ( ClassNotFoundException cnfex ) { throw new DbOomException ( "Entry class not found: " + classPathEntry . name ( ) , cnfex ) ; } if ( beanClass == null ) { return ; } final DbTable dbTable = beanClass . getAnnotation ( DbTable . class ) ; if ( dbTable == null ) { return ; } if ( registerAsEntities ) { dbEntityManager . registerEntity ( beanClass ) ; } else { dbEntityManager . registerType ( beanClass ) ; } } ) ;


signature:
public class HtmlStaplerBundlesManager { /** * Sets the number of random characters that will be appended to the
 * { @ link # createDigest ( String ) digest } . When it is set to 0 , nothing
 * will be appended to the digest . Otherwise , a random string will be
 * generated ( containing only letters and digits ) and appended to the
 * digest .
 * Random digest chars is a < b > unique < / b > key per one VM !
 * This key is initialized only once .
 * This is useful to automatically expire any cache that browsers may have in
 * JS and CSS files , so that changes in those files will be downloaded by the
 * browser . */
public void setRandomDigestChars ( final int randomDigestChars ) { } }

implementation: this . randomDigestChars = randomDigestChars ; if ( randomDigestChars == 0 ) { uniqueDigestKey = null ; } else { uniqueDigestKey = new RandomString ( ) . randomAlphaNumeric ( randomDigestChars ) ; }


signature:
public class HtmlStaplerBundlesManager { /** * Creates bundle file in bundleFolder / staplerPath . Only file object
 * is created , not the file content . */
protected File createBundleFile ( final String bundleId ) { } }

implementation: File folder = new File ( bundleFolder , staplerPath ) ; if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } return new File ( folder , bundleId ) ;


signature:
public class HtmlStaplerBundlesManager { /** * Lookups for bundle file . */
public File lookupBundleFile ( String bundleId ) { } }

implementation: if ( ( mirrors != null ) && ( ! mirrors . isEmpty ( ) ) ) { String realBundleId = mirrors . remove ( bundleId ) ; if ( realBundleId != null ) { bundleId = realBundleId ; } } return createBundleFile ( bundleId ) ;


signature:
public class HtmlStaplerBundlesManager { /** * Locates gzipped version of bundle file . If gzip file
 * does not exist , it will be created . */
public File lookupGzipBundleFile ( final File file ) throws IOException { } }

implementation: String path = file . getPath ( ) + ZipUtil . GZIP_EXT ; File gzipFile = new File ( path ) ; if ( ! gzipFile . exists ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "gzip bundle to " + path ) ; } ZipUtil . gzip ( file ) ; } return gzipFile ;


signature:
public class HtmlStaplerBundlesManager { /** * Registers new bundle that consist of provided list of source paths .
 * Returns the real bundle id , as provided one is just a temporary bundle id . */
public synchronized String registerBundle ( final String contextPath , final String actionPath , final String tempBundleId , final String bundleContentType , final List < String > sources ) { } }

implementation:
if ( tempBundleId == null || sources . isEmpty ( ) ) { if ( strategy == Strategy . ACTION_MANAGED ) { // page does not include any resource source file
actionBundles . put ( actionPath , StringPool . EMPTY ) ; } return null ; } // create unique digest from the collected sources
String [ ] sourcesArray = sources . toArray ( new String [ 0 ] ) ; for ( int i = 0 , sourcesArrayLength = sourcesArray . length ; i < sourcesArrayLength ; i ++ ) { sourcesArray [ i ] = sourcesArray [ i ] . trim ( ) . toLowerCase ( ) ; } if ( sortResources ) { Arrays . sort ( sourcesArray ) ; } StringBand sb = new StringBand ( sourcesArray . length ) ; for ( String src : sourcesArray ) { sb . append ( src ) ; } String sourcesString = sb . toString ( ) ; String bundleId = createDigest ( sourcesString ) ; bundleId += '.' + bundleContentType ; // bundle appears for the first time , create the bundle
if ( strategy == Strategy . ACTION_MANAGED ) { actionBundles . put ( actionPath , bundleId ) ; mirrors . put ( tempBundleId , bundleId ) ; } try { createBundle ( contextPath , actionPath , bundleId , sources ) ; } catch ( IOException ioex ) { throw new HtmlStaplerException ( "Can't create bundle" , ioex ) ; } return bundleId ;


signature:
public class HtmlStaplerBundlesManager { /** * Creates digest i . e . bundle id from given string .
 * Returned digest must be filename safe , for all platforms . */
protected String createDigest ( final String source ) { } }

implementation: final DigestEngine digestEngine = DigestEngine . sha256 ( ) ; final byte [ ] bytes = digestEngine . digest ( CharUtil . toSimpleByteArray ( source ) ) ; String digest = Base32 . encode ( bytes ) ; if ( uniqueDigestKey != null ) { digest += uniqueDigestKey ; } return digest ;


signature:
public class HtmlStaplerBundlesManager { /** * Creates bundle file by loading resource files content . If bundle file already
 * exist it will not be recreated ! */
protected void createBundle ( final String contextPath , final String actionPath , final String bundleId , final List < String > sources ) throws IOException { } }

implementation:
final File bundleFile = createBundleFile ( bundleId ) ; if ( bundleFile . exists ( ) ) { return ; } StringBand sb = new StringBand ( sources . size ( ) * 2 ) ; for ( String src : sources ) { if ( sb . length ( ) != 0 ) { sb . append ( StringPool . NEWLINE ) ; } String content ; if ( isExternalResource ( src ) ) { content = downloadString ( src ) ; } else { if ( ! downloadLocal ) { // load local resource from file system
String localFile = webRoot ; if ( src . startsWith ( contextPath + '/' ) ) { src = src . substring ( contextPath . length ( ) ) ; } if ( src . startsWith ( StringPool . SLASH ) ) { // absolute path
localFile += src ; } else { // relative path
localFile += '/' + FileNameUtil . getPathNoEndSeparator ( actionPath ) + '/' + src ; } // trim link parameters , if any
int qmndx = localFile . indexOf ( '?' ) ; if ( qmndx != - 1 ) { localFile = localFile . substring ( 0 , qmndx ) ; } try { content = FileUtil . readString ( localFile ) ; } catch ( IOException ioex ) { if ( notFoundExceptionEnabled ) { throw ioex ; } if ( log . isWarnEnabled ( ) ) { log . warn ( ioex . getMessage ( ) ) ; } content = null ; } } else { // download local resource
String localUrl = localAddressAndPort ; if ( src . startsWith ( StringPool . SLASH ) ) { localUrl += contextPath + src ; } else { localUrl += contextPath + FileNameUtil . getPath ( actionPath ) + '/' + src ; } content = downloadString ( localUrl ) ; } if ( content != null ) { if ( isCssResource ( src ) ) { content = fixCssRelativeUrls ( content , src ) ; } } } if ( content != null ) { content = onResourceContent ( content ) ; sb . append ( content ) ; } } FileUtil . writeString ( bundleFile , sb . toString ( ) ) ; if ( log . isInfoEnabled ( ) ) { log . info ( "Bundle created: " + bundleId ) ; }


signature:
public class HtmlStaplerBundlesManager { /** * Clears all settings and removes all created bundle files from file system . */
public synchronized void reset ( ) { } }

implementation: if ( strategy == Strategy . ACTION_MANAGED ) { actionBundles . clear ( ) ; mirrors . clear ( ) ; } final FindFile ff = new FindFile ( ) ; ff . includeDirs ( false ) ; ff . searchPath ( new File ( bundleFolder , staplerPath ) ) ; File f ; int count = 0 ; while ( ( f = ff . nextFile ( ) ) != null ) { f . delete ( ) ; count ++ ; } if ( log . isInfoEnabled ( ) ) { log . info ( "reset: " + count + " bundle files deleted." ) ; }


signature:
public class HtmlStaplerBundlesManager { /** * Returns the content with all relative URLs fixed . */
protected String fixCssRelativeUrls ( final String content , final String src ) { } }

implementation: final String path = FileNameUtil . getPath ( src ) ; final Matcher matcher = CSS_URL_PATTERN . matcher ( content ) ; final StringBuilder sb = new StringBuilder ( content . length ( ) ) ; int start = 0 ; while ( matcher . find ( ) ) { sb . append ( content , start , matcher . start ( ) ) ; final String matchedUrl = StringUtil . removeChars ( matcher . group ( 1 ) , "'\"" ) ; final String url ; if ( matchedUrl . startsWith ( "https://" ) || matchedUrl . startsWith ( "http://" ) || matchedUrl . startsWith ( "data:" ) ) { url = "url('" + matchedUrl + "')" ; } else { url = fixRelativeUrl ( matchedUrl , path ) ; } sb . append ( url ) ; start = matcher . end ( ) ; } sb . append ( content . substring ( start ) ) ; return sb . toString ( ) ;


signature:
public class HtmlStaplerBundlesManager { /** * For a given URL ( optionally quoted ) , produces CSS URL
 * where relative paths are fixed and prefixed with offsetPath . */
protected String fixRelativeUrl ( final String url , final String offsetPath ) { } }

implementation: final StringBuilder res = new StringBuilder ( ) ; res . append ( "url('" ) ; if ( ! url . startsWith ( StringPool . SLASH ) ) { res . append ( "../" ) . append ( offsetPath ) ; } res . append ( url ) . append ( "')" ) ; return res . toString ( ) ;


signature:
public class DbEntitySql { /** * Creates UPDATE query that updates all non - null values of an entity that is matched by id . */
public DbSqlBuilder update ( final Object entity ) { } }

implementation: String tableRef = createTableRefName ( entity ) ; if ( ! dbOomConfig . isUpdateAcceptsTableAlias ( ) ) { tableRef = null ; } return sql ( ) . $ ( UPDATE ) . table ( entity , tableRef ) . set ( tableRef , entity ) . $ ( WHERE ) . matchIds ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates UPDATE query that updates all values of an entity that is matched by id . */
public DbSqlBuilder updateAll ( final Object entity ) { } }

implementation: String tableRef = createTableRefName ( entity ) ; if ( ! dbOomConfig . isUpdateAcceptsTableAlias ( ) ) { tableRef = null ; } return sql ( ) . $ ( UPDATE ) . table ( entity , tableRef ) . setAll ( tableRef , entity ) . $ ( WHERE ) . matchIds ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates UPDATE query for single column of an entity that is matched by id . */
public DbSqlBuilder updateColumn ( final Object entity , final String columnRef , final Object value ) { } }

implementation: String tableRef = createTableRefName ( entity ) ; if ( ! dbOomConfig . isUpdateAcceptsTableAlias ( ) ) { tableRef = null ; } return sql ( ) . $ ( UPDATE ) . table ( entity , tableRef ) . $ ( SET ) . ref ( null , columnRef ) . $ ( EQUALS ) . columnValue ( value ) . $ ( WHERE ) . matchIds ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Reads property value and updates the DB . */
public DbSqlBuilder updateColumn ( final Object entity , final String columnRef ) { } }

implementation: final Object value = BeanUtil . pojo . getProperty ( entity , columnRef ) ; return updateColumn ( entity , columnRef , value ) ;


signature:
public class DbEntitySql { /** * Creates DELETE query that deletes entity matched by non - null values . */
public DbSqlBuilder delete ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( DELETE_FROM ) . table ( entity , null , tableRef ) . $ ( WHERE ) . match ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates DELETE query that deletes entity matched by all values . */
public DbSqlBuilder deleteByAll ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( DELETE_FROM ) . table ( entity , null , tableRef ) . $ ( WHERE ) . matchAll ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates DELETE query that deletes entity by ID . */
public DbSqlBuilder deleteById ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( DELETE_FROM ) . table ( entity , null , tableRef ) . $ ( WHERE ) . matchIds ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates DELETE query that deletes entity by ID . */
public DbSqlBuilder deleteById ( final Object entityType , final Object id ) { } }

implementation: final String tableRef = createTableRefName ( entityType ) ; return sql ( ) . $ ( DELETE_FROM ) . table ( entityType , null , tableRef ) . $ ( WHERE ) . refId ( tableRef ) . $ ( EQUALS ) . columnValue ( id ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by non - null values . */
public DbSqlBuilder find ( final Class target , final Object matchEntity ) { } }

implementation: final String tableRef = createTableRefName ( target ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( target , tableRef ) . $ ( WHERE ) . match ( tableRef , matchEntity ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by non - null values . */
public DbSqlBuilder find ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . match ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by all values . */
public DbSqlBuilder findByAll ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . matchAll ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by column name */
public DbSqlBuilder findByColumn ( final Class entity , final String column , final Object value ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . ref ( tableRef , column ) . $ ( EQUALS ) . columnValue ( value ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by foreign key .
 * Foreign key is created by concatenating foreign table name and column name . */
public DbSqlBuilder findForeign ( final Class entity , final Object value ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; final DbEntityDescriptor dedFk = entityManager . lookupType ( value . getClass ( ) ) ; final String tableName = dbOomConfig . getTableNames ( ) . convertTableNameToEntityName ( dedFk . getTableName ( ) ) ; final String columnName = dbOomConfig . getColumnNames ( ) . convertColumnNameToPropertyName ( dedFk . getIdColumnName ( ) ) ; final String fkColumn = uncapitalize ( tableName ) + capitalize ( columnName ) ; final Object idValue = BeanUtil . pojo . getProperty ( value , dedFk . getIdPropertyName ( ) ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . ref ( tableRef , fkColumn ) . $ ( EQUALS ) . columnValue ( idValue ) ;


signature:
public class DbEntitySql { /** * Returns all records for given type . */
public DbSqlBuilder findAll ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by id . */
public DbSqlBuilder findById ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . matchIds ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates SELECT criteria for the entity matched by id . */
public DbSqlBuilder findById ( final Object entityType , final Object id ) { } }

implementation: final String tableRef = createTableRefName ( entityType ) ; return sql ( ) . $ ( SELECT ) . column ( tableRef ) . $ ( FROM ) . table ( entityType , tableRef ) . $ ( WHERE ) . refId ( tableRef ) . $ ( EQUALS ) . columnValue ( id ) ;


signature:
public class DbEntitySql { /** * Creates SELECT COUNT criteria for the entity matched by non - null values . */
public DbSqlBuilder count ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT_COUNT_1_FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . match ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates SELECT COUNT all query . */
public DbSqlBuilder count ( final Class entityType ) { } }

implementation: final String tableRef = createTableRefName ( entityType ) ; return sql ( ) . $ ( SELECT_COUNT_1_FROM ) . table ( entityType , tableRef ) ;


signature:
public class DbEntitySql { /** * Creates SELECT COUNT criteria for the entity matched by all values . */
public DbSqlBuilder countAll ( final Object entity ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( SELECT_COUNT_1_FROM ) . table ( entity , tableRef ) . $ ( WHERE ) . matchAll ( tableRef , entity ) ;


signature:
public class DbEntitySql { /** * Creates UPDATE that increases / decreases column by some delta value . */
public DbSqlBuilder increaseColumn ( final Class entity , final Object id , final String columnRef , final Number delta , final boolean increase ) { } }

implementation: final String tableRef = createTableRefName ( entity ) ; return sql ( ) . $ ( UPDATE ) . table ( entity , null , tableRef ) . $ ( SET ) . ref ( null , columnRef ) . $ ( EQUALS ) . ref ( null , columnRef ) . $ ( increase ? StringPool . PLUS : StringPool . DASH ) . columnValue ( delta ) . $ ( WHERE ) . refId ( tableRef ) . $ ( EQUALS ) . columnValue ( id ) ;


signature:
public class DbEntitySql { /** * Creates table reference name from entity type .
 * Always appends an underscore to reference name in order
 * to circumvent SQL compatibility issues when entity class name
 * equals to a reserved word . */
protected static String createTableRefName ( final Object entity ) { } }

implementation: Class type = entity . getClass ( ) ; type = ( type == Class . class ? ( Class ) entity : type ) ; return ( type . getSimpleName ( ) + '_' ) ;


signature:
public class DbJtxSessionProvider { /** * Returns session from JTX transaction manager and started transaction . */
@ Override public DbSession getDbSession ( ) { } }

implementation: log . debug ( "Requesting db TX manager session" ) ; final DbJtxTransaction jtx = ( DbJtxTransaction ) jtxTxManager . getTransaction ( ) ; if ( jtx == null ) { throw new DbSqlException ( "No transaction is in progress and DbSession can't be provided. " + "It seems that transaction manager is not used to begin a transaction." ) ; } return jtx . requestResource ( ) ;


signature:
public class Methref { /** * Resolves method name of method reference . Argument is used so { @ link # to ( ) }
 * can be called in convenient way . For methods that returns string ,
 * value will be returned immediately . */
public String ref ( final Object dummy ) { } }

implementation: if ( dummy != null ) { if ( dummy instanceof String ) { return ( String ) dummy ; } throw new MethrefException ( "Target method not collected" ) ; } return ref ( ) ;


signature:
public class Methref { /** * Returns name of method reference . Target { @ link # on ( Class ) method } has
 * to be { @ link # to ( ) called } before it can return its reference . */
public String ref ( ) { } }

implementation: if ( instance == null ) { return null ; } try { Field f = instance . getClass ( ) . getDeclaredField ( "$__methodName$0" ) ; f . setAccessible ( true ) ; Object name = f . get ( instance ) ; if ( name == null ) { throw new MethrefException ( "Target method not collected" ) ; } return name . toString ( ) ; } catch ( Exception ex ) { if ( ex instanceof MethrefException ) { throw ( ( MethrefException ) ex ) ; } throw new MethrefException ( "Methref field not found" , ex ) ; }


signature:
public class ProxettaAwareActionsManager { /** * Registers actions and applies proxetta on actions that are not already registered .
 * We need to define { @ link ActionDefinition } before we apply the proxy , using
 * target action class . */
@ Override public synchronized ActionRuntime registerAction ( Class actionClass , final Method actionMethod , ActionDefinition actionDefinition ) { } }

implementation:
if ( proxettaSupplier == null ) { return super . registerAction ( actionClass , actionMethod , actionDefinition ) ; } if ( actionDefinition == null ) { actionDefinition = actionMethodParser . parseActionDefinition ( actionClass , actionMethod ) ; } // create proxy for action class if not already created
Class existing = proxyActionClasses . get ( actionClass ) ; if ( existing == null ) { final Proxetta proxetta = proxettaSupplier . get ( ) ; existing = proxetta . proxy ( ) . setTarget ( actionClass ) . define ( ) ; proxyActionClasses . put ( actionClass , existing ) ; } actionClass = existing ; return super . registerAction ( actionClass , actionMethod , actionDefinition ) ;


signature:
public class ArrayConverter { /** * Creates an array with single element . */
protected T [ ] convertToSingleElementArray ( final Object value ) { } }

implementation: T [ ] singleElementArray = createArray ( 1 ) ; singleElementArray [ 0 ] = convertType ( value ) ; return singleElementArray ;


signature:
public class ArrayConverter { /** * Converts non - array value to array . Detects various
 * collection types and iterates them to make conversion
 * and to create target array . */
protected T [ ] convertValueToArray ( final Object value ) { } }

implementation:
if ( value instanceof Collection ) { Collection collection = ( Collection ) value ; T [ ] target = createArray ( collection . size ( ) ) ; int i = 0 ; for ( Object element : collection ) { target [ i ] = convertType ( element ) ; i ++ ; } return target ; } if ( value instanceof Iterable ) { Iterable iterable = ( Iterable ) value ; List < T > list = new ArrayList < > ( ) ; for ( Object element : iterable ) { list . add ( convertType ( element ) ) ; } T [ ] target = createArray ( list . size ( ) ) ; return list . toArray ( target ) ; } if ( value instanceof CharSequence ) { String [ ] strings = convertStringToArray ( value . toString ( ) ) ; return convertArrayToArray ( strings ) ; } // everything else :
return convertToSingleElementArray ( value ) ;


signature:
public class ArrayConverter { /** * Converts primitive array to target array . */
@ SuppressWarnings ( "AutoBoxing" ) protected T [ ] convertPrimitiveArrayToArray ( final Object value , final Class primitiveComponentType ) { } }

implementation: T [ ] result = null ; if ( primitiveComponentType == int . class ) { int [ ] array = ( int [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == long . class ) { long [ ] array = ( long [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == float . class ) { float [ ] array = ( float [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == double . class ) { double [ ] array = ( double [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == short . class ) { short [ ] array = ( short [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == byte . class ) { byte [ ] array = ( byte [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == char . class ) { char [ ] array = ( char [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } else if ( primitiveComponentType == boolean . class ) { boolean [ ] array = ( boolean [ ] ) value ; result = createArray ( array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } return result ;


signature:
public class GenericsReader { /** * Parses signature for generic information and returns a map where key is generic name
 * and value is raw type . Returns an empty map if signature does not define any generics . */
public Map < String , String > parseSignatureForGenerics ( final String signature , final boolean isInterface ) { } }

implementation: if ( signature == null ) { return Collections . emptyMap ( ) ; } final Map < String , String > genericsMap = new HashMap < > ( ) ; SignatureReader sr = new SignatureReader ( signature ) ; StringBuilder sb = new StringBuilder ( ) ; TraceSignatureVisitor v = new TraceSignatureVisitor ( sb , isInterface ) { String genericName ; @ Override public void visitFormalTypeParameter ( final String name ) { genericName = name ; super . visitFormalTypeParameter ( name ) ; } @ Override public void visitClassType ( final String name ) { if ( genericName != null ) { genericsMap . put ( genericName , 'L' + name + ';' ) ; genericName = null ; } super . visitClassType ( name ) ; } } ; sr . accept ( v ) ; return genericsMap ;


signature:
public class SetResolver { /** * Resolves all collections for given type . */
public SetInjectionPoint [ ] resolve ( final Class type , final boolean autowire ) { } }

implementation: ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; List < SetInjectionPoint > list = new ArrayList < > ( ) ; PropertyDescriptor [ ] allProperties = cd . getAllPropertyDescriptors ( ) ; for ( PropertyDescriptor propertyDescriptor : allProperties ) { if ( propertyDescriptor . isGetterOnly ( ) ) { continue ; } Class propertyType = propertyDescriptor . getType ( ) ; if ( ! ClassUtil . isTypeOf ( propertyType , Collection . class ) ) { continue ; } MethodDescriptor writeMethodDescriptor = propertyDescriptor . getWriteMethodDescriptor ( ) ; FieldDescriptor fieldDescriptor = propertyDescriptor . getFieldDescriptor ( ) ; PetiteInject ref = null ; if ( writeMethodDescriptor != null ) { ref = writeMethodDescriptor . getMethod ( ) . getAnnotation ( PetiteInject . class ) ; } if ( ref == null && fieldDescriptor != null ) { ref = fieldDescriptor . getField ( ) . getAnnotation ( PetiteInject . class ) ; } if ( ( ! autowire ) && ( ref == null ) ) { continue ; } list . add ( new SetInjectionPoint ( propertyDescriptor ) ) ; } SetInjectionPoint [ ] fields ; if ( list . isEmpty ( ) ) { fields = SetInjectionPoint . EMPTY ; } else { fields = list . toArray ( new SetInjectionPoint [ 0 ] ) ; } return fields ;


signature:
public class JsonContext { /** * Returns < code > true < / code > if object has been already processed during the serialization .
 * Used to prevent circular dependencies . Objects are matched by identity . */
public boolean pushValue ( final Object value ) { } }

implementation: for ( int i = 0 ; i < bagSize ; i ++ ) { JsonValueContext valueContext = bag . get ( i ) ; if ( valueContext . getValue ( ) == value ) { return true ; } } if ( bagSize == bag . size ( ) ) { lastValueContext = new JsonValueContext ( value ) ; bag . add ( lastValueContext ) ; } else { lastValueContext = bag . get ( bagSize ) ; lastValueContext . reuse ( value ) ; } bagSize ++ ; return false ;


signature:
public class JsonContext { /** * { @ inheritDoc } */
@ Override public void pushName ( final String name , final boolean withComma ) { } }

implementation: JsonValueContext valueContext = peekValueContext ( ) ; if ( valueContext != null ) { valueContext . setPropertyName ( name ) ; } super . pushName ( name , withComma ) ;


signature:
public class JsonContext { /** * { @ inheritDoc } */
@ Override public void writeComma ( ) { } }

implementation: JsonValueContext valueContext = peekValueContext ( ) ; if ( valueContext != null ) { valueContext . incrementIndex ( ) ; } super . writeComma ( ) ;


signature:
public class JsonContext { /** * Serializes the object using { @ link jodd . json . TypeJsonSerializer type serializer } .
 * Returns < code > true < / code > if object was written , otherwise returns < code > false < / code > . */
public boolean serialize ( final Object object ) { } }

implementation:
if ( object == null ) { write ( NULL ) ; return true ; } TypeJsonSerializer typeJsonSerializer = null ; // callback
if ( serializerResolver != null ) { typeJsonSerializer = serializerResolver . apply ( object ) ; } if ( typeJsonSerializer == null ) { // + read paths map
if ( jsonSerializer . pathSerializersMap != null ) { typeJsonSerializer = jsonSerializer . pathSerializersMap . get ( path ) ; } final Class type = object . getClass ( ) ; // + read local types map
if ( jsonSerializer . typeSerializersMap != null ) { typeJsonSerializer = jsonSerializer . typeSerializersMap . lookup ( type ) ; } // + globals
if ( typeJsonSerializer == null ) { typeJsonSerializer = TypeJsonSerializerMap . get ( ) . lookup ( type ) ; } } return typeJsonSerializer . serialize ( this , object ) ;


signature:
public class JsonContext { /** * Matches property types that are ignored by default . */
public boolean matchIgnoredPropertyTypes ( final Class propertyType , final boolean excludeMaps , final boolean include ) { } }

implementation:
if ( ! include ) { return false ; } if ( propertyType != null ) { if ( ! jsonSerializer . deep ) { ClassDescriptor propertyTypeClassDescriptor = ClassIntrospector . get ( ) . lookup ( propertyType ) ; if ( propertyTypeClassDescriptor . isArray ( ) ) { return false ; } if ( propertyTypeClassDescriptor . isCollection ( ) ) { return false ; } if ( excludeMaps ) { if ( propertyTypeClassDescriptor . isMap ( ) ) { return false ; } } } // still not excluded , continue with excluded types and type names
// + excluded types
if ( jsonSerializer . excludedTypes != null ) { for ( Class excludedType : jsonSerializer . excludedTypes ) { if ( ClassUtil . isTypeOf ( propertyType , excludedType ) ) { return false ; } } } // + exclude type names
final String propertyTypeName = propertyType . getName ( ) ; if ( jsonSerializer . excludedTypeNames != null ) { for ( String excludedTypeName : jsonSerializer . excludedTypeNames ) { if ( Wildcard . match ( propertyTypeName , excludedTypeName ) ) { return false ; } } } } return true ;


signature:
public class DbSession { /** * Closes current session and all allocated resources .
 * All attached queries are closed . If a transaction is still active , exception occurs .
 * Database connection is returned to the { @ link ConnectionProvider } .
 * Closed session is no longer available for usage . */
public void closeSession ( ) { } }

implementation: log . debug ( "Closing db session" ) ; SQLException sqlException = null ; if ( queries != null ) { for ( DbQueryBase query : queries ) { SQLException sex = query . closeQuery ( ) ; if ( sex != null ) { if ( sqlException == null ) { sqlException = sex ; } else { sqlException . setNextException ( sex ) ; } } } } if ( connection != null ) { if ( txActive ) { throw new DbSqlException ( "TX was not closed before closing the session" ) ; } connectionProvider . closeConnection ( connection ) ; connection = null ; } queries = null ; if ( sqlException != null ) { throw new DbSqlException ( "Closing DbSession failed" , sqlException ) ; }


signature:
public class DbSession { /** * Opens connection in auto - commit mode , if already not opened . */
protected void openConnectionForQuery ( ) { } }

implementation:
if ( connection == null ) { connection = connectionProvider . getConnection ( ) ; txActive = false ; // txAction should already be false
try { connection . setAutoCommit ( true ) ; } catch ( SQLException sex ) { throw new DbSqlException ( "Failed to open non-TX connection" , sex ) ; } }


signature:
public class DbSession { /** * Opens a transaction . */
protected void openTx ( ) { } }

implementation: if ( connection == null ) { connection = connectionProvider . getConnection ( ) ; } txActive = true ; try { connection . setAutoCommit ( false ) ; if ( txMode . getIsolation ( ) != DbTransactionMode . ISOLATION_DEFAULT ) { connection . setTransactionIsolation ( txMode . getIsolation ( ) ) ; } connection . setReadOnly ( txMode . isReadOnly ( ) ) ; } catch ( SQLException sex ) { throw new DbSqlException ( "Open TX failed" , sex ) ; }


signature:
public class DbSession { /** * Closes current transaction . */
protected void closeTx ( ) { } }

implementation: txActive = false ; try { connection . setAutoCommit ( true ) ; } catch ( SQLException sex ) { throw new DbSqlException ( "Close TX failed" , sex ) ; }


signature:
public class DbSession { /** * Commit the current transaction , writing any unflushed changes to the database .
 * Transaction mode is closed . */
public void commitTransaction ( ) { } }

implementation: log . debug ( "Committing transaction" ) ; assertTxIsActive ( ) ; try { connection . commit ( ) ; } catch ( SQLException sex ) { throw new DbSqlException ( "Commit TX failed" , sex ) ; } finally { closeTx ( ) ; }


signature:
public class DbSession { /** * Roll back the current transaction . Transaction mode is closed . */
public void rollbackTransaction ( ) { } }

implementation: log . debug ( "Rolling-back transaction" ) ; assertTxIsActive ( ) ; try { connection . rollback ( ) ; } catch ( SQLException sex ) { throw new DbSqlException ( "Rollback TX failed" , sex ) ; } finally { closeTx ( ) ; }