signature:
public class Base64 { /** * Encodes a raw byte array into a BASE64 < code > char [ ] < / code > .
 * @ param lineSeparator optional CRLF after 76 chars , unless EOF . */
public static char [ ] encodeToChar ( final byte [ ] arr , final boolean lineSeparator ) { } }

implementation:
int len = arr != null ? arr . length : 0 ; if ( len == 0 ) { return new char [ 0 ] ; } int evenlen = ( len / 3 ) * 3 ; int cnt = ( ( len - 1 ) / 3 + 1 ) << 2 ; int destLen = cnt + ( lineSeparator ? ( cnt - 1 ) / 76 << 1 : 0 ) ; char [ ] dest = new char [ destLen ] ; for ( int s = 0 , d = 0 , cc = 0 ; s < evenlen ; ) { int i = ( arr [ s ++ ] & 0xff ) << 16 | ( arr [ s ++ ] & 0xff ) << 8 | ( arr [ s ++ ] & 0xff ) ; dest [ d ++ ] = CHARS [ ( i >>> 18 ) & 0x3f ] ; dest [ d ++ ] = CHARS [ ( i >>> 12 ) & 0x3f ] ; dest [ d ++ ] = CHARS [ ( i >>> 6 ) & 0x3f ] ; dest [ d ++ ] = CHARS [ i & 0x3f ] ; if ( lineSeparator && ( ++ cc == 19 ) && ( d < ( destLen - 2 ) ) ) { dest [ d ++ ] = '\r' ; dest [ d ++ ] = '\n' ; cc = 0 ; } } int left = len - evenlen ; // 0 - 2.
if ( left > 0 ) { int i = ( ( arr [ evenlen ] & 0xff ) << 10 ) | ( left == 2 ? ( ( arr [ len - 1 ] & 0xff ) << 2 ) : 0 ) ; dest [ destLen - 4 ] = CHARS [ i >> 12 ] ; dest [ destLen - 3 ] = CHARS [ ( i >>> 6 ) & 0x3f ] ; dest [ destLen - 2 ] = left == 2 ? CHARS [ i & 0x3f ] : '=' ; dest [ destLen - 1 ] = '=' ; } return dest ;


signature:
public class Base64 { /** * Decodes a BASE64 encoded char array . */
public static byte [ ] decode ( final char [ ] arr ) { } }

implementation: int length = arr . length ; if ( length == 0 ) { return new byte [ 0 ] ; } int sndx = 0 , endx = length - 1 ; int pad = arr [ endx ] == '=' ? ( arr [ endx - 1 ] == '=' ? 2 : 1 ) : 0 ; int cnt = endx - sndx + 1 ; int sepCnt = length > 76 ? ( arr [ 76 ] == '\r' ? cnt / 78 : 0 ) << 1 : 0 ; int len = ( ( cnt - sepCnt ) * 6 >> 3 ) - pad ; byte [ ] dest = new byte [ len ] ; int d = 0 ; for ( int cc = 0 , eLen = ( len / 3 ) * 3 ; d < eLen ; ) { int i = INV [ arr [ sndx ++ ] ] << 18 | INV [ arr [ sndx ++ ] ] << 12 | INV [ arr [ sndx ++ ] ] << 6 | INV [ arr [ sndx ++ ] ] ; dest [ d ++ ] = ( byte ) ( i >> 16 ) ; dest [ d ++ ] = ( byte ) ( i >> 8 ) ; dest [ d ++ ] = ( byte ) i ; if ( sepCnt > 0 && ++ cc == 19 ) { sndx += 2 ; cc = 0 ; } } if ( d < len ) { int i = 0 ; for ( int j = 0 ; sndx <= endx - pad ; j ++ ) { i |= INV [ arr [ sndx ++ ] ] << ( 18 - j * 6 ) ; } for ( int r = 16 ; d < len ; r -= 8 ) { dest [ d ++ ] = ( byte ) ( i >> r ) ; } } return dest ;


signature:
public class Base64 { /** * Encodes a raw byte array into a BASE64 < code > char [ ] < / code > .
 * @ param lineSep optional CRLF after 76 chars , unless EOF . */
public static byte [ ] encodeToByte ( final byte [ ] arr , final boolean lineSep ) { } }

implementation: int len = arr != null ? arr . length : 0 ; if ( len == 0 ) { return new byte [ 0 ] ; } int evenlen = ( len / 3 ) * 3 ; int cnt = ( ( len - 1 ) / 3 + 1 ) << 2 ; int destlen = cnt + ( lineSep ? ( cnt - 1 ) / 76 << 1 : 0 ) ; byte [ ] dest = new byte [ destlen ] ; for ( int s = 0 , d = 0 , cc = 0 ; s < evenlen ; ) { int i = ( arr [ s ++ ] & 0xff ) << 16 | ( arr [ s ++ ] & 0xff ) << 8 | ( arr [ s ++ ] & 0xff ) ; dest [ d ++ ] = ( byte ) CHARS [ ( i >>> 18 ) & 0x3f ] ; dest [ d ++ ] = ( byte ) CHARS [ ( i >>> 12 ) & 0x3f ] ; dest [ d ++ ] = ( byte ) CHARS [ ( i >>> 6 ) & 0x3f ] ; dest [ d ++ ] = ( byte ) CHARS [ i & 0x3f ] ; if ( lineSep && ++ cc == 19 && d < destlen - 2 ) { dest [ d ++ ] = '\r' ; dest [ d ++ ] = '\n' ; cc = 0 ; } } int left = len - evenlen ; if ( left > 0 ) { int i = ( ( arr [ evenlen ] & 0xff ) << 10 ) | ( left == 2 ? ( ( arr [ len - 1 ] & 0xff ) << 2 ) : 0 ) ; dest [ destlen - 4 ] = ( byte ) CHARS [ i >> 12 ] ; dest [ destlen - 3 ] = ( byte ) CHARS [ ( i >>> 6 ) & 0x3f ] ; dest [ destlen - 2 ] = left == 2 ? ( byte ) CHARS [ i & 0x3f ] : ( byte ) '=' ; dest [ destlen - 1 ] = '=' ; } return dest ;


signature:
public class Base64 { /** * - - - - - string */
public static String encodeToString ( final String s ) { } }

implementation: return new String ( encodeToChar ( StringUtil . getBytes ( s ) , false ) ) ;


