signature:
public class ActionMethodParser { /** * Creates new instance of action runtime configuration .
 * Initialize caches . */
public ActionRuntime createActionRuntime ( final ActionHandler actionHandler , final Class actionClass , final Method actionClassMethod , final Class < ? extends ActionResult > actionResult , final Class < ? extends ActionResult > defaultActionResult , final ActionFilter [ ] filters , final ActionInterceptor [ ] interceptors , final ActionDefinition actionDefinition , final boolean async , final boolean auth ) { } }

implementation:
if ( actionHandler != null ) { return new ActionRuntime ( actionHandler , actionClass , actionClassMethod , filters , interceptors , actionDefinition , NoneActionResult . class , NoneActionResult . class , async , auth , null , null ) ; } final ScopeData scopeData = scopeDataInspector . inspectClassScopes ( actionClass ) ; // find ins and outs
final Class [ ] paramTypes = actionClassMethod . getParameterTypes ( ) ; final MethodParam [ ] params = new MethodParam [ paramTypes . length ] ; final Annotation [ ] [ ] paramAnns = actionClassMethod . getParameterAnnotations ( ) ; String [ ] methodParamNames = null ; // for all elements : action and method arguments . . .
for ( int ndx = 0 ; ndx < paramTypes . length ; ndx ++ ) { Class paramType = paramTypes [ ndx ] ; // lazy init to postpone bytecode usage , when method has no arguments
if ( methodParamNames == null ) { methodParamNames = actionMethodParamNameResolver . resolveParamNames ( actionClassMethod ) ; } final String paramName = methodParamNames [ ndx ] ; final Annotation [ ] parameterAnnotations = paramAnns [ ndx ] ; final ScopeData paramsScopeData = scopeDataInspector . inspectMethodParameterScopes ( paramName , paramType , parameterAnnotations ) ; MapperFunction mapperFunction = null ; for ( final Annotation annotation : parameterAnnotations ) { if ( annotation instanceof Mapper ) { mapperFunction = MapperFunctionInstances . get ( ) . lookup ( ( ( Mapper ) annotation ) . value ( ) ) ; break ; } } params [ ndx ] = new MethodParam ( paramTypes [ ndx ] , paramName , scopeDataInspector . detectAnnotationType ( parameterAnnotations ) , paramsScopeData , mapperFunction ) ; } return new ActionRuntime ( null , actionClass , actionClassMethod , filters , interceptors , actionDefinition , actionResult , defaultActionResult , async , auth , scopeData , params ) ;


signature:
public class TimeSqlType { /** * { @ inheritDoc } */
@ Override public Time get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: return rs . getTime ( index ) ;


signature:
public class TimeSqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final Time value , final int dbSqlType ) throws SQLException { } }

implementation: st . setTime ( index , value ) ;


signature:
public class DecoraResponseWrapper { /** * todo move to BufferResponseWrapper ? */
@ Override protected void preResponseCommit ( ) { } }

implementation: long lastModified = lastModifiedData . getLastModified ( ) ; long ifModifiedSince = request . getDateHeader ( "If-Modified-Since" ) ; if ( lastModified > - 1 && ! response . containsHeader ( "Last-Modified" ) ) { if ( ifModifiedSince < ( lastModified / 1000 * 1000 ) ) { response . setDateHeader ( "Last-Modified" , lastModified ) ; } else { response . reset ( ) ; response . setStatus ( HttpServletResponse . SC_NOT_MODIFIED ) ; } }


signature:
public class Converter { /** * Converts value to < code > Boolean < / code > . */
public Boolean toBoolean ( final Object value ) { } }

implementation: final TypeConverter < Boolean > tc = TypeConverterManager . get ( ) . lookup ( Boolean . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Boolean < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Boolean toBoolean ( final Object value , final Boolean defaultValue ) { } }

implementation: final Boolean result = toBoolean ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > boolean < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public boolean toBooleanValue ( final Object value , final boolean defaultValue ) { } }

implementation: final Boolean result = toBoolean ( value ) ; if ( result == null ) { return defaultValue ; } return result . booleanValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Integer < / code > . */
public Integer toInteger ( final Object value ) { } }

implementation: final TypeConverter < Integer > tc = TypeConverterManager . get ( ) . lookup ( Integer . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Integer < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Integer toInteger ( final Object value , final Integer defaultValue ) { } }

implementation: final Integer result = toInteger ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > int < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public int toIntValue ( final Object value , final int defaultValue ) { } }

implementation: final Integer result = toInteger ( value ) ; if ( result == null ) { return defaultValue ; } return result . intValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Long < / code > . */
public Long toLong ( final Object value ) { } }

implementation: final TypeConverter < Long > tc = TypeConverterManager . get ( ) . lookup ( Long . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Long < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Long toLong ( final Object value , final Long defaultValue ) { } }

implementation: final Long result = toLong ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > long < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public long toLongValue ( final Object value , final long defaultValue ) { } }

implementation: final Long result = toLong ( value ) ; if ( result == null ) { return defaultValue ; } return result . longValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Float < / code > . */
public Float toFloat ( final Object value ) { } }

implementation: final TypeConverter < Float > tc = TypeConverterManager . get ( ) . lookup ( Float . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Float < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Float toFloat ( final Object value , final Float defaultValue ) { } }

implementation: final Float result = toFloat ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > float < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public float toFloatValue ( final Object value , final float defaultValue ) { } }

implementation: final Float result = toFloat ( value ) ; if ( result == null ) { return defaultValue ; } return result . floatValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Double < / code > . */
public Double toDouble ( final Object value ) { } }

implementation: final TypeConverter < Double > tc = TypeConverterManager . get ( ) . lookup ( Double . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Double < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Double toDouble ( final Object value , final Double defaultValue ) { } }

implementation: final Double result = toDouble ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > double < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public double toDoubleValue ( final Object value , final double defaultValue ) { } }

implementation: final Double result = toDouble ( value ) ; if ( result == null ) { return defaultValue ; } return result . doubleValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Short < / code > . */
public Short toShort ( final Object value ) { } }

implementation: final TypeConverter < Short > tc = TypeConverterManager . get ( ) . lookup ( Short . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Short < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Short toShort ( final Object value , final Short defaultValue ) { } }

implementation: final Short result = toShort ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > short < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public short toShortValue ( final Object value , final short defaultValue ) { } }

implementation: final Short result = toShort ( value ) ; if ( result == null ) { return defaultValue ; } return result . shortValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Character < / code > . */
public Character toCharacter ( final Object value ) { } }

implementation: final TypeConverter < Character > tc = TypeConverterManager . get ( ) . lookup ( Character . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Character < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Character toCharacter ( final Object value , final Character defaultValue ) { } }

implementation: final Character result = toCharacter ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > char < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public char toCharValue ( final Object value , final char defaultValue ) { } }

implementation: final Character result = toCharacter ( value ) ; if ( result == null ) { return defaultValue ; } return result . charValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > Byte < / code > . */
public Byte toByte ( final Object value ) { } }

implementation: final TypeConverter < Byte > tc = TypeConverterManager . get ( ) . lookup ( Byte . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Byte < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public Byte toByte ( final Object value , final Byte defaultValue ) { } }

implementation: final Byte result = toByte ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > byte < / code > . Returns default value
 * when conversion result is < code > null < / code > . */
public byte toByteValue ( final Object value , final byte defaultValue ) { } }

implementation: final Byte result = toByte ( value ) ; if ( result == null ) { return defaultValue ; } return result . byteValue ( ) ;


signature:
public class Converter { /** * Converts value to < code > long [ ] < / code > . */
public long [ ] toLongArray ( final Object value ) { } }

implementation: final TypeConverter < long [ ] > tc = TypeConverterManager . get ( ) . lookup ( long [ ] . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > String [ ] < / code > . */
public String [ ] toStringArray ( final Object value ) { } }

implementation: final TypeConverter < String [ ] > tc = TypeConverterManager . get ( ) . lookup ( String [ ] . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > Class < / code > . */
public Class toClass ( final Object value ) { } }

implementation: final TypeConverter < Class > tc = TypeConverterManager . get ( ) . lookup ( Class . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > BigInteger < / code > . */
public BigInteger toBigInteger ( final Object value ) { } }

implementation: final TypeConverter < BigInteger > tc = TypeConverterManager . get ( ) . lookup ( BigInteger . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > BigInteger < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public BigInteger toBigInteger ( final Object value , final BigInteger defaultValue ) { } }

implementation: final BigInteger result = toBigInteger ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class Converter { /** * Converts value to < code > BigDecimal < / code > . */
public BigDecimal toBigDecimal ( final Object value ) { } }

implementation: final TypeConverter < BigDecimal > tc = TypeConverterManager . get ( ) . lookup ( BigDecimal . class ) ; return tc . convert ( value ) ;


signature:
public class Converter { /** * Converts value to < code > BigDecimal < / code > . Returns default value
 * when conversion result is < code > null < / code > */
public BigDecimal toBigDecimal ( final Object value , final BigDecimal defaultValue ) { } }