signature:
public class CsrfShield { /** * Generates new CSRF token and puts it in the session . Returns generated token value . */
@ SuppressWarnings ( { } }

implementation: "unchecked" } ) public static String prepareCsrfToken ( final HttpSession session , final int timeToLive ) { Set < Token > tokenSet = ( Set < Token > ) session . getAttribute ( CSRF_TOKEN_SET ) ; if ( tokenSet == null ) { tokenSet = new HashSet < > ( ) ; session . setAttribute ( CSRF_TOKEN_SET , tokenSet ) ; } String value ; boolean unique ; do { value = RandomString . get ( ) . randomAlphaNumeric ( 32 ) ; assureSize ( tokenSet ) ; unique = tokenSet . add ( new Token ( value , timeToLive ) ) ; } while ( ! unique ) ; return value ;


signature:
public class CsrfShield { /** * Removes expired tokens if token set is full .
 * @ see # setMaxTokensPerSession ( int ) */
protected static void assureSize ( final Set < Token > tokenSet ) { } }

implementation: if ( tokenSet . size ( ) < maxTokensPerSession ) { return ; } long validUntilMin = Long . MAX_VALUE ; Token tokenToRemove = null ; Iterator < Token > iterator = tokenSet . iterator ( ) ; while ( iterator . hasNext ( ) ) { Token token = iterator . next ( ) ; if ( token . isExpired ( ) ) { iterator . remove ( ) ; continue ; } if ( token . validUntil < validUntilMin ) { validUntilMin = token . validUntil ; tokenToRemove = token ; } } if ( ( tokenToRemove != null ) && ( tokenSet . size ( ) >= maxTokensPerSession ) ) { tokenSet . remove ( tokenToRemove ) ; }


signature:
public class CsrfShield { /** * Checks if { @ link jodd . servlet . tag . CsrfTokenTag CSRF token } is valid .
 * Returns < code > false < / code > if token was requested , but not found .
 * Otherwise , it returns < code > true < / code > . */
@ SuppressWarnings ( { } }

implementation: "unchecked" } ) public static boolean checkCsrfToken ( final HttpServletRequest request , final String tokenName ) { String tokenValue = request . getParameter ( tokenName ) ; return checkCsrfToken ( request . getSession ( ) , tokenValue ) ;


signature:
public class CsrfShield { /** * Checks token value . */
@ SuppressWarnings ( { } }

implementation: "unchecked" } ) public static boolean checkCsrfToken ( final HttpSession session , final String tokenValue ) { Set < Token > tokenSet = ( Set < Token > ) session . getAttribute ( CSRF_TOKEN_SET ) ; if ( ( tokenSet == null ) && ( tokenValue == null ) ) { return true ; } if ( ( tokenSet == null ) || ( tokenValue == null ) ) { return false ; } boolean found = false ; Iterator < Token > it = tokenSet . iterator ( ) ; while ( it . hasNext ( ) ) { Token t = it . next ( ) ; if ( t . isExpired ( ) ) { it . remove ( ) ; continue ; } if ( t . getValue ( ) . equals ( tokenValue ) ) { it . remove ( ) ; found = true ; } } return found ;


signature:
public class BeanCopy { /** * Creates < code > BeanCopy < / code > with given < code > Map < / code > as a source . */
public static BeanCopy fromMap ( final Map source ) { } }

implementation: BeanCopy beanCopy = new BeanCopy ( source ) ; beanCopy . isSourceMap = true ; return beanCopy ;


signature:
public class BeanCopy { /** * Defines source , detects a map . */
public static BeanCopy from ( final Object source ) { } }

implementation: BeanCopy beanCopy = new BeanCopy ( source ) ; beanCopy . isSourceMap = source instanceof Map ; return beanCopy ;


signature:
public class BeanCopy { /** * Performs the copying . */
public void copy ( ) { } }

implementation: beanUtil = new BeanUtilBean ( ) . declared ( declared ) . forced ( forced ) . silent ( true ) ; visit ( ) ;


signature:
public class BeanCopy { /** * Copies single property to the destination .
 * Exceptions are ignored , so copying continues if
 * destination does not have some of the sources properties . */
@ Override protected boolean visitProperty ( String name , final Object value ) { } }

implementation: if ( isTargetMap ) { name = LEFT_SQ_BRACKET + name + RIGHT_SQ_BRACKET ; } beanUtil . setProperty ( destination , name , value ) ; return true ;


signature:
public class SimpleLagartoServletFilter { /** * Parses content using Lagarto and { @ link LagartoParsingProcessor } . */
@ Override protected final char [ ] parse ( final char [ ] content , final HttpServletRequest request ) { } }

implementation: LagartoParsingProcessor lpp = createParsingProcessor ( ) ; if ( lpp == null ) { return content ; } lpp . init ( content ) ; return lpp . parse ( request ) ;


signature:
public class TableChunk { /** * Resolves and registers table references . */
@ Override public void init ( final TemplateData templateData ) { } }

implementation: super . init ( templateData ) ; if ( entity != null ) { ded = lookupType ( entity ) ; } else { Object object = templateData . getObjectReference ( entityName ) ; if ( object != null ) { ded = lookupType ( resolveClass ( object ) ) ; } else { ded = lookupName ( entityName ) ; } } String tableReference = this . tableReference ; if ( tableReference == null ) { tableReference = tableAlias ; } if ( tableReference == null ) { tableReference = entityName ; } if ( tableReference == null ) { tableReference = ded . getEntityName ( ) ; } templateData . registerTableReference ( tableReference , ded , tableAlias ) ;


signature:
public class PetiteBeans { /** * Resolves and registers scope from a scope type . */
@ SuppressWarnings ( "unchecked" ) public < S extends Scope > S resolveScope ( final Class < S > scopeType ) { } }

implementation: S scope = ( S ) scopes . get ( scopeType ) ; if ( scope == null ) { try { scope = newInternalInstance ( scopeType , ( PetiteContainer ) this ) ; } catch ( Exception ex ) { throw new PetiteException ( "Invalid Petite scope: " + scopeType . getName ( ) , ex ) ; } registerScope ( scopeType , scope ) ; scopes . put ( scopeType , scope ) ; } return scope ;


signature:
public class PetiteBeans { /** * Creates new instance of given type . In the first try , it tries to use
 * constructor with a { @ link PetiteContainer } . If that files , uses default
 * constructor to builds an instance . */
private < T > T newInternalInstance ( final Class < T > type , final PetiteContainer petiteContainer ) throws Exception { } }

implementation:
T t = null ; // first try ctor ( PetiteContainer )
try { Constructor < T > ctor = type . getConstructor ( PetiteContainer . class ) ; t = ctor . newInstance ( petiteContainer ) ; } catch ( NoSuchMethodException nsmex ) { // ignore
} // if first try failed , try default ctor
if ( t == null ) { return ClassUtil . newInstance ( type ) ; } return t ;


signature:
public class PetiteBeans { /** * Registers new scope . It is not necessary to manually register scopes ,
 * since they become registered on first scope resolving .
 * However , it is possible to pre - register some scopes , or to < i > replace < / i > one scope
 * type with another . Replacing may be important for testing purposes when
 * using container - depended scopes . */
public void registerScope ( final Class < ? extends Scope > scopeType , final Scope scope ) { } }

implementation: scopes . put ( scopeType , scope ) ;


signature:
public class PetiteBeans { /** * Lookups for { @ link BeanDefinition bean definition } .
 * Returns < code > null < / code > if bean name doesn ' t exist . */
public BeanDefinition lookupBeanDefinition ( final String name ) { } }

implementation:
BeanDefinition beanDefinition = beans . get ( name ) ; // try alt bean names
if ( beanDefinition == null ) { if ( petiteConfig . isUseAltBeanNames ( ) ) { beanDefinition = beansAlt . get ( name ) ; } } return beanDefinition ;


signature:
public class PetiteBeans { /** * Lookups for first founded { @ link BeanDefinition bean definition } .
 * Returns < code > null < / code > if none of the beans is found . */
protected BeanDefinition lookupBeanDefinitions ( final BeanReferences beanReferences ) { } }

implementation: final int total = beanReferences . size ( ) ; for ( int i = 0 ; i < total ; i ++ ) { final String name = beanReferences . name ( i ) ; BeanDefinition beanDefinition = lookupBeanDefinition ( name ) ; if ( beanDefinition != null ) { return beanDefinition ; } } return null ;


signature:
public class PetiteBeans { /** * Lookups for existing { @ link jodd . petite . BeanDefinition bean definition } .
 * Throws exception if bean is not found . */
protected BeanDefinition lookupExistingBeanDefinition ( final String name ) { } }

implementation: BeanDefinition beanDefinition = lookupBeanDefinition ( name ) ; if ( beanDefinition == null ) { throw new PetiteException ( "Bean not found: " + name ) ; } return beanDefinition ;


signature:
public class PetiteBeans { /** * Creates { @ link jodd . petite . BeanDefinition } on
 * { @ link # registerPetiteBean ( Class , String , Class , WiringMode , boolean , Consumer ) bean registration } .
 * This is a hook for modifying the bean data , like passing proxifed class etc .
 * By default returns new instance of { @ link jodd . petite . BeanDefinition } . */
protected < T > BeanDefinition createBeanDefinitionForRegistration ( final String name , final Class < T > type , final Scope scope , final WiringMode wiringMode , final Consumer < T > consumer ) { } }

implementation: return new BeanDefinition < > ( name , type , scope , wiringMode , consumer ) ;


signature:
public class PetiteBeans { /** * Creates { @ link jodd . petite . BeanDefinition } for all external beans . */
protected < T > BeanDefinition createBeandDefinitionForExternalBeans ( final Class < T > type , final WiringMode wiringMode ) { } }

implementation: final String name = resolveBeanName ( type ) ; return new BeanDefinition < > ( name , type , null , wiringMode , null ) ;


signature:
public class PetiteBeans { /** * Registers a bean using provided class that is annotated . */
public BeanDefinition registerPetiteBean ( final Class type ) { } }

implementation: return registerPetiteBean ( type , null , null , null , false , null ) ;


signature:
public class PetiteBeans { /** * Registers a bean using provided class that is annotated . */
public < T > BeanDefinition < T > registerPetiteBean ( final Class < T > type , final Consumer < T > consumer ) { } }

implementation: return registerPetiteBean ( type , null , null , null , false , consumer ) ;


signature:
public class PetiteBeans { /** * Registers or defines a bean .
 * @ param type bean type , must be specified
 * @ param name bean name , if < code > null < / code > it will be resolved from the class ( name or annotation )
 * @ param scopeType bean scope , if < code > null < / code > it will be resolved from the class ( annotation or default one )
 * @ param wiringMode wiring mode , if < code > null < / code > it will be resolved from the class ( annotation or default one )
 * @ param define when set to < code > true < / code > bean will be defined - all injection points will be set to none */
public < T > BeanDefinition < T > registerPetiteBean ( final Class < T > type , String name , Class < ? extends Scope > scopeType , WiringMode wiringMode , final boolean define , final Consumer < T > consumer ) { } }

implementation:
if ( name == null ) { name = resolveBeanName ( type ) ; } if ( wiringMode == null ) { wiringMode = annotationResolver . resolveBeanWiringMode ( type ) ; } if ( wiringMode == WiringMode . DEFAULT ) { wiringMode = petiteConfig . getDefaultWiringMode ( ) ; } if ( scopeType == null ) { scopeType = annotationResolver . resolveBeanScopeType ( type ) ; } if ( scopeType == null ) { scopeType = SingletonScope . class ; } // remove existing bean
BeanDefinition existing = removeBean ( name ) ; if ( existing != null ) { if ( petiteConfig . getDetectDuplicatedBeanNames ( ) ) { throw new PetiteException ( "Duplicated bean name detected while registering class '" + type . getName ( ) + "'. Petite bean class '" + existing . type . getName ( ) + "' is already registered with the name: " + name ) ; } } // check if type is valid
if ( type . isInterface ( ) ) { throw new PetiteException ( "PetiteBean can not be an interface: " + type . getName ( ) ) ; } // registration
if ( log . isDebugEnabled ( ) ) { log . info ( "Petite bean: [" + name + "] --> " + type . getName ( ) + " @ " + scopeType . getSimpleName ( ) + ":" + wiringMode . toString ( ) ) ; } // register
Scope scope = resolveScope ( scopeType ) ; BeanDefinition < T > beanDefinition = createBeanDefinitionForRegistration ( name , type , scope , wiringMode , consumer ) ; registerBean ( name , beanDefinition ) ; // providers
ProviderDefinition [ ] providerDefinitions = petiteResolvers . resolveProviderDefinitions ( type , name ) ; if ( providerDefinitions != null ) { for ( ProviderDefinition providerDefinition : providerDefinitions ) { providers . put ( providerDefinition . name , providerDefinition ) ; } } // define
if ( define ) { beanDefinition . ctor = petiteResolvers . resolveCtorInjectionPoint ( beanDefinition . type ( ) ) ; beanDefinition . properties = PropertyInjectionPoint . EMPTY ; beanDefinition . methods = MethodInjectionPoint . EMPTY ; beanDefinition . initMethods = InitMethodPoint . EMPTY ; beanDefinition . destroyMethods = DestroyMethodPoint . EMPTY ; } // return
return beanDefinition ;


signature:
public class PetiteBeans { /** * Registers bean definition by putting it in the beans map . If bean does
 * not have petite name explicitly defined , alternative bean names
 * will be registered . */
protected void registerBean ( final String name , final BeanDefinition beanDefinition ) { } }

implementation:
beans . put ( name , beanDefinition ) ; if ( ! petiteConfig . isUseAltBeanNames ( ) ) { return ; } Class type = beanDefinition . type ( ) ; if ( annotationResolver . beanHasAnnotationName ( type ) ) { return ; } Class [ ] interfaces = ClassUtil . resolveAllInterfaces ( type ) ; for ( Class anInterface : interfaces ) { String altName = annotationResolver . resolveBeanName ( anInterface , petiteConfig . getUseFullTypeNames ( ) ) ; if ( name . equals ( altName ) ) { continue ; } if ( beans . containsKey ( altName ) ) { continue ; } if ( beansAlt . containsKey ( altName ) ) { BeanDefinition existing = beansAlt . get ( altName ) ; if ( existing != null ) { beansAlt . put ( altName , null ) ; // store null as value to mark that alt name is duplicate
} } else { beansAlt . put ( altName , beanDefinition ) ; } }


signature:
public class PetiteBeans { /** * Removes all petite beans of provided type . Bean name is not resolved from a type !
 * Instead , all beans are iterated and only beans with equal types are removed .
 * @ see # removeBean ( String ) */
public void removeBean ( final Class type ) { } }

implementation:
// collect bean names
Set < String > beanNames = new HashSet < > ( ) ; for ( BeanDefinition def : beans . values ( ) ) { if ( def . type . equals ( type ) ) { beanNames . add ( def . name ) ; } } // remove collected bean names
for ( String beanName : beanNames ) { removeBean ( beanName ) ; }


signature:
public class PetiteBeans { /** * Removes bean and returns definition of removed bean .
 * All resolvers references are deleted , too .
 * Returns bean definition of removed bean or < code > null < / code > . */
public BeanDefinition removeBean ( final String name ) { } }

implementation: BeanDefinition bd = beans . remove ( name ) ; if ( bd == null ) { return null ; } bd . scopeRemove ( ) ; return bd ;


signature:
public class PetiteBeans { /** * Resolves bean names for give type . */
protected String [ ] resolveBeanNamesForType ( final Class type ) { } }

implementation: String [ ] beanNames = beanCollections . get ( type ) ; if ( beanNames != null ) { return beanNames ; } ArrayList < String > list = new ArrayList < > ( ) ; for ( Map . Entry < String , BeanDefinition > entry : beans . entrySet ( ) ) { BeanDefinition beanDefinition = entry . getValue ( ) ; if ( ClassUtil . isTypeOf ( beanDefinition . type , type ) ) { String beanName = entry . getKey ( ) ; list . add ( beanName ) ; } } if ( list . isEmpty ( ) ) { beanNames = StringPool . EMPTY_ARRAY ; } else { beanNames = list . toArray ( new String [ 0 ] ) ; } beanCollections . put ( type , beanNames ) ; return beanNames ;


signature:
public class PetiteBeans { /** * Registers constructor injection point .
 * @ param beanName bean name
 * @ param paramTypes constructor parameter types , may be < code > null < / code >
 * @ param references references for arguments */
public void registerPetiteCtorInjectionPoint ( final String beanName , final Class [ ] paramTypes , final String [ ] references ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; Constructor constructor = null ; if ( paramTypes == null ) { CtorDescriptor [ ] ctors = cd . getAllCtorDescriptors ( ) ; if ( ctors != null && ctors . length > 0 ) { if ( ctors . length > 1 ) { throw new PetiteException ( ctors . length + " suitable constructor found as injection point for: " + beanDefinition . type . getName ( ) ) ; } constructor = ctors [ 0 ] . getConstructor ( ) ; } } else { CtorDescriptor ctorDescriptor = cd . getCtorDescriptor ( paramTypes , true ) ; if ( ctorDescriptor != null ) { constructor = ctorDescriptor . getConstructor ( ) ; } } if ( constructor == null ) { throw new PetiteException ( "Constructor not found: " + beanDefinition . type . getName ( ) ) ; } BeanReferences [ ] ref = referencesResolver . resolveReferenceFromValues ( constructor , references ) ; beanDefinition . ctor = new CtorInjectionPoint ( constructor , ref ) ;


signature:
public class PetiteBeans { /** * Registers property injection point .
 * @ param beanName bean name
 * @ param property property name
 * @ param reference explicit injection reference , may be < code > null < / code > */
public void registerPetitePropertyInjectionPoint ( final String beanName , final String property , final String reference ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; PropertyDescriptor propertyDescriptor = cd . getPropertyDescriptor ( property , true ) ; if ( propertyDescriptor == null ) { throw new PetiteException ( "Property not found: " + beanDefinition . type . getName ( ) + '#' + property ) ; } BeanReferences ref = referencesResolver . resolveReferenceFromValue ( propertyDescriptor , reference ) ; PropertyInjectionPoint pip = new PropertyInjectionPoint ( propertyDescriptor , ref ) ; beanDefinition . addPropertyInjectionPoint ( pip ) ;


signature:
public class PetiteBeans { /** * Registers set injection point .
 * @ param beanName bean name
 * @ param property set property name */
public void registerPetiteSetInjectionPoint ( final String beanName , final String property ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; PropertyDescriptor propertyDescriptor = cd . getPropertyDescriptor ( property , true ) ; if ( propertyDescriptor == null ) { throw new PetiteException ( "Property not found: " + beanDefinition . type . getName ( ) + '#' + property ) ; } SetInjectionPoint sip = new SetInjectionPoint ( propertyDescriptor ) ; beanDefinition . addSetInjectionPoint ( sip ) ;


signature:
public class PetiteBeans { /** * Registers method injection point .
 * @ param beanName bean name
 * @ param methodName method name
 * @ param arguments method arguments , may be < code > null < / code >
 * @ param references injection references */
public void registerPetiteMethodInjectionPoint ( final String beanName , final String methodName , final Class [ ] arguments , final String [ ] references ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; Method method = null ; if ( arguments == null ) { MethodDescriptor [ ] methods = cd . getAllMethodDescriptors ( methodName ) ; if ( methods != null && methods . length > 0 ) { if ( methods . length > 1 ) { throw new PetiteException ( methods . length + " suitable methods found as injection points for: " + beanDefinition . type . getName ( ) + '#' + methodName ) ; } method = methods [ 0 ] . getMethod ( ) ; } } else { MethodDescriptor md = cd . getMethodDescriptor ( methodName , arguments , true ) ; if ( md != null ) { method = md . getMethod ( ) ; } } if ( method == null ) { throw new PetiteException ( "Method not found: " + beanDefinition . type . getName ( ) + '#' + methodName ) ; } BeanReferences [ ] ref = referencesResolver . resolveReferenceFromValues ( method , references ) ; MethodInjectionPoint mip = new MethodInjectionPoint ( method , ref ) ; beanDefinition . addMethodInjectionPoint ( mip ) ;


signature:
public class PetiteBeans { /** * Registers init method .
 * @ param beanName bean name
 * @ param invocationStrategy moment of invocation
 * @ param initMethodNames init method names */
public void registerPetiteInitMethods ( final String beanName , final InitMethodInvocationStrategy invocationStrategy , String ... initMethodNames ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; if ( initMethodNames == null ) { initMethodNames = StringPool . EMPTY_ARRAY ; } int total = initMethodNames . length ; InitMethodPoint [ ] initMethodPoints = new InitMethodPoint [ total ] ; int i ; for ( i = 0 ; i < initMethodNames . length ; i ++ ) { MethodDescriptor md = cd . getMethodDescriptor ( initMethodNames [ i ] , ClassUtil . EMPTY_CLASS_ARRAY , true ) ; if ( md == null ) { throw new PetiteException ( "Init method not found: " + beanDefinition . type . getName ( ) + '#' + initMethodNames [ i ] ) ; } initMethodPoints [ i ] = new InitMethodPoint ( md . getMethod ( ) , i , invocationStrategy ) ; } beanDefinition . addInitMethodPoints ( initMethodPoints ) ;


signature:
public class PetiteBeans { /** * Registers destroy method .
 * @ param beanName bean name
 * @ param destroyMethodNames destroy method names */
public void registerPetiteDestroyMethods ( final String beanName , String ... destroyMethodNames ) { } }

implementation: BeanDefinition beanDefinition = lookupExistingBeanDefinition ( beanName ) ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanDefinition . type ) ; if ( destroyMethodNames == null ) { destroyMethodNames = StringPool . EMPTY_ARRAY ; } int total = destroyMethodNames . length ; DestroyMethodPoint [ ] destroyMethodPoints = new DestroyMethodPoint [ total ] ; int i ; for ( i = 0 ; i < destroyMethodNames . length ; i ++ ) { MethodDescriptor md = cd . getMethodDescriptor ( destroyMethodNames [ i ] , ClassUtil . EMPTY_CLASS_ARRAY , true ) ; if ( md == null ) { throw new PetiteException ( "Destroy method not found: " + beanDefinition . type . getName ( ) + '#' + destroyMethodNames [ i ] ) ; } destroyMethodPoints [ i ] = new DestroyMethodPoint ( md . getMethod ( ) ) ; } beanDefinition . addDestroyMethodPoints ( destroyMethodPoints ) ;


signature:
public class PetiteBeans { /** * Registers instance method provider .
 * @ param providerName provider name
 * @ param beanName bean name
 * @ param methodName instance method name
 * @ param arguments method argument types */
public void registerPetiteProvider ( final String providerName , final String beanName , final String methodName , final Class [ ] arguments ) { } }

implementation: BeanDefinition beanDefinition = lookupBeanDefinition ( beanName ) ; if ( beanDefinition == null ) { throw new PetiteException ( "Bean not found: " + beanName ) ; } Class beanType = beanDefinition . type ; ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( beanType ) ; MethodDescriptor md = cd . getMethodDescriptor ( methodName , arguments , true ) ; if ( md == null ) { throw new PetiteException ( "Provider method not found: " + methodName ) ; } ProviderDefinition providerDefinition = new ProviderDefinition ( providerName , beanName , md . getMethod ( ) ) ; providers . put ( providerName , providerDefinition ) ;


signature:
public class PetiteBeans { /** * Registers static method provider .
 * @ param providerName provider name
 * @ param type class type
 * @ param staticMethodName static method name
 * @ param arguments method argument types */
public void registerPetiteProvider ( final String providerName , final Class type , final String staticMethodName , final Class [ ] arguments ) { } }

implementation: ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; MethodDescriptor md = cd . getMethodDescriptor ( staticMethodName , arguments , true ) ; if ( md == null ) { throw new PetiteException ( "Provider method not found: " + staticMethodName ) ; } ProviderDefinition providerDefinition = new ProviderDefinition ( providerName , md . getMethod ( ) ) ; providers . put ( providerName , providerDefinition ) ;


signature:
public class PetiteBeans { /** * Iterates all beans . Iteration occurs over the { @ link # beanNames ( ) snapshot of bean names } . */
public void forEachBean ( final Consumer < BeanDefinition > beanDefinitionConsumer ) { } }

implementation: final Set < String > names = beanNames ( ) ; for ( String beanName : names ) { BeanDefinition beanDefinition = lookupBeanDefinition ( beanName ) ; if ( beanDefinition != null ) { beanDefinitionConsumer . accept ( beanDefinition ) ; } }


signature:
public class PetiteBeans { /** * Iterates all beans that are of given type . */
public void forEachBeanType ( final Class type , final Consumer < String > beanNameConsumer ) { } }

implementation: forEachBean ( bd -> { if ( ClassUtil . isTypeOf ( bd . type , type ) ) { beanNameConsumer . accept ( bd . name ) ; } } ) ;


signature:
public class PetiteBeans { /** * Defines many parameters at once . */
public void defineParameters ( final Map < ? , ? > properties ) { } }

implementation: for ( Map . Entry < ? , ? > entry : properties . entrySet ( ) ) { defineParameter ( entry . getKey ( ) . toString ( ) , entry . getValue ( ) ) ; }


signature:
public class PetiteBeans { /** * Defines many parameters at once from { @ link jodd . props . Props } . */
public void defineParameters ( final Props props ) { } }

implementation: Map < ? , ? > map = new HashMap < > ( ) ; props . extractProps ( map ) ; defineParameters ( map ) ;


signature:
public class ClassLoaderLocal { /** * Returns the value in the current classloader copy of this variable .
 * If the variable has no value for the current classloader , it is first initialized to the value returned
 * by an invocation of the initialValue ( ) method . */
public synchronized T get ( ) { } }

implementation: ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contextClassLoader != null ) { T value = weakMap . get ( contextClassLoader ) ; if ( ( value == null ) && ! weakMap . containsKey ( contextClassLoader ) ) { value = initialValue ( ) ; weakMap . put ( contextClassLoader , value ) ; } return value ; } if ( ! initialized ) { value = initialValue ( ) ; initialized = true ; } return value ;


signature:
public class ClassLoaderLocal { /** * Sets the current classloaders ' s copy of this variable to the specified value .
 * Most subclasses will have no need to override this method , relying solely on the initialValue ( )
 * method to set the values of classloader - locals . */
public synchronized void set ( final T value ) { } }

implementation: ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contextClassLoader != null ) { weakMap . put ( contextClassLoader , value ) ; return ; } this . value = value ; this . initialized = true ;


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

implementation: return Float . valueOf ( rs . getFloat ( index ) ) ;


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

implementation: st . setFloat ( index , value . floatValue ( ) ) ;


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

implementation: return rs . getDate ( index ) ;


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

implementation: st . setDate ( index , value ) ;


signature:
public class EchoInterceptor { /** * Measure action invocation time . */
@ Override public Object intercept ( final ActionRequest actionRequest ) throws Exception { } }

implementation: printBefore ( actionRequest ) ; long startTime = System . currentTimeMillis ( ) ; Object result = null ; try { result = actionRequest . invoke ( ) ; } catch ( Exception ex ) { result = "<exception>" ; throw ex ; } catch ( Throwable th ) { result = "<throwable>" ; throw new Exception ( th ) ; } finally { long executionTime = System . currentTimeMillis ( ) - startTime ; printAfter ( actionRequest , executionTime , result ) ; } return result ;


signature:
public class EchoInterceptor { /** * Prints out the message . User can override this method and modify the way
 * the message is printed . */
protected void printBefore ( final ActionRequest request ) { } }

implementation: StringBuilder message = new StringBuilder ( prefixIn ) ; message . append ( request . getActionPath ( ) ) . append ( "   [" ) . append ( request . getActionRuntime ( ) . createActionString ( ) ) . append ( ']' ) ; out ( message . toString ( ) ) ;


signature:
public class EchoInterceptor { /** * Prints out the message . User can override this method and modify the way
 * the message is printed . */
protected void printAfter ( final ActionRequest request , final long executionTime , final Object result ) { } }

implementation: StringBuilder message = new StringBuilder ( prefixOut ) ; String resultString = StringUtil . toSafeString ( result ) ; if ( resultString . length ( ) > 70 ) { resultString = resultString . substring ( 0 , 70 ) ; resultString += "..." ; } message . append ( request . getActionPath ( ) ) . append ( "  (" ) . append ( resultString ) . append ( ") in " ) . append ( executionTime ) . append ( "ms." ) ; out ( message . toString ( ) ) ;


signature:
public class ProxettaAsmUtil { /** * Resolves Java version from current version . */
public static int resolveJavaVersion ( final int version ) { } }

implementation: final int javaVersionNumber = SystemUtil . info ( ) . getJavaVersionNumber ( ) ; final int platformVersion = javaVersionNumber - 8 + 52 ; return version > platformVersion ? version : platformVersion ;


signature:
public class ProxettaAsmUtil { /** * Pushes int value in an optimal way . */
public static void pushInt ( final MethodVisitor mv , final int value ) { } }

implementation: if ( value <= 5 ) { mv . visitInsn ( ICONST_0 + value ) ; } else if ( value <= Byte . MAX_VALUE ) { mv . visitIntInsn ( BIPUSH , value ) ; } else { mv . visitIntInsn ( SIPUSH , value ) ; }


signature:
public class ProxettaAsmUtil { /** * Validates argument index . */
public static void checkArgumentIndex ( final MethodInfo methodInfo , final int argIndex ) { } }

implementation: if ( ( argIndex < 1 ) || ( argIndex > methodInfo . getArgumentsCount ( ) ) ) { throw new ProxettaException ( "Invalid argument index: " + argIndex ) ; }


signature:
public class ProxettaAsmUtil { /** * Builds advice field name . */
public static String adviceFieldName ( final String name , final int index ) { } }

implementation: return ProxettaNames . fieldPrefix + name + ProxettaNames . fieldDivider + index ;


signature:
public class ProxettaAsmUtil { /** * Builds advice method name . */
public static String adviceMethodName ( final String name , final int index ) { } }

implementation: return ProxettaNames . methodPrefix + name + ProxettaNames . methodDivider + index ;


signature:
public class ProxettaAsmUtil { /** * - - - - - load */
public static void loadMethodArgumentClass ( final MethodVisitor mv , final MethodInfo methodInfo , final int index ) { } }

implementation: TypeInfo argument = methodInfo . getArgument ( index ) ; loadClass ( mv , argument . getOpcode ( ) , argument . getRawName ( ) ) ;


signature:
public class ProxettaAsmUtil { /** * Loads all method arguments before INVOKESPECIAL call . */
public static void loadSpecialMethodArguments ( final MethodVisitor mv , final MethodInfo methodInfo ) { } }

implementation: mv . visitVarInsn ( ALOAD , 0 ) ; for ( int i = 1 ; i <= methodInfo . getArgumentsCount ( ) ; i ++ ) { loadMethodArgument ( mv , methodInfo , i ) ; }


signature:
public class ProxettaAsmUtil { /** * Loads all method arguments before INVOKESTATIC call . */
public static void loadStaticMethodArguments ( final MethodVisitor mv , final MethodInfo methodInfo ) { } }

implementation: for ( int i = 0 ; i < methodInfo . getArgumentsCount ( ) ; i ++ ) { loadMethodArgument ( mv , methodInfo , i ) ; }


signature:
public class ProxettaAsmUtil { /** * Loads all method arguments before INVOKEVIRTUAL call . */
public static void loadVirtualMethodArguments ( final MethodVisitor mv , final MethodInfo methodInfo ) { } }

implementation: for ( int i = 1 ; i <= methodInfo . getArgumentsCount ( ) ; i ++ ) { loadMethodArgument ( mv , methodInfo , i ) ; }


signature:
public class ProxettaAsmUtil { /** * Loads one argument . Index is 1 - based . No conversion occurs . */
public static void loadMethodArgument ( final MethodVisitor mv , final MethodInfo methodInfo , final int index ) { } }

implementation: int offset = methodInfo . getArgumentOffset ( index ) ; int type = methodInfo . getArgument ( index ) . getOpcode ( ) ; switch ( type ) { case 'V' : break ; case 'B' : case 'C' : case 'S' : case 'I' : case 'Z' : mv . visitVarInsn ( ILOAD , offset ) ; break ; case 'J' : mv . visitVarInsn ( LLOAD , offset ) ; break ; case 'F' : mv . visitVarInsn ( FLOAD , offset ) ; break ; case 'D' : mv . visitVarInsn ( DLOAD , offset ) ; break ; default : mv . visitVarInsn ( ALOAD , offset ) ; }


signature:
public class ProxettaAsmUtil { /** * Stores one argument . Index is 1 - based . No conversion occurs . */
public static void storeMethodArgument ( final MethodVisitor mv , final MethodInfo methodInfo , final int index ) { } }

implementation: int offset = methodInfo . getArgumentOffset ( index ) ; int type = methodInfo . getArgument ( index ) . getOpcode ( ) ; switch ( type ) { case 'V' : break ; case 'B' : case 'C' : case 'S' : case 'I' : case 'Z' : mv . visitVarInsn ( ISTORE , offset ) ; break ; case 'J' : mv . visitVarInsn ( LSTORE , offset ) ; break ; case 'F' : mv . visitVarInsn ( FSTORE , offset ) ; break ; case 'D' : mv . visitVarInsn ( DSTORE , offset ) ; break ; default : mv . visitVarInsn ( ASTORE , offset ) ; }


signature:
public class ProxettaAsmUtil { /** * Returns < code > true < / code > if opcode is xSTORE . */
public static boolean isStoreOpcode ( final int opcode ) { } }

implementation: return ( opcode == ISTORE ) || ( opcode == LSTORE ) || ( opcode == FSTORE ) || ( opcode == DSTORE ) || ( opcode == ASTORE ) ;


signature:
public class ProxettaAsmUtil { /** * Visits return opcodes . */
public static void visitReturn ( final MethodVisitor mv , final MethodInfo methodInfo , final boolean isLast ) { } }

implementation: switch ( methodInfo . getReturnType ( ) . getOpcode ( ) ) { case 'V' : if ( isLast ) { mv . visitInsn ( POP ) ; } mv . visitInsn ( RETURN ) ; break ; case 'B' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( IRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . byteValue ( mv ) ; } mv . visitInsn ( IRETURN ) ; break ; case 'C' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( IRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . charValue ( mv ) ; } mv . visitInsn ( IRETURN ) ; break ; case 'S' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( IRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . shortValue ( mv ) ; } mv . visitInsn ( IRETURN ) ; break ; case 'I' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( IRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . intValue ( mv ) ; } mv . visitInsn ( IRETURN ) ; break ; case 'Z' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( IRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . booleanValue ( mv ) ; } mv . visitInsn ( IRETURN ) ; break ; case 'J' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( LCONST_0 ) ; mv . visitInsn ( LRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . longValue ( mv ) ; } mv . visitInsn ( LRETURN ) ; break ; case 'F' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( FCONST_0 ) ; mv . visitInsn ( FRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . floatValue ( mv ) ; } mv . visitInsn ( FRETURN ) ; break ; case 'D' : if ( isLast ) { mv . visitInsn ( DUP ) ; Label label = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , label ) ; mv . visitInsn ( POP ) ; mv . visitInsn ( DCONST_0 ) ; mv . visitInsn ( DRETURN ) ; mv . visitLabel ( label ) ; AsmUtil . doubleValue ( mv ) ; } mv . visitInsn ( DRETURN ) ; break ; default : mv . visitInsn ( ARETURN ) ; break ; }


signature:
public class ProxettaAsmUtil { /** * Prepares return value . */
public static void prepareReturnValue ( final MethodVisitor mv , final MethodInfo methodInfo , int varOffset ) { } }

implementation: varOffset += methodInfo . getAllArgumentsSize ( ) ; switch ( methodInfo . getReturnType ( ) . getOpcode ( ) ) { case 'V' : mv . visitInsn ( ACONST_NULL ) ; break ; case 'B' : AsmUtil . valueOfByte ( mv ) ; break ; case 'C' : AsmUtil . valueOfCharacter ( mv ) ; break ; case 'S' : AsmUtil . valueOfShort ( mv ) ; break ; case 'I' : AsmUtil . valueOfInteger ( mv ) ; break ; case 'Z' : AsmUtil . valueOfBoolean ( mv ) ; break ; case 'J' : AsmUtil . valueOfLong ( mv ) ; break ; case 'F' : AsmUtil . valueOfFloat ( mv ) ; break ; case 'D' : AsmUtil . valueOfDouble ( mv ) ; break ; }


signature:
public class ProxettaAsmUtil { /** * Creates unique key for method signatures map . */
public static String createMethodSignaturesKey ( final int access , final String methodName , final String description , final String className ) { } }

implementation: return new StringBand ( 7 ) . append ( access ) . append ( COLON ) . append ( description ) . append ( StringPool . UNDERSCORE ) . append ( className ) . append ( StringPool . HASH ) . append ( methodName ) . toString ( ) ;


signature:
public class ProxettaAsmUtil { /** * Visits non - array element value for annotation . Returns < code > true < / code >
 * if value is successfully processed . */
public static void visitElementValue ( final MethodVisitor mv , final Object elementValue , final boolean boxPrimitives ) { } }

implementation:
if ( elementValue instanceof String ) { // string
mv . visitLdcInsn ( elementValue ) ; return ; } if ( elementValue instanceof Type ) { // class
mv . visitLdcInsn ( elementValue ) ; return ; } if ( elementValue instanceof Class ) { mv . visitLdcInsn ( Type . getType ( ( Class ) elementValue ) ) ; return ; } // primitives
if ( elementValue instanceof Integer ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfInteger ( mv ) ; } return ; } if ( elementValue instanceof Long ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfLong ( mv ) ; } return ; } if ( elementValue instanceof Short ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfShort ( mv ) ; } return ; } if ( elementValue instanceof Byte ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfByte ( mv ) ; } return ; } if ( elementValue instanceof Float ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfFloat ( mv ) ; } return ; } if ( elementValue instanceof Double ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfDouble ( mv ) ; } return ; } if ( elementValue instanceof Character ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfCharacter ( mv ) ; } return ; } if ( elementValue instanceof Boolean ) { mv . visitLdcInsn ( elementValue ) ; if ( boxPrimitives ) { AsmUtil . valueOfBoolean ( mv ) ; } return ; } // enum
Class elementValueClass = elementValue . getClass ( ) ; Class enumClass = ClassUtil . findEnum ( elementValueClass ) ; if ( enumClass != null ) { try { String typeRef = AsmUtil . typeToTyperef ( enumClass ) ; String typeSignature = AsmUtil . typeToSignature ( enumClass ) ; // invoke
Method nameMethod = elementValue . getClass ( ) . getMethod ( "name" ) ; String name = ( String ) nameMethod . invoke ( elementValue ) ; mv . visitFieldInsn ( GETSTATIC , typeSignature , name , typeRef ) ; return ; } catch ( Exception ignore ) { } } throw new ProxettaException ( "Unsupported annotation type: " + elementValue . getClass ( ) ) ;


signature:
public class ProxettaAsmUtil { /** * Creates new array . */
public static void newArray ( final MethodVisitor mv , final Class componentType ) { } }

implementation: if ( componentType == int . class ) { mv . visitIntInsn ( NEWARRAY , T_INT ) ; return ; } if ( componentType == long . class ) { mv . visitIntInsn ( NEWARRAY , T_LONG ) ; return ; } if ( componentType == float . class ) { mv . visitIntInsn ( NEWARRAY , T_FLOAT ) ; return ; } if ( componentType == double . class ) { mv . visitIntInsn ( NEWARRAY , T_DOUBLE ) ; return ; } if ( componentType == byte . class ) { mv . visitIntInsn ( NEWARRAY , T_BYTE ) ; return ; } if ( componentType == short . class ) { mv . visitIntInsn ( NEWARRAY , T_SHORT ) ; return ; } if ( componentType == boolean . class ) { mv . visitIntInsn ( NEWARRAY , T_BOOLEAN ) ; return ; } if ( componentType == char . class ) { mv . visitIntInsn ( NEWARRAY , T_CHAR ) ; return ; } mv . visitTypeInsn ( ANEWARRAY , AsmUtil . typeToSignature ( componentType ) ) ;


signature:
public class ProxettaAsmUtil { /** * Stores element on stack into an array . */
public static void storeIntoArray ( final MethodVisitor mv , final Class componentType ) { } }