implementation: final BigDecimal result = toBigDecimal ( value ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class RangeConstraint { /** * - - - - - configure */
@ Override public void configure ( final Range annotation ) { } }

implementation: this . min = annotation . min ( ) ; this . max = annotation . max ( ) ;


signature:
public class AutomagicPetiteConfigurator { /** * Configures { @ link jodd . petite . PetiteContainer } 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 PetiteException ( "Scan classpath error" , ex ) ; } elapsed = System . currentTimeMillis ( ) - elapsed ; log . info ( "Petite configured in " + elapsed + " ms. Total beans: " + container . beansCount ( ) ) ;


signature:
public class AutomagicPetiteConfigurator { /** * Registers a class consumer that registers only those annotated with { @ link jodd . petite . meta . PetiteBean } .
 * 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 ( PETITE_BEAN_ANNOTATION_BYTES ) ) { return ; } final Class < ? > beanClass ; try { beanClass = classPathEntry . loadClass ( ) ; } catch ( ClassNotFoundException cnfex ) { throw new PetiteException ( "Unable to load class: " + cnfex , cnfex ) ; } if ( beanClass == null ) { return ; } final PetiteBean petiteBean = beanClass . getAnnotation ( PetiteBean . class ) ; if ( petiteBean == null ) { return ; } container . registerPetiteBean ( beanClass , null , null , null , false , null ) ; } ) ;


signature:
public class DelegateAdviceUtil { /** * Applies advice on given target class and returns proxy instance . */
public static < T > T applyAdvice ( final Class < T > targetClass ) { } }

implementation:
Class adviceClass = cache . get ( targetClass ) ; if ( adviceClass == null ) { // advice not yet created
adviceClass = PROXY_PROXETTA . proxy ( ) . setTarget ( targetClass ) . define ( ) ; cache . put ( targetClass , adviceClass ) ; } // create new advice instance and injects target instance to it
try { Object advice = ClassUtil . newInstance ( adviceClass ) ; Field field = adviceClass . getField ( "$___target$0" ) ; field . set ( advice , targetClass ) ; return ( T ) advice ; } catch ( Exception ex ) { throw new ProxettaException ( ex ) ; }


signature:
public class DelegateAdviceUtil { /** * Injects target into proxy . */
public static void injectTargetIntoProxy ( final Object proxy , final Object target ) { } }

implementation: Class proxyClass = proxy . getClass ( ) ; try { Field field = proxyClass . getField ( "$___target$0" ) ; field . set ( proxy , target ) ; } catch ( Exception ex ) { throw new ProxettaException ( ex ) ; }


signature:
public class FieldVisitor { /** * Visits an annotation of the field .
 * @ param descriptor the class descriptor of the annotation class .
 * @ param visible { @ literal true } if the annotation is visible at runtime .
 * @ return a visitor to visit the annotation values , or { @ literal null } if this visitor is not
 * interested in visiting this annotation . */
public AnnotationVisitor visitAnnotation ( final String descriptor , final boolean visible ) { } }

implementation: if ( fv != null ) { return fv . visitAnnotation ( descriptor , visible ) ; } return null ;


signature:
public class TypeData { /** * Resolves real name from JSON name . */
public String resolveRealName ( final String jsonName ) { } }

implementation: if ( jsonNames == null ) { return jsonName ; } int jsonIndex = ArraysUtil . indexOf ( jsonNames , jsonName ) ; if ( jsonIndex == - 1 ) { return jsonName ; } return realNames [ jsonIndex ] ;


signature:
public class TypeData { /** * Resolves JSON name from real name . */
public String resolveJsonName ( final String realName ) { } }

implementation: if ( realNames == null ) { return realName ; } int realIndex = ArraysUtil . indexOf ( realNames , realName ) ; if ( realIndex == - 1 ) { return realName ; } return jsonNames [ realIndex ] ;


signature:
public class JsonAnnotationManager { /** * Returns all includes for given type . Returns an empty array
 * when no includes are defined . */
public TypeData lookupTypeData ( final Class type ) { } }

implementation: TypeData typeData = typeDataMap . get ( type ) ; if ( typeData == null ) { if ( serializationSubclassAware ) { typeData = findSubclassTypeData ( type ) ; } if ( typeData == null ) { typeData = scanClassForAnnotations ( type ) ; typeDataMap . put ( type , typeData ) ; } } return typeData ;


signature:
public class JsonAnnotationManager { /** * Lookups type data and creates one if missing . */
protected TypeData _lookupTypeData ( final Class type ) { } }

implementation: TypeData typeData = typeDataMap . get ( type ) ; if ( typeData == null ) { typeData = scanClassForAnnotations ( type ) ; typeDataMap . put ( type , typeData ) ; } return typeData ;


signature:
public class JsonAnnotationManager { /** * Finds type data of first annotated superclass or interface . */
protected TypeData findSubclassTypeData ( final Class type ) { } }

implementation:
final Class < ? extends Annotation > defaultAnnotation = jsonAnnotation ; if ( type . getAnnotation ( defaultAnnotation ) != null ) { // current type has annotation , don ' t find anything , let type data be created
return null ; } ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; // lookup superclasses
Class [ ] superClasses = cd . getAllSuperclasses ( ) ; for ( Class superClass : superClasses ) { if ( superClass . getAnnotation ( defaultAnnotation ) != null ) { // annotated subclass founded !
return _lookupTypeData ( superClass ) ; } } Class [ ] interfaces = cd . getAllInterfaces ( ) ; for ( Class interfaze : interfaces ) { if ( interfaze . getAnnotation ( defaultAnnotation ) != null ) { // annotated subclass founded !
return _lookupTypeData ( interfaze ) ; } } return null ;


signature:
public class JsonAnnotationManager { /** * Returns different name of a property if set by annotation . */
public String resolveJsonName ( final Class type , final String name ) { } }

implementation: TypeData typeData = lookupTypeData ( type ) ; return typeData . resolveJsonName ( name ) ;


signature:
public class JsonAnnotationManager { /** * Returns real property name for given JSON property . */
public String resolveRealName ( final Class type , final String jsonName ) { } }

implementation: TypeData typeData = lookupTypeData ( type ) ; return typeData . resolveRealName ( jsonName ) ;


signature:
public class JsonAnnotationManager { /** * Scans class for annotations and returns { @ link TypeData } . */
private TypeData scanClassForAnnotations ( final Class type ) { } }

implementation:
ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; PropertyDescriptor [ ] pds = cd . getAllPropertyDescriptors ( ) ; ArrayList < String > includedList = new ArrayList < > ( ) ; ArrayList < String > excludedList = new ArrayList < > ( ) ; ArrayList < String > jsonNames = new ArrayList < > ( ) ; ArrayList < String > realNames = new ArrayList < > ( ) ; AnnotationParser annotationParser = JSONAnnotationValues . parserFor ( jsonAnnotation ) ; for ( PropertyDescriptor pd : pds ) { JSONAnnotationValues data = null ; { MethodDescriptor md = pd . getReadMethodDescriptor ( ) ; if ( md != null ) { Method method = md . getMethod ( ) ; data = JSONAnnotationValues . of ( annotationParser , method ) ; } } if ( data == null ) { MethodDescriptor md = pd . getWriteMethodDescriptor ( ) ; if ( md != null ) { Method method = md . getMethod ( ) ; data = JSONAnnotationValues . of ( annotationParser , method ) ; } } if ( data == null ) { FieldDescriptor fd = pd . getFieldDescriptor ( ) ; if ( fd != null ) { Field field = fd . getField ( ) ; data = JSONAnnotationValues . of ( annotationParser , field ) ; } } if ( data != null ) { // annotation found
String propertyName = pd . getName ( ) ; String newPropertyName = data . name ( ) ; if ( newPropertyName != null ) { realNames . add ( propertyName ) ; jsonNames . add ( newPropertyName ) ; propertyName = newPropertyName ; } if ( data . include ( ) ) { includedList . add ( propertyName ) ; } else { excludedList . add ( propertyName ) ; } } } String [ ] reals = null ; if ( ! realNames . isEmpty ( ) ) { reals = realNames . toArray ( new String [ 0 ] ) ; } String [ ] jsons = null ; if ( ! jsonNames . isEmpty ( ) ) { jsons = jsonNames . toArray ( new String [ 0 ] ) ; } // type
JSONAnnotationValues data = JSONAnnotationValues . of ( annotationParser , type ) ; return new TypeData ( includedList , excludedList , data != null && data . strict ( ) , jsons , reals ) ;


signature:
public class AdaptiveFileUpload { /** * - - - - - process */
protected boolean matchFileExtension ( ) throws IOException { } }

implementation:
String fileNameExtension = FileNameUtil . getExtension ( getHeader ( ) . getFileName ( ) ) ; for ( String fileExtension : fileExtensions ) { if ( fileNameExtension . equalsIgnoreCase ( fileExtension ) ) { if ( ! allowFileExtensions ) { // extension matched and it is not allowed
if ( breakOnError ) { throw new IOException ( "Upload filename extension not allowed: " + fileNameExtension ) ; } size = input . skipToBoundary ( ) ; return false ; } return true ; // extension matched and it is allowed .
} } if ( allowFileExtensions ) { // extension is not one of the allowed ones .
if ( breakOnError ) { throw new IOException ( "Upload filename extension not allowed: " + fileNameExtension ) ; } size = input . skipToBoundary ( ) ; return false ; } return true ;


signature:
public class AdaptiveFileUpload { /** * Returns the content of file upload item . */
@ Override public byte [ ] getFileContent ( ) throws IOException { } }

implementation: if ( data != null ) { return data ; } if ( tempFile != null ) { return FileUtil . readBytes ( tempFile ) ; } return null ;


signature:
public class SymbolTable { /** * Read the BootstrapMethods ' bootstrap _ methods ' array binary content and add them as entries of
 * the SymbolTable .
 * @ param classReader the ClassReader whose bootstrap methods must be copied to initialize the
 * SymbolTable .
 * @ param charBuffer a buffer used to read strings in the constant pool . */
private void copyBootstrapMethods ( final ClassReader classReader , final char [ ] charBuffer ) { } }

implementation:
// Find attributOffset of the ' bootstrap _ methods ' array .
byte [ ] inputBytes = classReader . b ; int currentAttributeOffset = classReader . getFirstAttributeOffset ( ) ; for ( int i = classReader . readUnsignedShort ( currentAttributeOffset - 2 ) ; i > 0 ; -- i ) { String attributeName = classReader . readUTF8 ( currentAttributeOffset , charBuffer ) ; if ( Constants . BOOTSTRAP_METHODS . equals ( attributeName ) ) { bootstrapMethodCount = classReader . readUnsignedShort ( currentAttributeOffset + 6 ) ; break ; } currentAttributeOffset += 6 + classReader . readInt ( currentAttributeOffset + 2 ) ; } if ( bootstrapMethodCount > 0 ) { // Compute the offset and the length of the BootstrapMethods ' bootstrap _ methods ' array .
int bootstrapMethodsOffset = currentAttributeOffset + 8 ; int bootstrapMethodsLength = classReader . readInt ( currentAttributeOffset + 2 ) - 2 ; bootstrapMethods = new ByteVector ( bootstrapMethodsLength ) ; bootstrapMethods . putByteArray ( inputBytes , bootstrapMethodsOffset , bootstrapMethodsLength ) ; // Add each bootstrap method in the symbol table entries .
int currentOffset = bootstrapMethodsOffset ; for ( int i = 0 ; i < bootstrapMethodCount ; i ++ ) { int offset = currentOffset - bootstrapMethodsOffset ; int bootstrapMethodRef = classReader . readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; int numBootstrapArguments = classReader . readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; int hashCode = classReader . readConst ( bootstrapMethodRef , charBuffer ) . hashCode ( ) ; while ( numBootstrapArguments -- > 0 ) { int bootstrapArgument = classReader . readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; hashCode ^= classReader . readConst ( bootstrapArgument , charBuffer ) . hashCode ( ) ; } add ( new Entry ( i , Symbol . BOOTSTRAP_METHOD_TAG , offset , hashCode & 0x7FFFFFFF ) ) ; } }


signature:
public class SymbolTable { /** * Sets the major version and the name of the class to which this symbol table belongs . Also adds
 * the class name to the constant pool .
 * @ param majorVersion a major ClassFile version number .
 * @ param className an internal class name .
 * @ return the constant pool index of a new or already existing Symbol with the given class name . */
int setMajorVersionAndClassName ( final int majorVersion , final String className ) { } }

implementation: this . majorVersion = majorVersion ; this . className = className ; return addConstantClass ( className ) . index ;


signature:
public class SymbolTable { /** * Puts this symbol table ' s constant _ pool array in the given ByteVector , preceded by the
 * constant _ pool _ count value .
 * @ param output where the JVMS ClassFile ' s constant _ pool array must be put . */
void putConstantPool ( final ByteVector output ) { } }

implementation: output . putShort ( constantPoolCount ) . putByteArray ( constantPool . data , 0 , constantPool . length ) ;


signature:
public class SymbolTable { /** * Puts this symbol table ' s BootstrapMethods attribute in the given ByteVector . This includes the
 * 6 attribute header bytes and the num _ bootstrap _ methods value .
 * @ param output where the JVMS BootstrapMethods attribute must be put . */
void putBootstrapMethods ( final ByteVector output ) { } }

implementation: if ( bootstrapMethods != null ) { output . putShort ( addConstantUtf8 ( Constants . BOOTSTRAP_METHODS ) ) . putInt ( bootstrapMethods . length + 2 ) . putShort ( bootstrapMethodCount ) . putByteArray ( bootstrapMethods . data , 0 , bootstrapMethods . length ) ; }


signature:
public class SymbolTable { /** * Puts the given entry in the { @ link # entries } hash set . This method does < i > not < / i > check
 * whether { @ link # entries } already contains a similar entry or not . { @ link # entries } is resized
 * if necessary to avoid hash collisions ( multiple entries needing to be stored at the same { @ link
 * # entries } array index ) as much as possible , with reasonable memory usage .
 * @ param entry an Entry ( which must not already be contained in { @ link # entries } ) .
 * @ return the given entry */
private Entry put ( final Entry entry ) { } }

implementation: if ( entryCount > ( entries . length * 3 ) / 4 ) { int currentCapacity = entries . length ; int newCapacity = currentCapacity * 2 + 1 ; Entry [ ] newEntries = new Entry [ newCapacity ] ; for ( int i = currentCapacity - 1 ; i >= 0 ; -- i ) { Entry currentEntry = entries [ i ] ; while ( currentEntry != null ) { int newCurrentEntryIndex = currentEntry . hashCode % newCapacity ; Entry nextEntry = currentEntry . next ; currentEntry . next = newEntries [ newCurrentEntryIndex ] ; newEntries [ newCurrentEntryIndex ] = currentEntry ; currentEntry = nextEntry ; } } entries = newEntries ; } entryCount ++ ; int index = entry . hashCode % entries . length ; entry . next = entries [ index ] ; return entries [ index ] = entry ;


signature:
public class SymbolTable { /** * Adds the given entry in the { @ link # entries } hash set . This method does < i > not < / i > check
 * whether { @ link # entries } already contains a similar entry or not , and does < i > not < / i > resize
 * { @ link # entries } if necessary .
 * @ param entry an Entry ( which must not already be contained in { @ link # entries } ) . */
private void add ( final Entry entry ) { } }

implementation: entryCount ++ ; int index = entry . hashCode % entries . length ; entry . next = entries [ index ] ; entries [ index ] = entry ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Fieldref _ info to the constant pool of this symbol table . Does nothing if the
 * constant pool already contains a similar item .
 * @ param owner the internal name of a class .
 * @ param name a field name .
 * @ param descriptor a field descriptor .
 * @ return a new or already existing Symbol with the given value . */
Symbol addConstantFieldref ( final String owner , final String name , final String descriptor ) { } }