implementation: if ( componentType == int . class ) { mv . visitInsn ( IASTORE ) ; return ; } if ( componentType == long . class ) { mv . visitInsn ( LASTORE ) ; return ; } if ( componentType == float . class ) { mv . visitInsn ( FASTORE ) ; return ; } if ( componentType == double . class ) { mv . visitInsn ( DASTORE ) ; return ; } if ( componentType == byte . class ) { mv . visitInsn ( BASTORE ) ; return ; } if ( componentType == short . class ) { mv . visitInsn ( SASTORE ) ; return ; } if ( componentType == boolean . class ) { mv . visitInsn ( BASTORE ) ; return ; } if ( componentType == char . class ) { mv . visitInsn ( CASTORE ) ; return ; } mv . visitInsn ( AASTORE ) ;


signature:
public class ProxettaAsmUtil { /** * - - - - - detect advice macros */
public static boolean isInvokeMethod ( final String name , final String desc ) { } }

implementation: if ( name . equals ( "invoke" ) ) { if ( desc . equals ( "()Ljava/lang/Object;" ) ) { return true ; } } return false ;


signature:
public class DecoraManager { /** * Lookups the decorator for given decorator path .
 * Returns { @ code null } if decorator is not registered , indicating that content should be
 * read using the dispatcher . */
public char [ ] lookupDecoratorContent ( final String path ) { } }

implementation: if ( contentMap != null ) { final char [ ] data = contentMap . get ( path ) ; if ( data != null ) { return data ; } final File file = filesMap . get ( path ) ; if ( file != null ) { try { return FileUtil . readChars ( file ) ; } catch ( IOException e ) { throw new DecoraException ( "Unable to read Decrator files" , e ) ; } } } return null ;


signature:
public class DecoraManager { /** * Resolves decorator path based on request and action path .
 * If decorator is not found , returns < code > null < / code > .
 * By default applies decorator on all * . html pages . */
public String resolveDecorator ( final HttpServletRequest request , final String actionPath ) { } }

implementation: if ( actionPath . endsWith ( ".html" ) ) { return DEFAULT_DECORATOR ; } return null ;


signature:
public class EmailUtil { /** * TODO : should this always return lowercase or always uppercase ? */
public static String extractMimeType ( final String contentType ) { } }

implementation: final int ndx = contentType . indexOf ( ';' ) ; final String mime ; if ( ndx != - 1 ) { mime = contentType . substring ( 0 , ndx ) ; } else { mime = contentType ; } return mime ;


signature:
public class EmailUtil { /** * TODO : should this always return lowercase or always uppercase ? */
public static String extractEncoding ( final String contentType ) { } }

implementation: int ndx = contentType . indexOf ( ';' ) ; final String charset = ndx != - 1 ? contentType . substring ( ndx + 1 ) : StringPool . EMPTY ; String encoding = null ; ndx = charset . indexOf ( ATTR_CHARSET ) ; if ( ndx != - 1 ) { ndx += ATTR_CHARSET . length ( ) ; final int len = charset . length ( ) ; if ( charset . charAt ( ndx ) == '"' ) { ndx ++ ; } final int start = ndx ; while ( ndx < len ) { final char c = charset . charAt ( ndx ) ; if ( ( c == '"' ) || ( CharUtil . isWhitespace ( c ) ) || ( c == ';' ) ) { break ; } ndx ++ ; } encoding = charset . substring ( start , ndx ) ; } return encoding ;


signature:
public class EmailUtil { /** * Extracts encoding from a given content type .
 * @ param contentType content type .
 * @ param defaultEncoding Default encoding to be used if extract returns { @ code null } .
 * If defaultEncoding is { @ code null } , { @ link JoddCore # encoding } will be used .
 * @ return Encoding from the content type .
 * @ see # extractEncoding ( String ) */
public static String extractEncoding ( final String contentType , String defaultEncoding ) { } }

implementation: String encoding = extractEncoding ( contentType ) ; if ( encoding == null ) { if ( defaultEncoding == null ) { defaultEncoding = JoddCore . encoding ; } encoding = defaultEncoding ; } return encoding ;


signature:
public class EmailUtil { /** * Correctly resolves file name from the message part .
 * Thanx to : Flavio Pompermaier
 * @ param part { @ link Part } to decode file name from .
 * @ return String containing file name . */
public static String resolveFileName ( final Part part ) throws MessagingException { } }

implementation:
if ( ! ( part instanceof MimeBodyPart ) ) { return part . getFileName ( ) ; } final String contentType = part . getContentType ( ) ; String ret ; try { ret = MimeUtility . decodeText ( part . getFileName ( ) ) ; } catch ( final Exception ex ) { // String [ ] contentId = part . getHeader ( " Content - ID " ) ;
// if ( contentId ! = null & & contentId . length > 0 ) {
final String contentId = ( ( MimeBodyPart ) part ) . getContentID ( ) ; if ( contentId != null ) { ret = contentId + contentTypeForFileName ( contentType ) ; } else { ret = defaultFileName ( contentType ) ; } } return ret ;


signature:
public class EmailUtil { /** * Check whether flags is a empty flags
 * @ param flags a flags of message to check
 * @ return whether the flags is empty */
public static boolean isEmptyFlags ( Flags flags ) { } }

implementation: if ( flags == null ) return true ; Flags . Flag [ ] systemFlags = flags . getSystemFlags ( ) ; if ( systemFlags != null && systemFlags . length > 0 ) { return false ; } String [ ] userFlags = flags . getUserFlags ( ) ; if ( userFlags != null && userFlags . length > 0 ) { return false ; } return true ;


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

implementation:
if ( value instanceof Collection ) { final Collection collection = ( Collection ) value ; final char [ ] target = new char [ 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 < Character > charArrayList = new ArrayList < > ( ) ; for ( final Object element : iterable ) { final char convertedValue = convertType ( element ) ; charArrayList . add ( Character . valueOf ( convertedValue ) ) ; } final char [ ] array = new char [ charArrayList . size ( ) ] ; for ( int i = 0 ; i < charArrayList . size ( ) ; i ++ ) { final Character c = charArrayList . get ( i ) ; array [ i ] = c . charValue ( ) ; } return array ; } if ( value instanceof CharSequence ) { final CharSequence charSequence = ( CharSequence ) value ; final char [ ] result = new char [ charSequence . length ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = charSequence . charAt ( i ) ; } return result ; } // everything else :
return convertToSingleElementArray ( value ) ;


signature:
public class ServletUtil { /** * Returns < code > true < / code > if a request is multi - part request . */
public static boolean isMultipartRequest ( final HttpServletRequest request ) { } }

implementation: String type = request . getHeader ( HEADER_CONTENT_TYPE ) ; return ( type != null ) && type . startsWith ( TYPE_MULTIPART_FORM_DATA ) ;


signature:
public class ServletUtil { /** * Decodes the " Authorization " header and retrieves the
 * user ' s name from it . Returns < code > null < / code > if the header is not present . */
public static String resolveAuthUsername ( final HttpServletRequest request ) { } }

implementation: String header = request . getHeader ( HEADER_AUTHORIZATION ) ; if ( header == null ) { return null ; } if ( ! header . contains ( "Basic " ) ) { return null ; } final String encoded = header . substring ( header . indexOf ( ' ' ) + 1 ) ; final String decoded = new String ( Base64 . decode ( encoded ) ) ; return decoded . substring ( 0 , decoded . indexOf ( ':' ) ) ;


signature:
public class ServletUtil { /** * Returns Bearer token . */
public static String resolveAuthBearerToken ( final HttpServletRequest request ) { } }

implementation: String header = request . getHeader ( HEADER_AUTHORIZATION ) ; if ( header == null ) { return null ; } int ndx = header . indexOf ( "Bearer " ) ; if ( ndx == - 1 ) { return null ; } return header . substring ( ndx + 7 ) . trim ( ) ;


signature:
public class ServletUtil { /** * Sends correct headers to require basic authentication for the given realm . */
public static void requireAuthentication ( final HttpServletResponse resp , final String realm ) throws IOException { } }

implementation: resp . setHeader ( WWW_AUTHENTICATE , "Basic realm=\"" + realm + '\"' ) ; resp . sendError ( HttpServletResponse . SC_UNAUTHORIZED ) ;


signature:
public class ServletUtil { /** * Prepares response for file download with provided mime type . */
public static void prepareDownload ( final HttpServletResponse response , final File file , final String mimeType ) { } }

implementation: if ( ! file . exists ( ) ) { throw new IllegalArgumentException ( "File not found: " + file ) ; } if ( file . length ( ) > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "File too big: " + file ) ; } prepareResponse ( response , file . getAbsolutePath ( ) , mimeType , ( int ) file . length ( ) ) ;


signature:
public class ServletUtil { /** * Prepares response for various provided data .
 * @ param response http response
 * @ param fileName file name , if full path then file name will be stripped , if null , will be ignored .
 * @ param mimeType mime type with optional charset , may be < code > null < / code >
 * @ param fileSize if less then 0 it will be ignored */
public static void prepareResponse ( final HttpServletResponse response , final String fileName , String mimeType , final int fileSize ) { } }

implementation:
if ( ( mimeType == null ) && ( fileName != null ) ) { String extension = FileNameUtil . getExtension ( fileName ) ; mimeType = MimeTypes . getMimeType ( extension ) ; } if ( mimeType != null ) { response . setContentType ( mimeType ) ; } if ( fileSize >= 0 ) { response . setContentLength ( fileSize ) ; } // support internationalization
// See https : / / tools . ietf . org / html / rfc6266 # section - 5 for more information .
if ( fileName != null ) { String name = FileNameUtil . getName ( fileName ) ; String encodedFileName = URLCoder . encode ( name ) ; response . setHeader ( CONTENT_DISPOSITION , "attachment;filename=\"" + name + "\";filename*=utf8''" + encodedFileName ) ; }


signature:
public class ServletUtil { /** * Returns all cookies from client that matches provided name .
 * @ see # getCookie ( javax . servlet . http . HttpServletRequest , String ) */
public static Cookie [ ] getAllCookies ( final HttpServletRequest request , final String cookieName ) { } }

implementation: Cookie [ ] cookies = request . getCookies ( ) ; if ( cookies == null ) { return null ; } ArrayList < Cookie > list = new ArrayList < > ( cookies . length ) ; for ( Cookie cookie : cookies ) { if ( cookie . getName ( ) . equals ( cookieName ) ) { list . add ( cookie ) ; } } if ( list . isEmpty ( ) ) { return null ; } return list . toArray ( new Cookie [ 0 ] ) ;


signature:
public class ServletUtil { /** * Reads HTTP request body using the request reader . Once body is read ,
 * it cannot be read again ! */
public static String readRequestBodyFromReader ( final HttpServletRequest request ) throws IOException { } }

implementation: BufferedReader buff = request . getReader ( ) ; StringWriter out = new StringWriter ( ) ; StreamUtil . copy ( buff , out ) ; return out . toString ( ) ;


signature:
public class ServletUtil { /** * Reads HTTP request body using the request stream . Once body is read ,
 * it cannot be read again ! */
public static String readRequestBodyFromStream ( final HttpServletRequest request ) throws IOException { } }

implementation: String charEncoding = request . getCharacterEncoding ( ) ; if ( charEncoding == null ) { charEncoding = JoddCore . encoding ; } CharArrayWriter charArrayWriter = new CharArrayWriter ( ) ; BufferedReader bufferedReader = null ; try { InputStream inputStream = request . getInputStream ( ) ; if ( inputStream != null ) { bufferedReader = new BufferedReader ( new InputStreamReader ( inputStream , charEncoding ) ) ; StreamUtil . copy ( bufferedReader , charArrayWriter ) ; } else { return StringPool . EMPTY ; } } finally { StreamUtil . close ( bufferedReader ) ; } return charArrayWriter . toString ( ) ;


signature:
public class ServletUtil { /** * Returns correct context path , as by Servlet definition . Different
 * application servers return all variants : " " , null , " / " .
 * The context path always comes first in a request URI . The path
 * starts with a " / " character but does not end with a " / " character .
 * For servlets in the default ( root ) context , this method returns " " . */
public static String getContextPath ( final HttpServletRequest request ) { } }

implementation: String contextPath = request . getContextPath ( ) ; if ( contextPath == null || contextPath . equals ( StringPool . SLASH ) ) { contextPath = StringPool . EMPTY ; } return contextPath ;


signature:
public class ServletUtil { /** * Returns correct context path , as by Servlet definition . Different
 * application servers return all variants : " " , null , " / " .
 * The context path always comes first in a request URI . The path
 * starts with a " / " character but does not end with a " / " character .
 * For servlets in the default ( root ) context , this method returns " " . */
public static String getContextPath ( final ServletContext servletContext ) { } }

implementation: String contextPath = servletContext . getContextPath ( ) ; if ( contextPath == null || contextPath . equals ( StringPool . SLASH ) ) { contextPath = StringPool . EMPTY ; } return contextPath ;


signature:
public class ServletUtil { /** * Stores context path in server context and request scope . */
public static void storeContextPath ( final PageContext pageContext , final String contextPathVariableName ) { } }