implementation: return addConstantMemberReference ( Symbol . CONSTANT_FIELDREF_TAG , owner , name , descriptor ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Methodref _ info or CONSTANT _ InterfaceMethodref _ info to the constant pool of this
 * symbol table . Does nothing if the constant pool already contains a similar item .
 * @ param owner the internal name of a class .
 * @ param name a method name .
 * @ param descriptor a method descriptor .
 * @ param isInterface whether owner is an interface or not .
 * @ return a new or already existing Symbol with the given value . */
Symbol addConstantMethodref ( final String owner , final String name , final String descriptor , final boolean isInterface ) { } }

implementation: int tag = isInterface ? Symbol . CONSTANT_INTERFACE_METHODREF_TAG : Symbol . CONSTANT_METHODREF_TAG ; return addConstantMemberReference ( tag , owner , name , descriptor ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Fieldref _ info , CONSTANT _ Methodref _ info or CONSTANT _ InterfaceMethodref _ info to
 * the constant pool of this symbol table . Does nothing if the constant pool already contains a
 * similar item .
 * @ param tag one of { @ link Symbol # CONSTANT _ FIELDREF _ TAG } , { @ link Symbol # CONSTANT _ METHODREF _ TAG }
 * or { @ link Symbol # CONSTANT _ INTERFACE _ METHODREF _ TAG } .
 * @ param owner the internal name of a class .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor .
 * @ return a new or already existing Symbol with the given value . */
private Entry addConstantMemberReference ( final int tag , final String owner , final String name , final String descriptor ) { } }

implementation: int hashCode = hash ( tag , owner , name , descriptor ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . owner . equals ( owner ) && entry . name . equals ( name ) && entry . value . equals ( descriptor ) ) { return entry ; } entry = entry . next ; } constantPool . put122 ( tag , addConstantClass ( owner ) . index , addConstantNameAndType ( name , descriptor ) ) ; return put ( new Entry ( constantPoolCount ++ , tag , owner , name , descriptor , 0 , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ Fieldref _ info , CONSTANT _ Methodref _ info or CONSTANT _ InterfaceMethodref _ info
 * to the constant pool of this symbol table .
 * @ param index the constant pool index of the new Symbol .
 * @ param tag one of { @ link Symbol # CONSTANT _ FIELDREF _ TAG } , { @ link Symbol # CONSTANT _ METHODREF _ TAG }
 * or { @ link Symbol # CONSTANT _ INTERFACE _ METHODREF _ TAG } .
 * @ param owner the internal name of a class .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor . */
private void addConstantMemberReference ( final int index , final int tag , final String owner , final String name , final String descriptor ) { } }

implementation: add ( new Entry ( index , tag , owner , name , descriptor , 0 , hash ( tag , owner , name , descriptor ) ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Integer _ info or CONSTANT _ Float _ info to the constant pool of this symbol table .
 * Does nothing if the constant pool already contains a similar item .
 * @ param tag one of { @ link Symbol # CONSTANT _ INTEGER _ TAG } or { @ link Symbol # CONSTANT _ FLOAT _ TAG } .
 * @ param value an int or float .
 * @ return a constant pool constant with the given tag and primitive values . */
private Symbol addConstantIntegerOrFloat ( final int tag , final int value ) { } }

implementation: int hashCode = hash ( tag , value ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . data == value ) { return entry ; } entry = entry . next ; } constantPool . putByte ( tag ) . putInt ( value ) ; return put ( new Entry ( constantPoolCount ++ , tag , value , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ Integer _ info or CONSTANT _ Float _ info to the constant pool of this symbol
 * table .
 * @ param index the constant pool index of the new Symbol .
 * @ param tag one of { @ link Symbol # CONSTANT _ INTEGER _ TAG } or { @ link Symbol # CONSTANT _ FLOAT _ TAG } .
 * @ param value an int or float . */
private void addConstantIntegerOrFloat ( final int index , final int tag , final int value ) { } }

implementation: add ( new Entry ( index , tag , value , hash ( tag , value ) ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Long _ info or CONSTANT _ Double _ info to the constant pool of this symbol table .
 * Does nothing if the constant pool already contains a similar item .
 * @ param tag one of { @ link Symbol # CONSTANT _ LONG _ TAG } or { @ link Symbol # CONSTANT _ DOUBLE _ TAG } .
 * @ param value a long or double .
 * @ return a constant pool constant with the given tag and primitive values . */
private Symbol addConstantLongOrDouble ( final int tag , final long value ) { } }

implementation: int hashCode = hash ( tag , value ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . data == value ) { return entry ; } entry = entry . next ; } int index = constantPoolCount ; constantPool . putByte ( tag ) . putLong ( value ) ; constantPoolCount += 2 ; return put ( new Entry ( index , tag , value , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ Long _ info or CONSTANT _ Double _ info to the constant pool of this symbol
 * table .
 * @ param index the constant pool index of the new Symbol .
 * @ param tag one of { @ link Symbol # CONSTANT _ LONG _ TAG } or { @ link Symbol # CONSTANT _ DOUBLE _ TAG } .
 * @ param value a long or double . */
private void addConstantLongOrDouble ( final int index , final int tag , final long value ) { } }


signature:
public class SymbolTable { /** * Adds a CONSTANT _ NameAndType _ info to the constant pool of this symbol table . Does nothing if the
 * constant pool already contains a similar item .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor .
 * @ return a new or already existing Symbol with the given value . */
int addConstantNameAndType ( final String name , final String descriptor ) { } }

implementation: final int tag = Symbol . CONSTANT_NAME_AND_TYPE_TAG ; int hashCode = hash ( tag , name , descriptor ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . name . equals ( name ) && entry . value . equals ( descriptor ) ) { return entry . index ; } entry = entry . next ; } constantPool . put122 ( tag , addConstantUtf8 ( name ) , addConstantUtf8 ( descriptor ) ) ; return put ( new Entry ( constantPoolCount ++ , tag , name , descriptor , hashCode ) ) . index ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ NameAndType _ info to the constant pool of this symbol table .
 * @ param index the constant pool index of the new Symbol .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor . */
private void addConstantNameAndType ( final int index , final String name , final String descriptor ) { } }

implementation: final int tag = Symbol . CONSTANT_NAME_AND_TYPE_TAG ; add ( new Entry ( index , tag , name , descriptor , hash ( tag , name , descriptor ) ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Utf8 _ info to the constant pool of this symbol table . Does nothing if the
 * constant pool already contains a similar item .
 * @ param value a string .
 * @ return a new or already existing Symbol with the given value . */
int addConstantUtf8 ( final String value ) { } }

implementation: int hashCode = hash ( Symbol . CONSTANT_UTF8_TAG , value ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == Symbol . CONSTANT_UTF8_TAG && entry . hashCode == hashCode && entry . value . equals ( value ) ) { return entry . index ; } entry = entry . next ; } constantPool . putByte ( Symbol . CONSTANT_UTF8_TAG ) . putUTF8 ( value ) ; return put ( new Entry ( constantPoolCount ++ , Symbol . CONSTANT_UTF8_TAG , value , hashCode ) ) . index ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ String _ info to the constant pool of this symbol table .
 * @ param index the constant pool index of the new Symbol .
 * @ param value a string . */
private void addConstantUtf8 ( final int index , final String value ) { } }

implementation: add ( new Entry ( index , Symbol . CONSTANT_UTF8_TAG , value , hash ( Symbol . CONSTANT_UTF8_TAG , value ) ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ MethodHandle _ info to the constant pool of this symbol table . Does nothing if
 * the constant pool already contains a similar item .
 * @ param referenceKind one of { @ link Opcodes # H _ GETFIELD } , { @ link Opcodes # H _ GETSTATIC } , { @ link
 * Opcodes # H _ PUTFIELD } , { @ link Opcodes # H _ PUTSTATIC } , { @ link Opcodes # H _ INVOKEVIRTUAL } , { @ link
 * Opcodes # H _ INVOKESTATIC } , { @ link Opcodes # H _ INVOKESPECIAL } , { @ link
 * Opcodes # H _ NEWINVOKESPECIAL } or { @ link Opcodes # H _ INVOKEINTERFACE } .
 * @ param owner the internal name of a class of interface .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor .
 * @ param isInterface whether owner is an interface or not .
 * @ return a new or already existing Symbol with the given value . */
Symbol addConstantMethodHandle ( final int referenceKind , final String owner , final String name , final String descriptor , final boolean isInterface ) { } }

implementation:
final int tag = Symbol . CONSTANT_METHOD_HANDLE_TAG ; // Note that we don ' t need to include isInterface in the hash computation , because it is
// redundant with owner ( we can ' t have the same owner with different isInterface values ) .
int hashCode = hash ( tag , owner , name , descriptor , referenceKind ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . data == referenceKind && entry . owner . equals ( owner ) && entry . name . equals ( name ) && entry . value . equals ( descriptor ) ) { return entry ; } entry = entry . next ; } if ( referenceKind <= Opcodes . H_PUTSTATIC ) { constantPool . put112 ( tag , referenceKind , addConstantFieldref ( owner , name , descriptor ) . index ) ; } else { constantPool . put112 ( tag , referenceKind , addConstantMethodref ( owner , name , descriptor , isInterface ) . index ) ; } return put ( new Entry ( constantPoolCount ++ , tag , owner , name , descriptor , referenceKind , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ MethodHandle _ info to the constant pool of this symbol table .
 * @ param index the constant pool index of the new Symbol .
 * @ param referenceKind one of { @ link Opcodes # H _ GETFIELD } , { @ link Opcodes # H _ GETSTATIC } , { @ link
 * Opcodes # H _ PUTFIELD } , { @ link Opcodes # H _ PUTSTATIC } , { @ link Opcodes # H _ INVOKEVIRTUAL } , { @ link
 * Opcodes # H _ INVOKESTATIC } , { @ link Opcodes # H _ INVOKESPECIAL } , { @ link
 * Opcodes # H _ NEWINVOKESPECIAL } or { @ link Opcodes # H _ INVOKEINTERFACE } .
 * @ param owner the internal name of a class of interface .
 * @ param name a field or method name .
 * @ param descriptor a field or method descriptor . */
private void addConstantMethodHandle ( final int index , final int referenceKind , final String owner , final String name , final String descriptor ) { } }

implementation: final int tag = Symbol . CONSTANT_METHOD_HANDLE_TAG ; int hashCode = hash ( tag , owner , name , descriptor , referenceKind ) ; add ( new Entry ( index , tag , owner , name , descriptor , referenceKind , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Dynamic _ info to the constant pool of this symbol table . Also adds the related
 * bootstrap method to the BootstrapMethods of this symbol table . Does nothing if the constant
 * pool already contains a similar item .
 * @ param name a method name .
 * @ param descriptor a field descriptor .
 * @ param bootstrapMethodHandle a bootstrap method handle .
 * @ param bootstrapMethodArguments the bootstrap method arguments .
 * @ return a new or already existing Symbol with the given value . */
Symbol addConstantDynamic ( final String name , final String descriptor , final Handle bootstrapMethodHandle , final Object ... bootstrapMethodArguments ) { } }

implementation: Symbol bootstrapMethod = addBootstrapMethod ( bootstrapMethodHandle , bootstrapMethodArguments ) ; return addConstantDynamicOrInvokeDynamicReference ( Symbol . CONSTANT_DYNAMIC_TAG , name , descriptor , bootstrapMethod . index ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ InvokeDynamic _ info to the constant pool of this symbol table . Also adds the
 * related bootstrap method to the BootstrapMethods of this symbol table . Does nothing if the
 * constant pool already contains a similar item .
 * @ param name a method name .
 * @ param descriptor a method descriptor .
 * @ param bootstrapMethodHandle a bootstrap method handle .
 * @ param bootstrapMethodArguments the bootstrap method arguments .
 * @ return a new or already existing Symbol with the given value . */
Symbol addConstantInvokeDynamic ( final String name , final String descriptor , final Handle bootstrapMethodHandle , final Object ... bootstrapMethodArguments ) { } }

implementation: Symbol bootstrapMethod = addBootstrapMethod ( bootstrapMethodHandle , bootstrapMethodArguments ) ; return addConstantDynamicOrInvokeDynamicReference ( Symbol . CONSTANT_INVOKE_DYNAMIC_TAG , name , descriptor , bootstrapMethod . index ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Dynamic or a CONSTANT _ InvokeDynamic _ info to the constant pool of this symbol
 * table . Does nothing if the constant pool already contains a similar item .
 * @ param tag one of { @ link Symbol # CONSTANT _ DYNAMIC _ TAG } or { @ link
 * Symbol # CONSTANT _ INVOKE _ DYNAMIC _ TAG } .
 * @ param name a method name .
 * @ param descriptor a field descriptor for CONSTANT _ DYNAMIC _ TAG ) or a method descriptor for
 * CONSTANT _ INVOKE _ DYNAMIC _ TAG .
 * @ param bootstrapMethodIndex the index of a bootstrap method in the BootstrapMethods attribute .
 * @ return a new or already existing Symbol with the given value . */
private Symbol addConstantDynamicOrInvokeDynamicReference ( final int tag , final String name , final String descriptor , final int bootstrapMethodIndex ) { } }

implementation: int hashCode = hash ( tag , name , descriptor , bootstrapMethodIndex ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . data == bootstrapMethodIndex && entry . name . equals ( name ) && entry . value . equals ( descriptor ) ) { return entry ; } entry = entry . next ; } constantPool . put122 ( tag , bootstrapMethodIndex , addConstantNameAndType ( name , descriptor ) ) ; return put ( new Entry ( constantPoolCount ++ , tag , null , name , descriptor , bootstrapMethodIndex , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ Dynamic _ info or CONSTANT _ InvokeDynamic _ info to the constant pool of this
 * symbol table .
 * @ param tag one of { @ link Symbol # CONSTANT _ DYNAMIC _ TAG } or { @ link
 * Symbol # CONSTANT _ INVOKE _ DYNAMIC _ TAG } .
 * @ param index the constant pool index of the new Symbol .
 * @ param name a method name .
 * @ param descriptor a field descriptor for CONSTANT _ DYNAMIC _ TAG or a method descriptor for
 * CONSTANT _ INVOKE _ DYNAMIC _ TAG .
 * @ param bootstrapMethodIndex the index of a bootstrap method in the BootstrapMethods attribute . */
private void addConstantDynamicOrInvokeDynamicReference ( final int tag , final int index , final String name , final String descriptor , final int bootstrapMethodIndex ) { } }

implementation: int hashCode = hash ( tag , name , descriptor , bootstrapMethodIndex ) ; add ( new Entry ( index , tag , null , name , descriptor , bootstrapMethodIndex , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a CONSTANT _ Class _ info , CONSTANT _ String _ info , CONSTANT _ MethodType _ info ,
 * CONSTANT _ Module _ info or CONSTANT _ Package _ info to the constant pool of this symbol table . Does
 * nothing if the constant pool already contains a similar item .
 * @ param tag one of { @ link Symbol # CONSTANT _ CLASS _ TAG } , { @ link Symbol # CONSTANT _ STRING _ TAG } , { @ link
 * Symbol # CONSTANT _ METHOD _ TYPE _ TAG } , { @ link Symbol # CONSTANT _ MODULE _ TAG } or { @ link
 * Symbol # CONSTANT _ PACKAGE _ TAG } .
 * @ param value an internal class name , an arbitrary string , a method descriptor , a module or a
 * package name , depending on tag .
 * @ return a new or already existing Symbol with the given value . */
private Symbol addConstantUtf8Reference ( final int tag , final String value ) { } }

implementation: int hashCode = hash ( tag , value ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == tag && entry . hashCode == hashCode && entry . value . equals ( value ) ) { return entry ; } entry = entry . next ; } constantPool . put12 ( tag , addConstantUtf8 ( value ) ) ; return put ( new Entry ( constantPoolCount ++ , tag , value , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a new CONSTANT _ Class _ info , CONSTANT _ String _ info , CONSTANT _ MethodType _ info ,
 * CONSTANT _ Module _ info or CONSTANT _ Package _ info to the constant pool of this symbol table .
 * @ param index the constant pool index of the new Symbol .
 * @ param tag one of { @ link Symbol # CONSTANT _ CLASS _ TAG } , { @ link Symbol # CONSTANT _ STRING _ TAG } , { @ link
 * Symbol # CONSTANT _ METHOD _ TYPE _ TAG } , { @ link Symbol # CONSTANT _ MODULE _ TAG } or { @ link
 * Symbol # CONSTANT _ PACKAGE _ TAG } .
 * @ param value an internal class name , an arbitrary string , a method descriptor , a module or a
 * package name , depending on tag . */
private void addConstantUtf8Reference ( final int index , final int tag , final String value ) { } }


signature:
public class SymbolTable { /** * Adds a bootstrap method to the BootstrapMethods attribute of this symbol table . Does nothing if
 * the BootstrapMethods already contains a similar bootstrap method .
 * @ param bootstrapMethodHandle a bootstrap method handle .
 * @ param bootstrapMethodArguments the bootstrap method arguments .
 * @ return a new or already existing Symbol with the given value . */
Symbol addBootstrapMethod ( final Handle bootstrapMethodHandle , final Object ... bootstrapMethodArguments ) { } }

implementation:
ByteVector bootstrapMethodsAttribute = bootstrapMethods ; if ( bootstrapMethodsAttribute == null ) { bootstrapMethodsAttribute = bootstrapMethods = new ByteVector ( ) ; } // The bootstrap method arguments can be Constant _ Dynamic values , which reference other
// bootstrap methods . We must therefore add the bootstrap method arguments to the constant pool
// and BootstrapMethods attribute first , so that the BootstrapMethods attribute is not modified
// while adding the given bootstrap method to it , in the rest of this method .
for ( Object bootstrapMethodArgument : bootstrapMethodArguments ) { addConstant ( bootstrapMethodArgument ) ; } // Write the bootstrap method in the BootstrapMethods table . This is necessary to be able to
// compare it with existing ones , and will be reverted below if there is already a similar
// bootstrap method .
int bootstrapMethodOffset = bootstrapMethodsAttribute . length ; bootstrapMethodsAttribute . putShort ( addConstantMethodHandle ( bootstrapMethodHandle . getTag ( ) , bootstrapMethodHandle . getOwner ( ) , bootstrapMethodHandle . getName ( ) , bootstrapMethodHandle . getDesc ( ) , bootstrapMethodHandle . isInterface ( ) ) . index ) ; int numBootstrapArguments = bootstrapMethodArguments . length ; bootstrapMethodsAttribute . putShort ( numBootstrapArguments ) ; for ( Object bootstrapMethodArgument : bootstrapMethodArguments ) { bootstrapMethodsAttribute . putShort ( addConstant ( bootstrapMethodArgument ) . index ) ; } // Compute the length and the hash code of the bootstrap method .
int bootstrapMethodlength = bootstrapMethodsAttribute . length - bootstrapMethodOffset ; int hashCode = bootstrapMethodHandle . hashCode ( ) ; for ( Object bootstrapMethodArgument : bootstrapMethodArguments ) { hashCode ^= bootstrapMethodArgument . hashCode ( ) ; } hashCode &= 0x7FFFFFFF ; // Add the bootstrap method to the symbol table or revert the above changes .
return addBootstrapMethod ( bootstrapMethodOffset , bootstrapMethodlength , hashCode ) ;


signature:
public class SymbolTable { /** * Adds a bootstrap method to the BootstrapMethods attribute of this symbol table . Does nothing if
 * the BootstrapMethods already contains a similar bootstrap method ( more precisely , reverts the
 * content of { @ link # bootstrapMethods } to remove the last , duplicate bootstrap method ) .
 * @ param offset the offset of the last bootstrap method in { @ link # bootstrapMethods } , in bytes .
 * @ param length the length of this bootstrap method in { @ link # bootstrapMethods } , in bytes .
 * @ param hashCode the hash code of this bootstrap method .
 * @ return a new or already existing Symbol with the given value . */
private Symbol addBootstrapMethod ( final int offset , final int length , final int hashCode ) { } }

implementation:
final byte [ ] bootstrapMethodsData = bootstrapMethods . data ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == Symbol . BOOTSTRAP_METHOD_TAG && entry . hashCode == hashCode ) { int otherOffset = ( int ) entry . data ; boolean isSameBootstrapMethod = true ; for ( int i = 0 ; i < length ; ++ i ) { if ( bootstrapMethodsData [ offset + i ] != bootstrapMethodsData [ otherOffset + i ] ) { isSameBootstrapMethod = false ; break ; } } if ( isSameBootstrapMethod ) { bootstrapMethods . length = offset ; // Revert to old position .
return entry ; } } entry = entry . next ; } return put ( new Entry ( bootstrapMethodCount ++ , Symbol . BOOTSTRAP_METHOD_TAG , offset , hashCode ) ) ;


signature:
public class SymbolTable { /** * Adds a merged type in the type table of this symbol table . Does nothing if the type table
 * already contains a similar type .
 * @ param typeTableIndex1 a { @ link Symbol # TYPE _ TAG } type , specified by its index in the type
 * table .
 * @ param typeTableIndex2 another { @ link Symbol # TYPE _ TAG } type , specified by its index in the type
 * table .
 * @ return the index of a new or already existing { @ link Symbol # TYPE _ TAG } type Symbol ,
 * corresponding to the common super class of the given types . */
int addMergedType ( final int typeTableIndex1 , final int typeTableIndex2 ) { } }

implementation:
// TODO sort the arguments ? The merge result should be independent of their order .
long data = typeTableIndex1 | ( ( ( long ) typeTableIndex2 ) << 32 ) ; int hashCode = hash ( Symbol . MERGED_TYPE_TAG , typeTableIndex1 + typeTableIndex2 ) ; Entry entry = get ( hashCode ) ; while ( entry != null ) { if ( entry . tag == Symbol . MERGED_TYPE_TAG && entry . hashCode == hashCode && entry . data == data ) { return entry . info ; } entry = entry . next ; } String type1 = typeTable [ typeTableIndex1 ] . value ; String type2 = typeTable [ typeTableIndex2 ] . value ; int commonSuperTypeIndex = addType ( classWriter . getCommonSuperClass ( type1 , type2 ) ) ; put ( new Entry ( typeCount , Symbol . MERGED_TYPE_TAG , data , hashCode ) ) . info = commonSuperTypeIndex ; return commonSuperTypeIndex ;


signature:
public class SymbolTable { /** * Adds the given type Symbol to { @ link # typeTable } .
 * @ param entry a { @ link Symbol # TYPE _ TAG } or { @ link Symbol # UNINITIALIZED _ TYPE _ TAG } type symbol .
 * The index of this Symbol must be equal to the current value of { @ link # typeCount } .
 * @ return the index in { @ link # typeTable } where the given type was added , which is also equal to
 * entry ' s index by hypothesis . */
private int addTypeInternal ( final Entry entry ) { } }

implementation: if ( typeTable == null ) { typeTable = new Entry [ 16 ] ; } if ( typeCount == typeTable . length ) { Entry [ ] newTypeTable = new Entry [ 2 * typeTable . length ] ; System . arraycopy ( typeTable , 0 , newTypeTable , 0 , typeTable . length ) ; typeTable = newTypeTable ; } typeTable [ typeCount ++ ] = entry ; return put ( entry ) . index ;


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

implementation:
if ( value instanceof Collection ) { final Collection collection = ( Collection ) value ; final float [ ] target = new float [ collection . size ( ) ] ; int i = 0 ; for ( final Object element : collection ) { target [ i ] = convertType ( element ) ; i ++ ; } return target ; } if ( value instanceof Iterable ) { final Iterable iterable = ( Iterable ) value ; final ArrayList < Float > floatArrayList = new ArrayList < > ( ) ; for ( final Object element : iterable ) { final float convertedValue = convertType ( element ) ; floatArrayList . add ( Float . valueOf ( convertedValue ) ) ; } final float [ ] array = new float [ floatArrayList . size ( ) ] ; for ( int i = 0 ; i < floatArrayList . size ( ) ; i ++ ) { final Float f = floatArrayList . get ( i ) ; array [ i ] = f . floatValue ( ) ; } return array ; } if ( value instanceof CharSequence ) { final String [ ] strings = StringUtil . splitc ( value . toString ( ) , ArrayConverter . NUMBER_DELIMITERS ) ; return convertArrayToArray ( strings ) ; } // everything else :
return convertToSingleElementArray ( value ) ;


signature:
public class HttpMultiMap { /** * Calculates hash value of the input string . */
private int hash ( final String name ) { } }

implementation: int h = 0 ; for ( int i = name . length ( ) - 1 ; i >= 0 ; i -- ) { char c = name . charAt ( i ) ; if ( ! caseSensitive ) { if ( c >= 'A' && c <= 'Z' ) { c += 32 ; } } h = 31 * h + c ; } if ( h > 0 ) { return h ; } if ( h == Integer . MIN_VALUE ) { return Integer . MAX_VALUE ; } return - h ;


signature:
public class HttpMultiMap { /** * Returns < code > true < / code > if two names are the same . */
private boolean eq ( final String name1 , final String name2 ) { } }

implementation: int nameLen = name1 . length ( ) ; if ( nameLen != name2 . length ( ) ) { return false ; } for ( int i = nameLen - 1 ; i >= 0 ; i -- ) { char c1 = name1 . charAt ( i ) ; char c2 = name2 . charAt ( i ) ; if ( c1 != c2 ) { if ( caseSensitive ) { return false ; } if ( c1 >= 'A' && c1 <= 'Z' ) { c1 += 32 ; } if ( c2 >= 'A' && c2 <= 'Z' ) { c2 += 32 ; } if ( c1 != c2 ) { return false ; } } } return true ;


signature:
public class HttpMultiMap { /** * Clears the map . */
public HttpMultiMap < V > clear ( ) { } }

implementation: for ( int i = 0 ; i < entries . length ; i ++ ) { entries [ i ] = null ; } head . before = head . after = head ; return this ;


signature:
public class HttpMultiMap { /** * - - - - - set / add */
private HttpMultiMap < V > _set ( final Iterable < Map . Entry < String , V > > map ) { } }

implementation: clear ( ) ; for ( Map . Entry < String , V > entry : map ) { add ( entry . getKey ( ) , entry . getValue ( ) ) ; } return this ;


signature:
public class HttpMultiMap { /** * - - - - - remove */
public HttpMultiMap < V > remove ( final String name ) { } }

implementation: int h = hash ( name ) ; int i = index ( h ) ; _remove ( h , i , name ) ; return this ;


signature:
public class HttpMultiMap { /** * Returns the first value from the map associated with the name .
 * Returns < code > null < / code > if name does not exist or
 * if associated value is < code > null < / code > . */
public V get ( final String name ) { } }

implementation: Map . Entry < String , V > entry = getEntry ( name ) ; if ( entry == null ) { return null ; } return entry . getValue ( ) ;


signature:
public class HttpMultiMap { /** * Returns first entry for given name . Returns < code > null < / code > if entry
 * does not exist . */
public Map . Entry < String , V > getEntry ( final String name ) { } }

implementation: int h = hash ( name ) ; int i = index ( h ) ; MapEntry < V > e = entries [ i ] ; while ( e != null ) { if ( e . hash == h && eq ( name , e . key ) ) { return e ; } e = e . next ; } return null ;


signature:
public class HttpMultiMap { /** * Returns all values associated with the name . */
public List < V > getAll ( final String name ) { } }

implementation: LinkedList < V > values = new LinkedList < > ( ) ; int h = hash ( name ) ; int i = index ( h ) ; MapEntry < V > e = entries [ i ] ; while ( e != null ) { if ( e . hash == h && eq ( name , e . key ) ) { values . addFirst ( e . getValue ( ) ) ; } e = e . next ; } return values ;


signature:
public class HttpMultiMap { /** * Returns iterator of all entries . */
@ Override public Iterator < Map . Entry < String , V > > iterator ( ) { } }

implementation: final MapEntry [ ] e = { head . after } ; return new Iterator < Map . Entry < String , V > > ( ) { @ Override public boolean hasNext ( ) { return e [ 0 ] != head ; } @ Override @ SuppressWarnings ( "unchecked" ) public Map . Entry < String , V > next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( "No next() entry in the iteration" ) ; } MapEntry < V > next = e [ 0 ] ; e [ 0 ] = e [ 0 ] . after ; return next ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ;


signature:
public class HttpMultiMap { /** * Returns all the entries of this map . Case sensitivity does not influence
 * the returned list , it always contains all of the values . */
public List < Map . Entry < String , V > > entries ( ) { } }

implementation: List < Map . Entry < String , V > > all = new LinkedList < > ( ) ; MapEntry < V > e = head . after ; while ( e != head ) { all . add ( e ) ; e = e . after ; } return all ;


signature:
public class FastCharBuffer { /** * Grows the buffer . */
private void grow ( final int minCapacity ) { } }

implementation:
final int oldCapacity = buffer . length ; int newCapacity = oldCapacity << 1 ; if ( newCapacity - minCapacity < 0 ) { // special case , min capacity is larger then a grow
newCapacity = minCapacity + 512 ; } buffer = Arrays . copyOf ( buffer , newCapacity ) ;


signature:
public class FastCharBuffer { /** * Appends single { @ code char } to buffer . */
@ Override public FastCharBuffer append ( final char element ) { } }

implementation: if ( offset - buffer . length >= 0 ) { grow ( offset ) ; } buffer [ offset ++ ] = element ; return this ;


signature:
public class FastCharBuffer { /** * Appends another fast buffer to this one . */
public FastCharBuffer append ( final FastCharBuffer buff ) { } }

implementation: if ( buff . offset == 0 ) { return this ; } append ( buff . buffer , 0 , buff . offset ) ; return this ;


signature:
public class FastCharBuffer { /** * Appends character sequence to buffer . */
@ Override public FastCharBuffer append ( final CharSequence csq , final int start , final int end ) { } }

implementation: for ( int i = start ; i < end ; i ++ ) { append ( csq . charAt ( i ) ) ; } return this ;


signature:
public class ProxettaMethodBuilder { /** * Copies target method annotations . */
@ Override public AnnotationVisitor visitAnnotation ( final String desc , final boolean visible ) { } }

implementation:
AnnotationVisitor destAnn = methodVisitor . visitAnnotation ( desc , visible ) ; // [ A4]
return new AnnotationVisitorAdapter ( destAnn ) ;


signature:
public class ProxettaMethodBuilder { /** * Finally , builds proxy methods if applied to current method . */
@ Override public void visitEnd ( ) { } }

implementation: createFirstChainDelegate_Continue ( tmd ) ; for ( int p = 0 ; p < tmd . proxyData . length ; p ++ ) { tmd . selectCurrentProxy ( p ) ; createProxyMethod ( tmd ) ; }


signature:
public class ProxettaMethodBuilder { /** * Starts creation of first chain delegate . */
protected void createFirstChainDelegate_Start ( ) { } }

implementation:
// check invalid access flags
int access = msign . getAccessFlags ( ) ; if ( ! wd . allowFinalMethods ) { if ( ( access & AsmUtil . ACC_FINAL ) != 0 ) { // detect final
throw new ProxettaException ( "Unable to create proxy for final method: " + msign + ". Remove final modifier or change the pointcut definition." ) ; } } // create proxy methods
tmd = new TargetMethodData ( msign , aspectList ) ; access &= ~ ACC_NATIVE ; access &= ~ ACC_ABSTRACT ; methodVisitor = wd . dest . visitMethod ( access , tmd . msign . getMethodName ( ) , tmd . msign . getDescription ( ) , tmd . msign . getAsmMethodSignature ( ) , null ) ;


signature:
public class ProxettaMethodBuilder { /** * Continues the creation of the very first method in calling chain that simply delegates invocation to the first proxy method .
 * This method mirrors the target method . */
protected void createFirstChainDelegate_Continue ( final TargetMethodData tmd ) { } }

implementation: methodVisitor . visitCode ( ) ; if ( tmd . msign . isStatic ) { loadStaticMethodArguments ( methodVisitor , tmd . msign ) ; methodVisitor . visitMethodInsn ( INVOKESTATIC , wd . thisReference , tmd . firstMethodName ( ) , tmd . msign . getDescription ( ) , false ) ; } else { loadSpecialMethodArguments ( methodVisitor , tmd . msign ) ; methodVisitor . visitMethodInsn ( INVOKESPECIAL , wd . thisReference , tmd . firstMethodName ( ) , tmd . msign . getDescription ( ) , false ) ; } visitReturn ( methodVisitor , tmd . msign , false ) ; methodVisitor . visitMaxs ( 0 , 0 ) ; methodVisitor . visitEnd ( ) ;


signature:
public class Path { /** * Parses input dot - separated string that represents a path . */
public static Path parse ( final String path ) { } }

implementation: return path == null ? new Path ( ) : new Path ( StringUtil . splitc ( path , '.' ) ) ;


signature:
public class Path { /** * Push element to the path . */
public Path push ( final CharSequence field ) { } }

implementation: _push ( field ) ; if ( altPath != null ) { altPath . push ( field ) ; } return this ;


signature:
public class JoyContextListener { /** * Alternative way for registering Joy listeners .
 * Sometimes servlet container does not allow adding new listener
 * from already added listener . This method therefore registers
 * the listener < i > before < / i > container actually called the
 * callback methods . */
public static void registerInServletContext ( final ServletContext servletContext , final Class < ? extends JoyContextListener > joyContextListenerClass ) { } }

implementation: try { final JoyContextListener joyContextListener = ClassUtil . newInstance ( joyContextListenerClass ) ; joyContextListener . createJoyAndInitServletContext ( servletContext ) ; } catch ( Exception e ) { throw new JoyException ( e ) ; } servletContext . addListener ( joyContextListenerClass ) ;


signature:
public class JoyContextListener { /** * Creates { @ link JoddJoy } . This is a place where to configure the app . */
protected JoddJoy createJoy ( ) { } }

implementation: final JoddJoy joy = JoddJoy . get ( ) ; if ( SystemUtil . info ( ) . isAtLeastJavaVersion ( 9 ) ) { joy . withScanner ( joyScanner -> joyScanner . scanClasspathOf ( this . getClass ( ) ) ) ; } return joy ;


signature:
public class JoyContextListener { /** * Configures servlet context . */
private void configureServletContext ( final ServletContext servletContext ) { } }

implementation: servletContext . addListener ( jodd . servlet . RequestContextListener . class ) ; if ( decoraEnabled ) { final FilterRegistration filter = servletContext . addFilter ( "decora" , jodd . decora . DecoraServletFilter . class ) ; filter . addMappingForUrlPatterns ( null , true , contextPath ) ; } final FilterRegistration filter = servletContext . addFilter ( "madvoc" , jodd . madvoc . MadvocServletFilter . class ) ; filter . addMappingForUrlPatterns ( madvocDispatcherTypes , true , contextPath ) ;


signature:
public class DbCallResult { /** * - - - - - integer */
public int getInteger ( final int index ) { } }

implementation: try { return statement . getInt ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - boolean */
public boolean getBoolean ( final int index ) { } }

implementation: try { return statement . getBoolean ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - byte */
public byte getByte ( final int index ) { } }

implementation: try { return statement . getByte ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - doublw */
public double getDouble ( final int index ) { } }

implementation: try { return statement . getDouble ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - float */
public float getFloat ( final int index ) { } }

implementation: try { return statement . getFloat ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - string */
public String getString ( final int index ) { } }

implementation: try { return statement . getString ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class DbCallResult { /** * - - - - - long */
public long getLong ( final int index ) { } }

implementation: try { return statement . getLong ( index ) ; } catch ( SQLException sex ) { throw newGetParamError ( index , sex ) ; }


signature:
public class PathrefAdvice { /** * Reads method name and appends it . Creates object for next call and
 * returns that value . If next object is unsupported , it will return null ; */
public Object execute ( ) { } }

implementation: String methodName = targetMethodName ( ) ; Class returnType = returnType ( ) ; Object next = pathref . continueWith ( this , methodName , returnType ) ; return ProxyTarget . returnValue ( next ) ;


signature:
public class Fields { /** * Inspects fields and returns map of { @ link FieldDescriptor field descriptors } . */
private Map < String , FieldDescriptor > inspectFields ( ) { } }

implementation: if ( classDescriptor . isSystemClass ( ) ) { return emptyFields ( ) ; } final boolean scanAccessible = classDescriptor . isScanAccessible ( ) ; final Class type = classDescriptor . getType ( ) ; final Field [ ] fields = scanAccessible ? ClassUtil . getAccessibleFields ( type ) : ClassUtil . getSupportedFields ( type ) ; final HashMap < String , FieldDescriptor > map = new HashMap < > ( fields . length ) ; for ( final Field field : fields ) { final String fieldName = field . getName ( ) ; if ( fieldName . equals ( "serialVersionUID" ) ) { continue ; } map . put ( fieldName , createFieldDescriptor ( field ) ) ; } return map ;


signature:
public class Fields { /** * Returns all fields of this collection . Returns empty array
 * if no fields exist . Initialized lazy . */
public FieldDescriptor [ ] getAllFieldDescriptors ( ) { } }

implementation: if ( allFields == null ) { FieldDescriptor [ ] allFields = new FieldDescriptor [ fieldsMap . size ( ) ] ; int index = 0 ; for ( FieldDescriptor fieldDescriptor : fieldsMap . values ( ) ) { allFields [ index ] = fieldDescriptor ; index ++ ; } Arrays . sort ( allFields , Comparator . comparing ( fd -> fd . getField ( ) . getName ( ) ) ) ; this . allFields = allFields ; } return allFields ;


signature:
public class BlobSqlType { /** * { @ inheritDoc } */
@ Override public Blob get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: return rs . getBlob ( index ) ;


signature:
public class BlobSqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final Blob value , final int dbSqlType ) throws SQLException { } }

implementation: st . setBlob ( index , value ) ;


signature:
public class ProxettaAwarePetiteContainer { /** * Applies proxetta on bean class before bean registration . */
@ SuppressWarnings ( "unchecked" ) @ Override protected < T > BeanDefinition < T > createBeanDefinitionForRegistration ( final String name , Class < T > type , final Scope scope , final WiringMode wiringMode , final Consumer < T > consumer ) { } }

implementation: if ( proxetta != null ) { final Class originalType = type ; final ProxettaFactory builder = proxetta . proxy ( ) ; builder . setTarget ( type ) ; type = builder . define ( ) ; return new ProxettaBeanDefinition ( name , type , scope , wiringMode , originalType , proxetta . getAspects ( new ProxyAspect [ 0 ] ) , consumer ) ; } return super . createBeanDefinitionForRegistration ( name , type , scope , wiringMode , consumer ) ;


signature:
public class JtxDbUtil { /** * Converter JTX transaction mode to DB transaction mode . */
public static DbTransactionMode convertToDbMode ( final JtxTransactionMode txMode ) { } }

implementation: final int isolation ; switch ( txMode . getIsolationLevel ( ) ) { case ISOLATION_DEFAULT : isolation = DbTransactionMode . ISOLATION_DEFAULT ; break ; case ISOLATION_NONE : isolation = DbTransactionMode . ISOLATION_NONE ; break ; case ISOLATION_READ_COMMITTED : isolation = DbTransactionMode . ISOLATION_READ_COMMITTED ; break ; case ISOLATION_READ_UNCOMMITTED : isolation = DbTransactionMode . ISOLATION_READ_UNCOMMITTED ; break ; case ISOLATION_REPEATABLE_READ : isolation = DbTransactionMode . ISOLATION_REPEATABLE_READ ; break ; case ISOLATION_SERIALIZABLE : isolation = DbTransactionMode . ISOLATION_SERIALIZABLE ; break ; default : throw new IllegalArgumentException ( ) ; } return new DbTransactionMode ( isolation , txMode . isReadOnly ( ) ) ;


signature:
public class CharacterSqlType { /** * { @ inheritDoc } */
@ Override public Character get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: if ( TypesUtil . isIntegerType ( dbSqlType ) ) { return Character . valueOf ( ( char ) rs . getInt ( index ) ) ; } String s = rs . getString ( index ) ; if ( s == null ) { return null ; } if ( s . length ( ) > 1 ) { throw new DbSqlException ( "Char column size too long, should be 1" ) ; } return Character . valueOf ( s . charAt ( 0 ) ) ;


signature:
public class CharacterSqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final Character value , final int dbSqlType ) throws SQLException { } }

implementation: if ( TypesUtil . isIntegerType ( dbSqlType ) ) { st . setInt ( index , value . charValue ( ) ) ; return ; } st . setString ( index , value . toString ( ) ) ;


signature:
public class BeanSerializer { /** * Reads property value and { @ link # onSerializableProperty ( String , Class , Object ) serializes it } . */
@ Override protected final void onSerializableProperty ( String propertyName , final PropertyDescriptor propertyDescriptor ) { } }

implementation:
final Object value ; if ( propertyDescriptor == null ) { // metadata - classname
value = source . getClass ( ) . getName ( ) ; } else { value = readProperty ( source , propertyDescriptor ) ; if ( ( value == null ) && jsonContext . isExcludeNulls ( ) ) { return ; } // change name for properties
propertyName = typeData . resolveJsonName ( propertyName ) ; } onSerializableProperty ( propertyName , propertyDescriptor == null ? null : propertyDescriptor . getType ( ) , value ) ;


signature:
public class BeanSerializer { /** * Invoked on serializable properties , that have passed all the rules .
 * Property type is < code > null < / code > for metadata class name property . */
protected void onSerializableProperty ( final String propertyName , final Class propertyType , final Object value ) { } }

implementation: jsonContext . pushName ( propertyName , count > 0 ) ; jsonContext . serialize ( value ) ; if ( jsonContext . isNamePopped ( ) ) { count ++ ; }


signature:
public class BeanSerializer { /** * Reads property using property descriptor . */
private Object readProperty ( final Object source , final PropertyDescriptor propertyDescriptor ) { } }

implementation: Getter getter = propertyDescriptor . getGetter ( declared ) ; if ( getter != null ) { try { return getter . invokeGetter ( source ) ; } catch ( Exception ex ) { throw new JsonException ( ex ) ; } } return null ;


signature:
public class Util { /** * Returns < code > true < / code > if first argument contains provided element .
 * It works for strings , collections , maps and arrays . */
public static boolean containsElement ( final Object obj , final Object element ) { } }

implementation: if ( obj == null ) { return false ; } if ( obj instanceof String ) { if ( element == null ) { return false ; } return ( ( String ) obj ) . contains ( element . toString ( ) ) ; } if ( obj instanceof Collection ) { return ( ( Collection ) obj ) . contains ( element ) ; } if ( obj instanceof Map ) { return ( ( Map ) obj ) . values ( ) . contains ( element ) ; } if ( obj instanceof Iterator ) { Iterator iter = ( Iterator ) obj ; while ( iter . hasNext ( ) ) { Object o = iter . next ( ) ; if ( equals ( o , element ) ) { return true ; } } return false ; } if ( obj instanceof Enumeration ) { Enumeration enumeration = ( Enumeration ) obj ; while ( enumeration . hasMoreElements ( ) ) { Object o = enumeration . nextElement ( ) ; if ( equals ( o , element ) ) { return true ; } } return false ; } if ( obj . getClass ( ) . isArray ( ) ) { int len = Array . getLength ( obj ) ; for ( int i = 0 ; i < len ; i ++ ) { Object o = Array . get ( obj , i ) ; if ( equals ( o , element ) ) { return true ; } } } return false ;


signature:
public class EMLComposer { /** * Creates EML string from given { @ link Email } .
 * @ param email { @ link Email } from which to create EML { @ link String } .
 * @ return { @ link String } with EML content . */
public String compose ( final Email email ) { } }

implementation: if ( getSession ( ) == null ) { createSession ( getProperties ( ) ) ; } final OutputStreamTransport ost = new OutputStreamTransport ( getSession ( ) ) ; final SendMailSession sendMailSession = new SendMailSession ( getSession ( ) , ost ) ; sendMailSession . sendMail ( email ) ; return ost . getEml ( ) ;


signature:
public class EMLComposer { /** * Creates EML string from given { @ link ReceivedEmail } .
 * @ param receivedEmail { @ link ReceivedEmail } from which to create EML { @ link String } .
 * @ return { @ link String } with EML content . */
public String compose ( final ReceivedEmail receivedEmail ) { } }

implementation: Message msg = receivedEmail . originalMessage ( ) ; final ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; try { msg . writeTo ( outputStream ) ; } catch ( IOException | MessagingException e ) { throw new MailException ( e ) ; } return outputStream . toString ( ) ;


signature:
public class FastDoubleBuffer { /** * Appends another fast buffer to this one . */
public FastDoubleBuffer append ( final FastDoubleBuffer buff ) { } }

implementation: if ( buff . offset == 0 ) { return this ; } append ( buff . buffer , 0 , buff . offset ) ; return this ;


signature:
public class IntHashMap { /** * Rehashes the contents of this map into a new < code > IntHashMap < / code >
 * instance with a larger capacity . This method is called automatically when
 * the number of keys in this map exceeds its capacity and load factor . */
private void rehash ( ) { } }

implementation: int oldCapacity = table . length ; Entry [ ] oldMap = table ; int newCapacity = ( oldCapacity << 1 ) + 1 ; Entry [ ] newMap = new Entry [ newCapacity ] ; modCount ++ ; threshold = ( int ) ( newCapacity * loadFactor ) ; table = newMap ; for ( int i = oldCapacity ; i -- > 0 ; ) { for ( Entry old = oldMap [ i ] ; old != null ; ) { Entry e = old ; old = old . next ; int index = ( e . key & 0x7FFFFFFF ) % newCapacity ; e . next = newMap [ index ] ; newMap [ index ] = e ; } }


signature:
public class IntHashMap { /** * Associates the specified value with the specified key in this map . If the
 * map previously contained a mapping for this key , the old value is
 * replaced .
 * @ param key key with which the specified value is to be associated .
 * @ param value value to be associated with the specified key .
 * @ return previous value associated with specified key , or < code > null < / code > if
 * there was no mapping for key . A < code > null < / code > return can also indicate
 * that the IntHashMap previously associated < code > null < / code > with the
 * specified key . */
public Object put ( final int key , final Object value ) { } }

implementation:
// makes sure the key is not already in the IntHashMap .
Entry [ ] tab = table ; int index = ( key & 0x7FFFFFFF ) % tab . length ; for ( Entry e = tab [ index ] ; e != null ; e = e . next ) { if ( e . key == key ) { Object old = e . value ; e . value = value ; return old ; } } modCount ++ ; if ( count >= threshold ) { // rehash the table if the threshold is exceeded
rehash ( ) ; tab = table ; index = ( key & 0x7FFFFFFF ) % tab . length ; } // creates the new entry .
tab [ index ] = new Entry ( key , value , tab [ index ] ) ; count ++ ; return null ;


signature:
public class IntHashMap { /** * Copies all of the mappings from the specified map to this one .
 * These mappings replace any mappings that this map had for any of the
 * keys currently in the specified Map .
 * @ param t Mappings to be stored in this map . */
@ Override public void putAll ( final Map t ) { } }

implementation: for ( Object o : t . entrySet ( ) ) { Map . Entry e = ( Map . Entry ) o ; put ( e . getKey ( ) , e . getValue ( ) ) ; }


signature:
public class IntHashMap { /** * Removes all mappings from this map . */
@ Override public void clear ( ) { } }

implementation: Entry [ ] tab = table ; modCount ++ ; for ( int index = tab . length ; -- index >= 0 ; ) { tab [ index ] = null ; } count = 0 ;


signature:
public class FastLongBuffer { /** * Appends another fast buffer to this one . */
public FastLongBuffer append ( final FastLongBuffer buff ) { } }


signature:
public class FastLongBuffer { /** * Creates { @ code long } subarray from buffered content . */
public long [ ] toArray ( final int start , final int len ) { } }

implementation: final long [ ] array = new long [ len ] ; if ( len == 0 ) { return array ; } System . arraycopy ( buffer , start , array , 0 , len ) ; return array ;


signature:
public class Buffer { /** * Appends string content to buffer . */
public Buffer append ( final String string ) { } }

implementation: ensureLast ( ) ; try { byte [ ] bytes = string . getBytes ( StringPool . ISO_8859_1 ) ; last . append ( bytes ) ; size += bytes . length ; } catch ( UnsupportedEncodingException ignore ) { } return this ;


signature:
public class Buffer { /** * Appends { @ link jodd . http . up . Uploadable } to buffer . */
public Buffer append ( final Uploadable uploadable ) { } }

implementation: list . add ( uploadable ) ; size += uploadable . getSize ( ) ; last = null ; return this ;


signature:
public class Buffer { /** * Appends other buffer to this one . */
public Buffer append ( final Buffer buffer ) { } }

implementation:
if ( buffer . list . isEmpty ( ) ) { // nothing to append
return buffer ; } list . addAll ( buffer . list ) ; last = buffer . last ; size += buffer . size ; return this ;


signature:
public class Buffer { /** * Writes content to the writer . */
public void writeTo ( final Writer writer ) throws IOException { } }

implementation: for ( Object o : list ) { if ( o instanceof FastByteBuffer ) { FastByteBuffer fastByteBuffer = ( FastByteBuffer ) o ; byte [ ] array = fastByteBuffer . toArray ( ) ; writer . write ( new String ( array , StringPool . ISO_8859_1 ) ) ; } else if ( o instanceof Uploadable ) { Uploadable uploadable = ( Uploadable ) o ; InputStream inputStream = uploadable . openInputStream ( ) ; try { StreamUtil . copy ( inputStream , writer , StringPool . ISO_8859_1 ) ; } finally { StreamUtil . close ( inputStream ) ; } } }


signature:
public class Buffer { /** * Writes content to the output stream . */
public void writeTo ( final OutputStream out ) throws IOException { } }

implementation: for ( Object o : list ) { if ( o instanceof FastByteBuffer ) { FastByteBuffer fastByteBuffer = ( FastByteBuffer ) o ; out . write ( fastByteBuffer . toArray ( ) ) ; } else if ( o instanceof Uploadable ) { Uploadable uploadable = ( Uploadable ) o ; InputStream inputStream = uploadable . openInputStream ( ) ; try { StreamUtil . copy ( inputStream , out ) ; } finally { StreamUtil . close ( inputStream ) ; } } }


signature:
public class Buffer { /** * Writes content to the output stream , using progress listener to track the sending progress . */
public void writeTo ( final OutputStream out , final HttpProgressListener progressListener ) throws IOException { } }

implementation:
// start
final int size = size ( ) ; final int callbackSize = progressListener . callbackSize ( size ) ; int count = 0 ; // total count
int step = 0 ; // step is offset in current chunk
progressListener . transferred ( count ) ; // loop
for ( Object o : list ) { if ( o instanceof FastByteBuffer ) { FastByteBuffer fastByteBuffer = ( FastByteBuffer ) o ; byte [ ] bytes = fastByteBuffer . toArray ( ) ; int offset = 0 ; while ( offset < bytes . length ) { // calc the remaining sending chunk size
int chunk = callbackSize - step ; // check if this chunk size fits the bytes array
if ( offset + chunk > bytes . length ) { chunk = bytes . length - offset ; } // writes the chunk
out . write ( bytes , offset , chunk ) ; offset += chunk ; step += chunk ; count += chunk ; // listener
if ( step >= callbackSize ) { progressListener . transferred ( count ) ; step -= callbackSize ; } } } else if ( o instanceof Uploadable ) { Uploadable uploadable = ( Uploadable ) o ; InputStream inputStream = uploadable . openInputStream ( ) ; int remaining = uploadable . getSize ( ) ; try { while ( remaining > 0 ) { // calc the remaining sending chunk size
int chunk = callbackSize - step ; // check if this chunk size fits the remaining size
if ( chunk > remaining ) { chunk = remaining ; } // writes remaining chunk
StreamUtil . copy ( inputStream , out , chunk ) ; remaining -= chunk ; step += chunk ; count += chunk ; // listener
if ( step >= callbackSize ) { progressListener . transferred ( count ) ; step -= callbackSize ; } } } finally { StreamUtil . close ( inputStream ) ; } } } // end
if ( step != 0 ) { progressListener . transferred ( count ) ; }


signature:
public class HtmlEncoder { /** * - - - - - private */
private static String encode ( final CharSequence text , final char [ ] [ ] buff , final int bufflen ) { } }

implementation: int len ; if ( ( text == null ) || ( ( len = text . length ( ) ) == 0 ) ) { return StringPool . EMPTY ; } StringBuilder buffer = new StringBuilder ( len + ( len >> 2 ) ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = text . charAt ( i ) ; if ( c < bufflen ) { buffer . append ( buff [ c ] ) ; } else { buffer . append ( c ) ; } } return buffer . toString ( ) ;


signature:
public class JsonObject { /** * Returns the string value with the specified key . */
public String getString ( final String key ) { } }

implementation: CharSequence cs = ( CharSequence ) map . get ( key ) ; return cs == null ? null : cs . toString ( ) ;


signature:
public class JsonObject { /** * returns the integer value with the specified key . */
public Integer getInteger ( final String key ) { } }

implementation: Number number = ( Number ) map . get ( key ) ; if ( number == null ) { return null ; } if ( number instanceof Integer ) { return ( Integer ) number ; } return number . intValue ( ) ;


signature:
public class JsonObject { /** * Returns the long value with the specified key . */
public Long getLong ( final String key ) { } }

implementation: Number number = ( Number ) map . get ( key ) ; if ( number == null ) { return null ; } if ( number instanceof Long ) { return ( Long ) number ; } return number . longValue ( ) ;


signature:
public class JsonObject { /** * Returns the double value with the specified key . */
public Double getDouble ( final String key ) { } }

implementation: Number number = ( Number ) map . get ( key ) ; if ( number == null ) { return null ; } if ( number instanceof Double ) { return ( Double ) number ; } return number . doubleValue ( ) ;


signature:
public class JsonObject { /** * Returns the float value with the specified key . */
public Float getFloat ( final String key ) { } }

implementation: Number number = ( Number ) map . get ( key ) ; if ( number == null ) { return null ; } if ( number instanceof Float ) { return ( Float ) number ; } return number . floatValue ( ) ;


signature:
public class JsonObject { /** * Returns the { @ code JsonObject } value with the specified key . */
public JsonObject getJsonObject ( final String key ) { } }

implementation: Object val = map . get ( key ) ; if ( val instanceof Map ) { val = new JsonObject ( ( Map ) val ) ; } return ( JsonObject ) val ;


signature:
public class JsonObject { /** * Returns the { @ link JsonArray } value with the specified key */
public JsonArray getJsonArray ( final String key ) { } }

implementation: Object val = map . get ( key ) ; if ( val instanceof List ) { val = new JsonArray ( ( List ) val ) ; } return ( JsonArray ) val ;


signature:
public class JsonObject { /** * Returns the binary value with the specified key .
 * JSON itself has no notion of a binary . This extension complies to the RFC - 7493.
 * THe byte array is Base64 encoded binary . */
public byte [ ] getBinary ( final String key ) { } }

implementation: String encoded = ( String ) map . get ( key ) ; return encoded == null ? null : Base64 . getDecoder ( ) . decode ( encoded ) ;


signature:
public class JsonObject { /** * Returns the value with the specified key , as an object . */
@ SuppressWarnings ( "unchecked" ) public < T > T getValue ( final String key ) { } }

implementation: T val = ( T ) map . get ( key ) ; if ( val instanceof Map ) { return ( T ) new JsonObject ( ( Map ) val ) ; } if ( val instanceof List ) { return ( T ) new JsonArray ( ( List ) val ) ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getString ( String ) } but specifies a default value to return if there is no entry . */
public String getString ( final String key , final String def ) { } }

implementation: String val = getString ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getInteger ( String ) } but specifies a default value to return if there is no entry . */
public Integer getInteger ( final String key , final Integer def ) { } }

implementation: Integer val = getInteger ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getLong ( String ) } but specifies a default value to return if there is no entry . */
public Long getLong ( final String key , final Long def ) { } }

implementation: Long val = getLong ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getDouble ( String ) } but specifies a default value to return if there is no entry . */
public Double getDouble ( final String key , final Double def ) { } }

implementation: Double val = getDouble ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getFloat ( String ) } but specifies a default value to return if there is no entry . */
public Float getFloat ( final String key , final Float def ) { } }

implementation: Float val = getFloat ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getBoolean ( String ) } but specifies a default value to return if there is no entry . */
public Boolean getBoolean ( final String key , final Boolean def ) { } }

implementation: Boolean val = getBoolean ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getJsonObject ( String ) } but specifies a default value to return if there is no entry . */
public JsonObject getJsonObject ( final String key , final JsonObject def ) { } }