implementation: String ctxPath = getContextPath ( pageContext ) ; HttpServletRequest request = ( HttpServletRequest ) pageContext . getRequest ( ) ; request . setAttribute ( contextPathVariableName , ctxPath ) ; ServletContext servletContext = pageContext . getServletContext ( ) ; servletContext . setAttribute ( contextPathVariableName , ctxPath ) ;


signature:
public class ServletUtil { /** * Stores context path in page context and request scope . */
public static void storeContextPath ( final ServletContext servletContext , final String contextPathVariableName ) { } }

implementation: String ctxPath = getContextPath ( servletContext ) ; servletContext . setAttribute ( contextPathVariableName , ctxPath ) ;


signature:
public class ServletUtil { /** * Returns non - < code > null < / code > attribute value . Scopes are examined in the
 * following order : request , session , application . */
public static Object attribute ( final HttpServletRequest request , final String name ) { } }

implementation: Object value = request . getAttribute ( name ) ; if ( value != null ) { return value ; } value = request . getSession ( ) . getAttribute ( name ) ; if ( value != null ) { return value ; } return request . getServletContext ( ) . getAttribute ( name ) ;


signature:
public class ServletUtil { /** * Returns value of property / attribute . The following value sets are looked up :
 * < ul >
 * < li > page context attributes < / li >
 * < li > request attributes < / li >
 * < li > request parameters ( multi - part request detected ) < / li >
 * < li > session attributes < / li >
 * < li > context attributes < / li >
 * < / ul > */
public static Object value ( final PageContext pageContext , final String name ) { } }

implementation: Object value = pageContext . getAttribute ( name ) ; if ( value != null ) { return value ; } return value ( ( HttpServletRequest ) pageContext . getRequest ( ) , name ) ;


signature:
public class ServletUtil { /** * Returns value of property / attribute . The following value sets are looked up :
 * < ul >
 * < li > request attributes < / li >
 * < li > request parameters ( multi - part request detected ) < / li >
 * < li > session attributes < / li >
 * < li > context attributes < / li >
 * < / ul > */
public static Object value ( final HttpServletRequest request , final String name ) { } }

implementation: Object value = request . getAttribute ( name ) ; if ( value != null ) { return value ; } if ( isMultipartRequest ( request ) ) { try { MultipartRequest multipartRequest = MultipartRequest . getInstance ( request ) ; value = multipartRequest . getParameter ( name ) ; } catch ( IOException ignore ) { } } else { String [ ] params = request . getParameterValues ( name ) ; if ( params != null ) { if ( params . length == 1 ) { value = params [ 0 ] ; } else { value = params ; } } } if ( value != null ) { return value ; } value = request . getSession ( ) . getAttribute ( name ) ; if ( value != null ) { return value ; } return request . getServletContext ( ) . getAttribute ( name ) ;


signature:
public class ServletUtil { /** * Sets scope attribute . */
public static void setScopeAttribute ( final String name , final Object value , final String scope , final PageContext pageContext ) { } }

implementation: HttpServletRequest request = ( HttpServletRequest ) pageContext . getRequest ( ) ; String scopeValue = scope != null ? scope . toLowerCase ( ) : SCOPE_PAGE ; if ( scopeValue . equals ( SCOPE_PAGE ) ) { pageContext . setAttribute ( name , value ) ; } else if ( scopeValue . equals ( SCOPE_REQUEST ) ) { request . setAttribute ( name , value ) ; } else if ( scopeValue . equals ( SCOPE_SESSION ) ) { request . getSession ( ) . setAttribute ( name , value ) ; } else if ( scopeValue . equals ( SCOPE_APPLICATION ) ) { request . getServletContext ( ) . setAttribute ( name , value ) ; } else { throw new IllegalArgumentException ( "Invalid scope: " + scope ) ; }


signature:
public class ServletUtil { /** * Removes scope attribute . */
public static void removeScopeAttribute ( final String name , final String scope , final PageContext pageContext ) { } }

implementation: HttpServletRequest request = ( HttpServletRequest ) pageContext . getRequest ( ) ; String scopeValue = scope != null ? scope . toLowerCase ( ) : SCOPE_PAGE ; if ( scopeValue . equals ( SCOPE_PAGE ) ) { pageContext . removeAttribute ( name ) ; } else if ( scopeValue . equals ( SCOPE_REQUEST ) ) { request . removeAttribute ( name ) ; } else if ( scopeValue . equals ( SCOPE_SESSION ) ) { request . getSession ( ) . removeAttribute ( name ) ; } else if ( scopeValue . equals ( SCOPE_APPLICATION ) ) { request . getServletContext ( ) . removeAttribute ( name ) ; } else { throw new IllegalArgumentException ( "Invalid scope: " + scope ) ; }


signature:
public class ServletUtil { /** * Returns < code > true < / code > if current URL is absolute , < code > false < / code > otherwise . */
public static boolean isAbsoluteUrl ( final String url ) { } }

implementation:
if ( url == null ) { // a null URL is not absolute
return false ; } int colonPos ; // fast simple check first
if ( ( colonPos = url . indexOf ( ':' ) ) == - 1 ) { return false ; } // if we DO have a colon , make sure that every character
// leading up to it is a valid scheme character
for ( int i = 0 ; i < colonPos ; i ++ ) { if ( VALID_SCHEME_CHARS . indexOf ( url . charAt ( i ) ) == - 1 ) { return false ; } } return true ;


signature:
public class ServletUtil { /** * Strips a servlet session ID from < code > url < / code > . The session ID
 * is encoded as a URL " path parameter " beginning with " jsessionid = " .
 * We thus remove anything we find between " ; jsessionid = " ( inclusive )
 * and either EOS or a subsequent ' ; ' ( exclusive ) . */
public static String stripSessionId ( final String url ) { } }

implementation: StringBuilder u = new StringBuilder ( url ) ; int sessionStart ; while ( ( sessionStart = u . toString ( ) . indexOf ( ";jsessionid=" ) ) != - 1 ) { int sessionEnd = u . toString ( ) . indexOf ( ';' , sessionStart + 1 ) ; if ( sessionEnd == - 1 ) { sessionEnd = u . toString ( ) . indexOf ( '?' , sessionStart + 1 ) ; } if ( sessionEnd == - 1 ) { sessionEnd = u . length ( ) ; } u . delete ( sessionStart , sessionEnd ) ; } return u . toString ( ) ;


signature:
public class ServletUtil { /** * Returns HTTP request parameter as String or String [ ] . */
public static Object getRequestParameter ( final ServletRequest request , final String name ) { } }

implementation: String [ ] values = request . getParameterValues ( name ) ; if ( values == null ) { return null ; } if ( values . length == 1 ) { return values [ 0 ] ; } return values ;


signature:
public class ServletUtil { /** * Checks if some parameter is in GET parameters . */
public boolean isGetParameter ( final HttpServletRequest request , String name ) { } }

implementation: name = URLCoder . encodeQueryParam ( name ) + '=' ; String query = request . getQueryString ( ) ; String [ ] nameValuePairs = StringUtil . splitc ( query , '&' ) ; for ( String nameValuePair : nameValuePairs ) { if ( nameValuePair . startsWith ( name ) ) { return true ; } } return false ;


signature:
public class ServletUtil { /** * Prepares parameters for further processing .
 * @ param paramValuesstring array of param values
 * @ param treatEmptyParamsAsNullempty parameters should be treated as < code > null < / code >
 * @ param ignoreEmptyRequestParamsif all parameters are empty , return < code > null < / code > */
public static String [ ] prepareParameters ( final String [ ] paramValues , final boolean treatEmptyParamsAsNull , final boolean ignoreEmptyRequestParams ) { } }

implementation: if ( treatEmptyParamsAsNull || ignoreEmptyRequestParams ) { int emptyCount = 0 ; int total = paramValues . length ; for ( int i = 0 ; i < paramValues . length ; i ++ ) { String paramValue = paramValues [ i ] ; if ( paramValue == null ) { emptyCount ++ ; continue ; } if ( paramValue . length ( ) == 0 ) { emptyCount ++ ; if ( treatEmptyParamsAsNull ) { paramValue = null ; } } paramValues [ i ] = paramValue ; } if ( ( ignoreEmptyRequestParams ) && ( emptyCount == total ) ) { return null ; } } return paramValues ;


signature:
public class ServletUtil { /** * Returns { @ code true } if request has JSON content type . */
public static boolean isJsonRequest ( HttpServletRequest servletRequest ) { } }

implementation: final String contentType = servletRequest . getContentType ( ) ; if ( contentType == null ) { return false ; } return contentType . equals ( MimeTypes . MIME_APPLICATION_JSON ) ;


signature:
public class ServletUtil { /** * Copies all request parameters to attributes . */
public static void copyParamsToAttributes ( final HttpServletRequest servletRequest , final boolean treatEmptyParamsAsNull , final boolean ignoreEmptyRequestParams ) { } }

implementation:
Enumeration paramNames = servletRequest . getParameterNames ( ) ; while ( paramNames . hasMoreElements ( ) ) { String paramName = ( String ) paramNames . nextElement ( ) ; if ( servletRequest . getAttribute ( paramName ) != null ) { continue ; } String [ ] paramValues = servletRequest . getParameterValues ( paramName ) ; paramValues = prepareParameters ( paramValues , treatEmptyParamsAsNull , ignoreEmptyRequestParams ) ; if ( paramValues == null ) { continue ; } servletRequest . setAttribute ( paramName , paramValues . length == 1 ? paramValues [ 0 ] : paramValues ) ; } // multipart
if ( ! ( servletRequest instanceof MultipartRequestWrapper ) ) { return ; } MultipartRequestWrapper multipartRequest = ( MultipartRequestWrapper ) servletRequest ; if ( ! multipartRequest . isMultipart ( ) ) { return ; } paramNames = multipartRequest . getFileParameterNames ( ) ; while ( paramNames . hasMoreElements ( ) ) { String paramName = ( String ) paramNames . nextElement ( ) ; if ( servletRequest . getAttribute ( paramName ) != null ) { continue ; } FileUpload [ ] paramValues = multipartRequest . getFiles ( paramName ) ; servletRequest . setAttribute ( paramName , paramValues . length == 1 ? paramValues [ 0 ] : paramValues ) ; }


signature:
public class TagUtil { /** * Invokes tag body . */
public static void invokeBody ( final JspFragment body ) throws JspException { } }

implementation: if ( body == null ) { return ; } try { body . invoke ( null ) ; } catch ( IOException ioex ) { throw new JspException ( "Tag body failed" , ioex ) ; }


signature:
public class TagUtil { /** * Renders tag body to char array . */
public static char [ ] renderBody ( final JspFragment body ) throws JspException { } }

implementation: FastCharArrayWriter writer = new FastCharArrayWriter ( ) ; invokeBody ( body , writer ) ; return writer . toCharArray ( ) ;


signature:
public class TagUtil { /** * Renders tag body to string .
 * @ see # renderBody ( javax . servlet . jsp . tagext . JspFragment ) */
public static String renderBodyToString ( final JspFragment body ) throws JspException { } }

implementation: char [ ] result = renderBody ( body ) ; return new String ( result ) ;


signature:
public class TagUtil { /** * Sets scope attribute . */
public static void setScopeAttribute ( final String name , final Object value , final String scope , final PageContext pageContext ) throws JspException { } }

implementation: try { ServletUtil . setScopeAttribute ( name , value , scope , pageContext ) ; } catch ( UncheckedException uex ) { throw new JspException ( uex ) ; }


signature:
public class TagUtil { /** * Removes scope attribute . */
public static void removeScopeAttribute ( final String name , final String scope , final PageContext pageContext ) throws JspException { } }

implementation: try { ServletUtil . removeScopeAttribute ( name , scope , pageContext ) ; } catch ( UncheckedException uex ) { throw new JspException ( uex ) ; }


signature:
public class BeanData { /** * Invokes init methods . */
public void invokeInitMethods ( final InitMethodInvocationStrategy invocationStrategy ) { } }