implementation: JsonObject val = getJsonObject ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getJsonArray ( String ) } but specifies a default value to return if there is no entry . */
public JsonArray getJsonArray ( final String key , final JsonArray def ) { } }

implementation: JsonArray val = getJsonArray ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getBinary ( String ) } but specifies a default value to return if there is no entry . */
public byte [ ] getBinary ( final String key , final byte [ ] def ) { } }

implementation: byte [ ] val = getBinary ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Like { @ link # getValue ( String ) } but specifies a default value to return if there is no entry . */
public < T > T getValue ( final String key , final T def ) { } }

implementation: T val = getValue ( key ) ; if ( val == null ) { if ( map . containsKey ( key ) ) { return null ; } return def ; } return val ;


signature:
public class JsonObject { /** * Puts an Enum into the JSON object with the specified key .
 * JSON has no concept of encoding Enums , so the Enum will be converted to a String using the { @ code java . lang . Enum # name }
 * method and the value put as a String . */
public JsonObject put ( final String key , final Enum value ) { } }

implementation: Objects . requireNonNull ( key ) ; map . put ( key , value == null ? null : value . name ( ) ) ; return this ;


signature:
public class JsonObject { /** * Puts an { @ code CharSequence } into the JSON object with the specified key . */
public JsonObject put ( final String key , final CharSequence value ) { } }

implementation: Objects . requireNonNull ( key ) ; map . put ( key , value == null ? null : value . toString ( ) ) ; return this ;


signature:
public class JsonObject { /** * Puts a string into the JSON object with the specified key . */
public JsonObject put ( final String key , final String value ) { } }

implementation: Objects . requireNonNull ( key ) ; map . put ( key , value ) ; return this ;


signature:
public class JsonObject { /** * Puts a { @ code null } value into the JSON object with the specified key . */
public JsonObject putNull ( final String key ) { } }

implementation: Objects . requireNonNull ( key ) ; map . put ( key , null ) ; return this ;


signature:
public class JsonObject { /** * Puts a { @ code byte [ ] } into the JSON object with the specified key .
 * Follows JSON extension RFC7493 , where binary will first be Base64
 * encoded before being put as a String . */
public JsonObject put ( final String key , final byte [ ] value ) { } }

implementation: Objects . requireNonNull ( key ) ; map . put ( key , value == null ? null : Base64 . getEncoder ( ) . encodeToString ( value ) ) ; return this ;


signature:
public class ReceiveMailSession { /** * Returns array of all { @ link Folder } s as { @ code String } s . You can use these names in
 * { @ link # useFolder ( String ) } method .
 * @ return array of all { @ link Folder } s as { @ code String } s . */
public String [ ] getAllFolders ( ) { } }