implementation: for ( final InitMethodPoint initMethod : beanDefinition . initMethodPoints ( ) ) { if ( invocationStrategy != initMethod . invocationStrategy ) { continue ; } try { initMethod . method . invoke ( bean ) ; } catch ( Exception ex ) { throw new PetiteException ( "Invalid init method: " + initMethod , ex ) ; } }


signature:
public class BeanData { /** * Calls destroy methods on given BeanData . Destroy methods are called
 * without any order . */
public void callDestroyMethods ( ) { } }

implementation: for ( final DestroyMethodPoint destroyMethodPoint : beanDefinition . destroyMethodPoints ( ) ) { try { destroyMethodPoint . method . invoke ( bean ) ; } catch ( Exception ex ) { throw new PetiteException ( "Invalid destroy method: " + destroyMethodPoint . method , ex ) ; } }


signature:
public class BeanData { /** * Creates a new instance . */
public Object newBeanInstance ( ) { } }

implementation:
if ( beanDefinition . ctor == CtorInjectionPoint . EMPTY ) { throw new PetiteException ( "No constructor (annotated, single or default) founded as injection point for: " + beanDefinition . type . getName ( ) ) ; } int paramNo = beanDefinition . ctor . references . length ; Object [ ] args = new Object [ paramNo ] ; // wiring
if ( beanDefinition . wiringMode != WiringMode . NONE ) { for ( int i = 0 ; i < paramNo ; i ++ ) { args [ i ] = pc . getBean ( beanDefinition . ctor . references [ i ] ) ; if ( args [ i ] == null ) { if ( ( beanDefinition . wiringMode == WiringMode . STRICT ) ) { throw new PetiteException ( "Wiring constructor failed. References '" + beanDefinition . ctor . references [ i ] + "' not found for constructor: " + beanDefinition . ctor . constructor ) ; } } } } // create instance
final Object bean ; try { bean = beanDefinition . ctor . constructor . newInstance ( args ) ; } catch ( Exception ex ) { throw new PetiteException ( "Failed to create new bean instance '" + beanDefinition . type . getName ( ) + "' using constructor: " + beanDefinition . ctor . constructor , ex ) ; } return bean ;


signature:
public class BeanData { /** * Injects all parameters . */
public void injectParams ( final ParamManager paramManager , final boolean implicitParamInjection ) { } }

implementation:
if ( beanDefinition . name == null ) { return ; } if ( implicitParamInjection ) { // implicit
final int len = beanDefinition . name . length ( ) + 1 ; for ( final String param : beanDefinition . params ) { final Object value = paramManager . get ( param ) ; final String destination = param . substring ( len ) ; try { BeanUtil . declared . setProperty ( bean , destination , value ) ; } catch ( Exception ex ) { throw new PetiteException ( "Unable to set parameter: '" + param + "' to bean: " + beanDefinition . name , ex ) ; } } } // explicit
for ( final ValueInjectionPoint pip : beanDefinition . values ) { final String value = paramManager . parseKeyTemplate ( pip . valueTemplate ) ; try { BeanUtil . declared . setProperty ( bean , pip . property , value ) ; } catch ( Exception ex ) { throw new PetiteException ( "Unable to set value for: '" + pip . valueTemplate + "' to bean: " + beanDefinition . name , ex ) ; } }


signature:
public class ActionPathRewriter { /** * Rewrites action path . */
@ SuppressWarnings ( { } }

implementation: "UnusedDeclaration" } ) public String rewrite ( final HttpServletRequest servletRequest , final String actionPath , final String httpMethod ) { return actionPath ;


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

implementation: this . substring = annotation . value ( ) ; this . ignoreCase = annotation . ignoreCase ( ) ;


signature:
public class HasSubstringConstraint { /** * - - - - - valid */
@ Override public boolean isValid ( final ValidationConstraintContext vcc , final Object value ) { } }

implementation: return validate ( value , substring , ignoreCase ) ;


signature:
public class HeadersMultiMap { /** * Adds new header value . If existing value exist , it will be removed
 * so the store the new key value . */
public void addHeader ( final String name , final String value ) { } }

implementation: List < String > valuesList = super . getAll ( name ) ; if ( valuesList . isEmpty ( ) ) { super . add ( name , value ) ; return ; } super . remove ( name ) ; valuesList . add ( value ) ; super . addAll ( name , valuesList ) ;


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

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


signature:
public class LengthConstraint { /** * - - - - - valid */
@ Override public boolean isValid ( final ValidationConstraintContext vcc , final Object value ) { } }

implementation: return validate ( value , min , max ) ;


signature:
public class PropsData { /** * Puts key - value pair into the map , with respect of appending duplicate properties */
protected void put ( final String profile , final Map < String , PropsEntry > map , final String key , final String value , final boolean append ) { } }

implementation:
String realValue = value ; if ( append || appendDuplicateProps ) { PropsEntry pv = map . get ( key ) ; if ( pv != null ) { realValue = pv . value + APPEND_SEPARATOR + realValue ; } } PropsEntry propsEntry = new PropsEntry ( key , realValue , profile , this ) ; // update position pointers
if ( first == null ) { first = propsEntry ; } else { last . next = propsEntry ; } last = propsEntry ; // add to the map
map . put ( key , propsEntry ) ;


signature:
public class PropsData { /** * Adds base property . */
public void putBaseProperty ( final String key , final String value , final boolean append ) { } }

implementation: put ( null , baseProperties , key , value , append ) ;


signature:
public class PropsData { /** * Counts profile properties . Note : this method is not
 * that easy on execution . */
public int countProfileProperties ( ) { } }

implementation: final HashSet < String > profileKeys = new HashSet < > ( ) ; for ( final Map < String , PropsEntry > map : profileProperties . values ( ) ) { for ( final String key : map . keySet ( ) ) { if ( ! baseProperties . containsKey ( key ) ) { profileKeys . add ( key ) ; } } } return profileKeys . size ( ) ;


signature:
public class PropsData { /** * Adds profile property . */
public void putProfileProperty ( final String key , final String value , final String profile , final boolean append ) { } }

implementation: Map < String , PropsEntry > map = profileProperties . computeIfAbsent ( profile , k -> new HashMap < > ( ) ) ; put ( profile , map , key , value , append ) ;


signature:
public class PropsData { /** * Returns profile property . */
public PropsEntry getProfileProperty ( final String profile , final String key ) { } }

implementation: final Map < String , PropsEntry > profileMap = profileProperties . get ( profile ) ; if ( profileMap == null ) { return null ; } return profileMap . get ( key ) ;


signature:
public class PropsData { /** * Lookup props value through profiles and base properties .
 * Returns { @ code null } if value not found . */
protected String lookupValue ( final String key , final String ... profiles ) { } }

implementation:
if ( profiles != null ) { for ( String profile : profiles ) { if ( profile == null ) { continue ; } while ( true ) { final Map < String , PropsEntry > profileMap = this . profileProperties . get ( profile ) ; if ( profileMap != null ) { final PropsEntry value = profileMap . get ( key ) ; if ( value != null ) { return value . getValue ( profiles ) ; } } // go back with profile
final int ndx = profile . lastIndexOf ( '.' ) ; if ( ndx == - 1 ) { break ; } profile = profile . substring ( 0 , ndx ) ; } } } final PropsEntry value = getBaseProperty ( key ) ; if ( value == null ) { return null ; } return value . getValue ( profiles ) ;


signature:
public class PropsData { /** * Resolves all macros in this props set . Called on property lookup . */
public String resolveMacros ( String value , final String ... profiles ) { } }

implementation:
// create string template parser that will be used internally
StringTemplateParser stringTemplateParser = new StringTemplateParser ( ) ; stringTemplateParser . setResolveEscapes ( false ) ; if ( ! ignoreMissingMacros ) { stringTemplateParser . setReplaceMissingKey ( false ) ; } else { stringTemplateParser . setReplaceMissingKey ( true ) ; stringTemplateParser . setMissingKeyReplacement ( StringPool . EMPTY ) ; } final Function < String , String > macroResolver = macroName -> { String [ ] lookupProfiles = profiles ; int leftIndex = macroName . indexOf ( '<' ) ; if ( leftIndex != - 1 ) { int rightIndex = macroName . indexOf ( '>' ) ; String profiles1 = macroName . substring ( leftIndex + 1 , rightIndex ) ; macroName = macroName . substring ( 0 , leftIndex ) . concat ( macroName . substring ( rightIndex + 1 ) ) ; lookupProfiles = StringUtil . splitc ( profiles1 , ',' ) ; StringUtil . trimAll ( lookupProfiles ) ; } return lookupValue ( macroName , lookupProfiles ) ; } ; // start parsing
int loopCount = 0 ; while ( loopCount ++ < MAX_INNER_MACROS ) { final String newValue = stringTemplateParser . parse ( value , macroResolver ) ; if ( newValue . equals ( value ) ) { break ; } if ( skipEmptyProps ) { if ( newValue . length ( ) == 0 ) { return null ; } } value = newValue ; } return value ;


signature:
public class PropsData { /** * Extracts props to target map . This is all - in - one method , that does many things at once . */
public Map extract ( Map target , final String [ ] profiles , final String [ ] wildcardPatterns , String prefix ) { } }

implementation:
if ( target == null ) { target = new HashMap ( ) ; } // make sure prefix ends with a dot
if ( prefix != null ) { if ( ! StringUtil . endsWithChar ( prefix , '.' ) ) { prefix += StringPool . DOT ; } } if ( profiles != null ) { for ( String profile : profiles ) { while ( true ) { final Map < String , PropsEntry > map = this . profileProperties . get ( profile ) ; if ( map != null ) { extractMap ( target , map , profiles , wildcardPatterns , prefix ) ; } final int ndx = profile . lastIndexOf ( '.' ) ; if ( ndx == - 1 ) { break ; } profile = profile . substring ( 0 , ndx ) ; } } } extractMap ( target , this . baseProperties , profiles , wildcardPatterns , prefix ) ; return target ;


signature:
public class BCrypt { /** * Cycically extract a word of key material .
 * @ param data the string to extract the data from
 * @ param offp a " pointer " ( as a one - entry array ) to the
 * current offset into data
 * @ return the next word of material from data */
private static int streamtoword ( byte [ ] data , int [ ] offp ) { } }

implementation: int i ; int word = 0 ; int off = offp [ 0 ] ; for ( i = 0 ; i < 4 ; i ++ ) { word = ( word << 8 ) | ( data [ off ] & 0xff ) ; off = ( off + 1 ) % data . length ; } offp [ 0 ] = off ; return word ;


signature:
public class BCrypt { /** * Hash a password using the OpenBSD bcrypt scheme .
 * @ param password the password to hash
 * @ param salt the salt to hash with ( perhaps generated
 * using BCrypt . gensalt )
 * @ return the hashed password */
public static String hashpw ( String password , String salt ) { } }

implementation:
BCrypt B ; String real_salt ; byte [ ] passwordb , saltb , hashed ; char minor = ( char ) 0 ; int rounds , off ; StringBuffer rs = new StringBuffer ( ) ; if ( salt . charAt ( 0 ) != '$' || salt . charAt ( 1 ) != '2' ) { throw new IllegalArgumentException ( "Invalid salt version" ) ; } if ( salt . charAt ( 2 ) == '$' ) { off = 3 ; } else { minor = salt . charAt ( 2 ) ; if ( minor != 'a' || salt . charAt ( 3 ) != '$' ) { throw new IllegalArgumentException ( "Invalid salt revision" ) ; } off = 4 ; } // Extract number of rounds
if ( salt . charAt ( off + 2 ) > '$' ) { throw new IllegalArgumentException ( "Missing salt rounds" ) ; } rounds = Integer . parseInt ( salt . substring ( off , off + 2 ) ) ; real_salt = salt . substring ( off + 3 , off + 25 ) ; try { passwordb = ( password + ( minor >= 'a' ? "\000" : "" ) ) . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { throw new AssertionError ( "UTF-8 is not supported" ) ; } saltb = decode_base64 ( real_salt , BCRYPT_SALT_LEN ) ; B = new BCrypt ( ) ; hashed = B . crypt_raw ( passwordb , saltb , rounds , ( int [ ] ) bf_crypt_ciphertext . clone ( ) ) ; rs . append ( "$2" ) ; if ( minor >= 'a' ) { rs . append ( minor ) ; } rs . append ( '$' ) ; if ( rounds < 10 ) { rs . append ( '0' ) ; } if ( rounds > 30 ) { throw new IllegalArgumentException ( "rounds exceeds maximum (30)" ) ; } rs . append ( rounds ) . append ( '$' ) . append ( encode_base64 ( saltb , saltb . length ) ) . append ( encode_base64 ( hashed , bf_crypt_ciphertext . length * 4 - 1 ) ) ; return rs . toString ( ) ;


signature:
public class BCrypt { /** * Check that a plaintext password matches a previously hashed
 * one .
 * @ param plaintext the plaintext password to verify
 * @ param hashed the previously - hashed password
 * @ return true if the passwords match , false otherwise */
public static boolean checkpw ( String plaintext , String hashed ) { } }

implementation: byte [ ] hashed_bytes ; byte [ ] try_bytes ; try { String try_pw = hashpw ( plaintext , hashed ) ; hashed_bytes = hashed . getBytes ( "UTF-8" ) ; try_bytes = try_pw . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { return false ; } if ( hashed_bytes . length != try_bytes . length ) { return false ; } byte ret = 0 ; for ( int i = 0 ; i < try_bytes . length ; i ++ ) { ret |= hashed_bytes [ i ] ^ try_bytes [ i ] ; } return ret == 0 ;


signature:
public class MultipartRequestInputStream { /** * Reads data header from the input stream . When there is no more
 * headers ( i . e . end of stream reached ) , returns < code > null < / code > */
public FileUploadHeader readDataHeader ( final String encoding ) throws IOException { } }

implementation: String dataHeader = readDataHeaderString ( encoding ) ; if ( dataHeader != null ) { lastHeader = new FileUploadHeader ( dataHeader ) ; } else { lastHeader = null ; } return lastHeader ;


signature:
public class MultipartRequestInputStream { /** * Copies bytes from this stream to some output until boundary is
 * reached . Returns number of copied bytes . It will throw an exception
 * for any irregular behaviour . */
public int copyAll ( final OutputStream out ) throws IOException { } }

implementation: int count = 0 ; while ( true ) { byte b = readByte ( ) ; if ( isBoundary ( b ) ) { break ; } out . write ( b ) ; count ++ ; } return count ;


signature:
public class MultipartRequestInputStream { /** * Copies max or less number of bytes to output stream . Useful for determining
 * if uploaded file is larger then expected . */
public int copyMax ( final OutputStream out , final int maxBytes ) throws IOException { } }

implementation: int count = 0 ; while ( true ) { byte b = readByte ( ) ; if ( isBoundary ( b ) ) { break ; } out . write ( b ) ; count ++ ; if ( count == maxBytes ) { return count ; } } return count ;


signature:
public class ActionMethodParser { /** * Parses action class and method and creates { @ link ActionDefinition parsed action definition } . */
public ActionDefinition parseActionDefinition ( final Class < ? > actionClass , final Method actionMethod ) { } }

implementation: final ActionAnnotationValues annotationValues = detectActionAnnotationValues ( actionMethod ) ; final ActionConfig actionConfig = resolveActionConfig ( annotationValues ) ; final String [ ] packageActionNames = readPackageActionPath ( actionClass ) ; final String [ ] classActionNames = readClassActionPath ( actionClass ) ; final String [ ] methodActionNames = readMethodActionPath ( actionMethod . getName ( ) , annotationValues , actionConfig ) ; final String method = readMethodHttpMethod ( actionMethod ) ; final ActionNames actionNames = new ActionNames ( packageActionNames , classActionNames , methodActionNames , method ) ; final ActionNamingStrategy namingStrategy ; try { namingStrategy = ClassUtil . newInstance ( actionConfig . getNamingStrategy ( ) ) ; contextInjectorComponent . injectContext ( namingStrategy ) ; } catch ( Exception ex ) { throw new MadvocException ( ex ) ; } return namingStrategy . buildActionDef ( actionClass , actionMethod , actionNames ) ;


signature:
public class ActionMethodParser { /** * Parses java action method annotation and returns its action runtime .
 * @ param actionClass action class
 * @ param actionMethod action method
 * @ param actionDefinition optional action def , usually < code > null < / code > so to be parsed */
public ActionRuntime parse ( final Class < ? > actionClass , final Method actionMethod , ActionDefinition actionDefinition ) { } }

implementation:
final ActionAnnotationValues annotationValues = detectActionAnnotationValues ( actionMethod ) ; final ActionConfig actionConfig = resolveActionConfig ( annotationValues ) ; // interceptors
ActionInterceptor [ ] actionInterceptors = parseActionInterceptors ( actionClass , actionMethod , actionConfig ) ; // filters
ActionFilter [ ] actionFilters = parseActionFilters ( actionClass , actionMethod , actionConfig ) ; // build action definition when not provided
if ( actionDefinition == null ) { actionDefinition = parseActionDefinition ( actionClass , actionMethod ) ; } detectAndRegisterAlias ( annotationValues , actionDefinition ) ; final boolean async = parseMethodAsyncFlag ( actionMethod ) ; final boolean auth = parseMethodAuthFlag ( actionMethod ) ; final Class < ? extends ActionResult > actionResult = parseActionResult ( actionMethod ) ; final Class < ? extends ActionResult > defaultActionResult = actionConfig . getActionResult ( ) ; return createActionRuntime ( null , actionClass , actionMethod , actionResult , defaultActionResult , actionFilters , actionInterceptors , actionDefinition , async , auth ) ;


signature:
public class ActionMethodParser { /** * Resolves action config . */
protected ActionConfig resolveActionConfig ( final ActionAnnotationValues annotationValues ) { } }

implementation: final Class < ? extends Annotation > annotationType ; if ( annotationValues == null ) { annotationType = Action . class ; } else { annotationType = annotationValues . annotationType ( ) ; } return actionConfigManager . lookup ( annotationType ) ;


signature:
public class ActionMethodParser { /** * Detects if alias is defined in annotation and registers it if so . */
protected void detectAndRegisterAlias ( final ActionAnnotationValues annotationValues , final ActionDefinition actionDefinition ) { } }

implementation: final String alias = parseMethodAlias ( annotationValues ) ; if ( alias != null ) { String aliasPath = StringUtil . cutToIndexOf ( actionDefinition . actionPath ( ) , StringPool . HASH ) ; actionsManager . registerPathAlias ( alias , aliasPath ) ; }


signature:
public class ActionMethodParser { /** * Reads class or method annotation for action interceptors . */
protected Class < ? extends ActionInterceptor > [ ] readActionInterceptors ( final AnnotatedElement actionClassOrMethod ) { } }

implementation: Class < ? extends ActionInterceptor > [ ] result = null ; InterceptedBy interceptedBy = actionClassOrMethod . getAnnotation ( InterceptedBy . class ) ; if ( interceptedBy != null ) { result = interceptedBy . value ( ) ; if ( result . length == 0 ) { result = null ; } } return result ;


signature:
public class ActionMethodParser { /** * Reads class or method annotation for action filters . */
protected Class < ? extends ActionFilter > [ ] readActionFilters ( final AnnotatedElement actionClassOrMethod ) { } }

implementation: Class < ? extends ActionFilter > [ ] result = null ; FilteredBy filteredBy = actionClassOrMethod . getAnnotation ( FilteredBy . class ) ; if ( filteredBy != null ) { result = filteredBy . value ( ) ; if ( result . length == 0 ) { result = null ; } } return result ;


signature:
public class ActionMethodParser { /** * Reads action path for package .
 * If annotation is not set on package - level , class package will be used for
 * package action path part . */
protected String [ ] readPackageActionPath ( final Class actionClass ) { } }

implementation:
Package actionPackage = actionClass . getPackage ( ) ; final String actionPackageName = actionPackage . getName ( ) ; // 1 - read annotations first
String packageActionPathFromAnnotation ; mainloop : while ( true ) { MadvocAction madvocActionAnnotation = actionPackage . getAnnotation ( MadvocAction . class ) ; packageActionPathFromAnnotation = madvocActionAnnotation != null ? madvocActionAnnotation . value ( ) . trim ( ) : null ; if ( StringUtil . isEmpty ( packageActionPathFromAnnotation ) ) { packageActionPathFromAnnotation = null ; } if ( packageActionPathFromAnnotation == null ) { // next package
String newPackage = actionPackage . getName ( ) ; actionPackage = null ; while ( actionPackage == null ) { final int ndx = newPackage . lastIndexOf ( '.' ) ; if ( ndx == - 1 ) { // end of hierarchy , nothing found
break mainloop ; } newPackage = newPackage . substring ( 0 , ndx ) ; actionPackage = Packages . of ( actionClass . getClassLoader ( ) , newPackage ) ; } } else { // annotation found , register root
rootPackages . addRootPackage ( actionPackage . getName ( ) , packageActionPathFromAnnotation ) ; break ; } } // 2 - read root package
String packagePath = rootPackages . findPackagePathForActionPackage ( actionPackageName ) ; if ( packagePath == null ) { return ArraysUtil . array ( null , null ) ; } return ArraysUtil . array ( StringUtil . stripChar ( packagePath , '/' ) , StringUtil . surround ( packagePath , StringPool . SLASH ) ) ;


signature:
public class ActionMethodParser { /** * Reads action path from class . If the class is annotated with { @ link MadvocAction } annotation ,
 * class action path will be read from annotation value . Otherwise , action class path will be built from the
 * class name . This is done by removing the package name and the last contained word
 * ( if there is more then one ) from the class name . Such name is finally uncapitalized . */
protected String [ ] readClassActionPath ( final Class actionClass ) { } }

implementation:
// read class annotation
MadvocAction madvocActionAnnotation = ( ( Class < ? > ) actionClass ) . getAnnotation ( MadvocAction . class ) ; String classActionPath = madvocActionAnnotation != null ? madvocActionAnnotation . value ( ) . trim ( ) : null ; if ( StringUtil . isEmpty ( classActionPath ) ) { classActionPath = null ; } String actionClassName = actionClass . getSimpleName ( ) ; actionClassName = StringUtil . uncapitalize ( actionClassName ) ; actionClassName = MadvocUtil . stripLastCamelWord ( actionClassName ) ; // removes ' Action ' from the class name
if ( classActionPath == null ) { classActionPath = actionClassName ; } return ArraysUtil . array ( actionClassName , classActionPath ) ;


signature:
public class ActionMethodParser { /** * Reads action path from the action method . */
protected String [ ] readMethodActionPath ( final String methodName , final ActionAnnotationValues annotationValues , final ActionConfig actionConfig ) { } }

implementation:
// read annotation
String methodActionPath = annotationValues != null ? annotationValues . value ( ) : null ; if ( methodActionPath == null ) { methodActionPath = methodName ; } else { if ( methodActionPath . equals ( Action . NONE ) ) { return ArraysUtil . array ( null , null ) ; } } // check for defaults
for ( String path : actionConfig . getActionMethodNames ( ) ) { if ( methodActionPath . equals ( path ) ) { methodActionPath = null ; break ; } } return ArraysUtil . array ( methodName , methodActionPath ) ;


signature:
public class ActionMethodParser { /** * Reads method ' s alias value . */
protected String parseMethodAlias ( final ActionAnnotationValues annotationValues ) { } }

implementation: String alias = null ; if ( annotationValues != null ) { alias = annotationValues . alias ( ) ; } return alias ;


signature:
public class ActionMethodParser { /** * Reads method ' s http method or { @ code null } if not specified . */
private String readMethodHttpMethod ( final Method actionMethod ) { } }

implementation: for ( Class < ? extends Annotation > methodAnnotation : METHOD_ANNOTATIONS ) { if ( actionMethod . getAnnotation ( methodAnnotation ) != null ) { return methodAnnotation . getSimpleName ( ) ; } } return null ;