implementation: final Folder [ ] folders ; try { folders = getService ( ) . getDefaultFolder ( ) . list ( "*" ) ; } catch ( final MessagingException msgexc ) { throw new MailException ( "Failed to connect to folder" , msgexc ) ; } final String [ ] folderNames = new String [ folders . length ] ; for ( int i = 0 ; i < folders . length ; i ++ ) { final Folder folder = folders [ i ] ; folderNames [ i ] = folder . getFullName ( ) ; } return folderNames ;


signature:
public class ReceiveMailSession { /** * Opens new folder and closes previously opened folder .
 * @ param folderName Folder to open */
public void useFolder ( final String folderName ) { } }

implementation: closeFolderIfOpened ( folder ) ; try { this . folderName = folderName ; this . folder = getService ( ) . getFolder ( folderName ) ; try { folder . open ( Folder . READ_WRITE ) ; } catch ( final MailException ignore ) { folder . open ( Folder . READ_ONLY ) ; } } catch ( final MessagingException msgexc ) { throw new MailException ( "Failed to connect to folder: " + folderName , msgexc ) ; }


signature:
public class ReceiveMailSession { /** * Just returns a folder , w / o opening . */
public Folder getFolder ( final String folder ) { } }

implementation: try { return getService ( ) . getFolder ( folder ) ; } catch ( MessagingException e ) { throw new MailException ( "Folder not found: " + folder , e ) ; }


signature:
public class ReceiveMailSession { /** * Receives all emails that matches given { @ link EmailFilter } .
 * Messages are not modified . However , servers may set SEEN flag anyway ,
 * so we force messages to remain unseen .
 * @ param filter { @ link EmailFilter }
 * @ return array of { @ link ReceivedEmail } s . */
public ReceivedEmail [ ] receiveEmail ( final EmailFilter filter ) { } }

implementation: return receiveMessages ( filter , null , null , false , null ) ;


signature:
public class ReceiveMailSession { /** * Receives all emails that matches given { @ link EmailFilter }
 * and mark them as ' seen ' ( ie ' read ' ) .
 * @ param filter { @ link EmailFilter }
 * @ return array of { @ link ReceivedEmail } s . */
public ReceivedEmail [ ] receiveEmailAndMarkSeen ( final EmailFilter filter ) { } }

implementation: final Flags flagsToSet = new Flags ( ) ; flagsToSet . add ( Flags . Flag . SEEN ) ; return receiveMessages ( filter , flagsToSet , null , false , null ) ;


signature:
public class ReceiveMailSession { /** * Receives all emails that matches given { @ link EmailFilter } and
 * mark all messages as ' seen ' and ' deleted ' .
 * @ param filter { @ link EmailFilter }
 * @ return array of { @ link ReceivedEmail } s . */
public ReceivedEmail [ ] receiveEmailAndDelete ( final EmailFilter filter ) { } }

implementation: final Flags flags = new Flags ( ) ; flags . add ( Flags . Flag . SEEN ) ; flags . add ( Flags . Flag . DELETED ) ; return receiveMessages ( filter , flags , null , false , null ) ;