Input: Returns this node s next <b > element< / b > with the same name . [CODESPLIT] public Node getNextSiblingName ( ) { if ( nodeName == null ) { return null ; } initSiblingNames ( ) ; int index = siblingNameIndex + 1 ; int max = parentNode . getChildNodesCount ( ) ; for ( int i = siblingIndex + 1 ; i < max ; i ++ ) { Node sibling = parentNode . childNodes . get ( i ) ; if ( ( index == sibling . siblingNameIndex ) && nodeName . equals ( sibling . getNodeName ( ) ) ) { return sibling ; } } return null ; }


Input: Returns this node s previous sibling of <b > any< / b > type or <code > null< / code > if this is the first sibling . [CODESPLIT] public Node getPreviousSibling ( ) { List < Node > siblings = parentNode . childNodes ; int index = siblingIndex - 1 ; if ( index < 0 ) { return null ; } return siblings . get ( index ) ; }


Input: Returns this node s previous sibling of <b > element< / b > type or <code > null< / code > if this is the first sibling . [CODESPLIT] public Node getPreviousSiblingElement ( ) { parentNode . initChildElementNodes ( ) ; if ( siblingElementIndex == - 1 ) { for ( int i = siblingIndex - 1 ; i >= 0 ; i -- ) { Node sibling = parentNode . childNodes . get ( i ) ; if ( sibling . getNodeType ( ) == NodeType . ELEMENT ) { return sibling ; } } return null ; } int index = siblingElementIndex - 1 ; if ( index < 0 ) { return null ; } return parentNode . childElementNodes [ index ] ; }


Input: Returns this node s previous sibling element with the same name . [CODESPLIT] public Node getPreviousSiblingName ( ) { if ( nodeName == null ) { return null ; } initSiblingNames ( ) ; int index = siblingNameIndex - 1 ; for ( int i = siblingIndex ; i >= 0 ; i -- ) { Node sibling = parentNode . childNodes . get ( i ) ; if ( ( index == sibling . siblingNameIndex ) && nodeName . equals ( sibling . getNodeName ( ) ) ) { return sibling ; } } return null ; }


Input: Returns the text content of this node and its descendants . [CODESPLIT] public String getTextContent ( ) { StringBuilder sb = new StringBuilder ( getChildNodesCount ( ) + 1 ) ; appendTextContent ( sb ) ; return sb . toString ( ) ; }


Input: Appends the text content to an <code > Appendable< / code > ( <code > StringBuilder< / code > <code > CharBuffer< / code > ... ) . This way we can reuse the <code > Appendable< / code > instance during the creation of text content and have better performances . [CODESPLIT] public void appendTextContent ( final Appendable appendable ) { if ( nodeValue != null ) { if ( ( nodeType == NodeType . TEXT ) || ( nodeType == NodeType . CDATA ) ) { try { appendable . append ( nodeValue ) ; } catch ( IOException ioex ) { throw new LagartoDOMException ( ioex ) ; } } } if ( childNodes != null ) { for ( int i = 0 , childNodesSize = childNodes . size ( ) ; i < childNodesSize ; i ++ ) { Node childNode = childNodes . get ( i ) ; childNode . appendTextContent ( appendable ) ; } } }


Input: Generates HTML . [CODESPLIT] public String getHtml ( ) { LagartoDomBuilderConfig lagartoDomBuilderConfig ; if ( ownerDocument == null ) { lagartoDomBuilderConfig = ( ( Document ) this ) . getConfig ( ) ; } else { lagartoDomBuilderConfig = ownerDocument . getConfig ( ) ; } LagartoHtmlRenderer lagartoHtmlRenderer = lagartoDomBuilderConfig . getLagartoHtmlRenderer ( ) ; return lagartoHtmlRenderer . toHtml ( this , new StringBuilder ( ) ) ; }


Input: Generates inner HTML . [CODESPLIT] public String getInnerHtml ( ) { LagartoDomBuilderConfig lagartoDomBuilderConfig ; if ( ownerDocument == null ) { lagartoDomBuilderConfig = ( ( Document ) this ) . getConfig ( ) ; } else { lagartoDomBuilderConfig = ownerDocument . getConfig ( ) ; } LagartoHtmlRenderer lagartoHtmlRenderer = lagartoDomBuilderConfig . getLagartoHtmlRenderer ( ) ; return lagartoHtmlRenderer . toInnerHtml ( this , new StringBuilder ( ) ) ; }


Input: Visits children nodes . [CODESPLIT] protected void visitChildren ( final NodeVisitor nodeVisitor ) { if ( childNodes != null ) { for ( int i = 0 , childNodesSize = childNodes . size ( ) ; i < childNodesSize ; i ++ ) { Node childNode = childNodes . get ( i ) ; childNode . visit ( nodeVisitor ) ; } } }


Input: Returns CSS path to this node from document root . [CODESPLIT] public String getCssPath ( ) { StringBuilder path = new StringBuilder ( ) ; Node node = this ; while ( node != null ) { String nodeName = node . getNodeName ( ) ; if ( nodeName != null ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( ' ' ) . append ( nodeName ) ; String id = node . getAttribute ( "id" ) ; if ( id != null ) { sb . append ( ' ' ) . append ( id ) ; } path . insert ( 0 , sb ) ; } node = node . getParentNode ( ) ; } if ( path . charAt ( 0 ) == ' ' ) { return path . substring ( 1 ) ; } return path . toString ( ) ; }


Input: Handle Decora tags . [CODESPLIT] protected void onDecoraTag ( final Tag tag ) { String tagName = tag . getName ( ) . toString ( ) ; if ( tag . getType ( ) == TagType . SELF_CLOSING ) { checkNestedDecoraTags ( ) ; decoraTagName = tagName . substring ( 7 ) ; decoraTagStart = tag . getTagPosition ( ) ; decoraTagEnd = tag . getTagPosition ( ) + tag . getTagLength ( ) ; defineDecoraTag ( ) ; return ; } if ( tag . getType ( ) == TagType . START ) { checkNestedDecoraTags ( ) ; decoraTagName = tagName . substring ( 7 ) ; decoraTagStart = tag . getTagPosition ( ) ; decoraTagDefaultValueStart = tag . getTagPosition ( ) + tag . getTagLength ( ) ; return ; } // closed tag type decoraTagEnd = tag . getTagPosition ( ) + tag . getTagLength ( ) ; decoraTagDefaultValueEnd = tag . getTagPosition ( ) ; defineDecoraTag ( ) ; }


Input: Handle open and empty ID attribute tags . [CODESPLIT] protected void onIdAttrStart ( final Tag tag ) { String id = tag . getId ( ) . toString ( ) . substring ( 7 ) ; String tagName ; String idName ; int dashIndex = id . indexOf ( ' ' ) ; if ( dashIndex == - 1 ) { tagName = id ; idName = null ; } else { tagName = id . substring ( 0 , dashIndex ) ; idName = id . substring ( dashIndex + 1 ) ; } if ( tag . getType ( ) == TagType . SELF_CLOSING ) { checkNestedDecoraTags ( ) ; decoraTagName = tagName ; decoraIdName = idName ; decoraTagStart = tag . getTagPosition ( ) ; decoraTagEnd = tag . getTagPosition ( ) + tag . getTagLength ( ) ; defineDecoraTag ( ) ; return ; } if ( tag . getType ( ) == TagType . START ) { checkNestedDecoraTags ( ) ; decoraTagName = tagName ; decoraIdName = idName ; decoraTagStart = tag . getTagPosition ( ) ; decoraTagDefaultValueStart = tag . getTagPosition ( ) + tag . getTagLength ( ) ; closingTagName = tag . getName ( ) . toString ( ) ; closingTagDeepLevel = tag . getDeepLevel ( ) ; } }


Input: Defines Decora tag position inside decorator content . Resets current Decora tag tracking . [CODESPLIT] protected void defineDecoraTag ( ) { DecoraTag decoraTag = decoraTagDefaultValueStart == 0 ? new DecoraTag ( decoraTagName , decoraIdName , decoraTagStart , decoraTagEnd ) : new DecoraTag ( decoraTagName , decoraIdName , decoraTagStart , decoraTagEnd , decoraTagDefaultValueStart , decoraTagDefaultValueEnd - decoraTagDefaultValueStart ) ; decoraTags . add ( decoraTag ) ; decoraTagName = null ; decoraIdName = null ; closingTagName = null ; decoraTagDefaultValueStart = 0 ; }


Input: Adds a proxy aspect . [CODESPLIT] @ Override public JoyProxetta addProxyAspect ( final ProxyAspect proxyAspect ) { requireNotStarted ( proxetta ) ; this . proxyAspects . add ( proxyAspect ) ; return this ; }


Input: Creates Proxetta with all aspects . The following aspects are created : <ul > <li > Transaction proxy - applied on all classes that contains public top - level methods annotated with <code > [CODESPLIT] @ Override public void start ( ) { initLogger ( ) ; log . info ( "PROXETTA start ----------" ) ; final ProxyAspect [ ] proxyAspectsArray = this . proxyAspects . toArray ( new ProxyAspect [ 0 ] ) ; log . debug ( "Total proxy aspects: " + proxyAspectsArray . length ) ; //		proxetta = Proxetta.wrapperProxetta().setCreateTargetInDefaultCtor(true).withAspects(proxyAspectsArray); proxetta = Proxetta . proxyProxetta ( ) . withAspects ( proxyAspectsArray ) ; log . info ( "PROXETTA OK!" ) ; }


Input: ---------------------------------------------------------------- benchmark [CODESPLIT] @ Benchmark public Object map ( ) { final FastCharBuffer sb = new FastCharBuffer ( ) ; for ( final int index : indexes ) { sb . append ( map . get ( TYPES [ index ] ) ) ; } return sb ; }


Input: { [CODESPLIT] @ Override public Timestamp get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { return rs . getTimestamp ( index ) ; }


Input: { [CODESPLIT] @ Override public void set ( final PreparedStatement st , final int index , final Timestamp value , final int dbSqlType ) throws SQLException { st . setTimestamp ( index , value ) ; }


Input: Returns the corresponding MIME type to the given extension . If no MIME type was found it returns <code > application / octet - stream< / code > type . [CODESPLIT] public static String getMimeType ( final String ext ) { String mimeType = lookupMimeType ( ext ) ; if ( mimeType == null ) { mimeType = MIME_APPLICATION_OCTET_STREAM ; } return mimeType ; }


Input: Finds all extensions that belong to given mime type ( s ) . If wildcard mode is on provided mime type is wildcard pattern . [CODESPLIT] public static String [ ] findExtensionsByMimeTypes ( String mimeType , final boolean useWildcard ) { final ArrayList < String > extensions = new ArrayList <> ( ) ; mimeType = mimeType . toLowerCase ( ) ; final String [ ] mimeTypes = StringUtil . splitc ( mimeType , ", " ) ; for ( final Map . Entry < String , String > entry : MIME_TYPE_MAP . entrySet ( ) ) { final String entryExtension = entry . getKey ( ) ; final String entryMimeType = entry . getValue ( ) . toLowerCase ( ) ; final int matchResult = useWildcard ? Wildcard . matchOne ( entryMimeType , mimeTypes ) : StringUtil . equalsOne ( entryMimeType , mimeTypes ) ; if ( matchResult != - 1 ) { extensions . add ( entryExtension ) ; } } if ( extensions . isEmpty ( ) ) { return StringPool . EMPTY_ARRAY ; } return extensions . toArray ( new String [ 0 ] ) ; }


Input: { [CODESPLIT] @ Override public Boolean get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { return Boolean . valueOf ( rs . getBoolean ( index ) ) ; }


Input: { [CODESPLIT] @ Override public void set ( final PreparedStatement st , final int index , final Boolean value , final int dbSqlType ) throws SQLException { st . setBoolean ( index , value . booleanValue ( ) ) ; }


Input: Adds root package and its path mapping . Duplicate root packages are ignored if mapping path is equals otherwise exception is thrown . [CODESPLIT] public void addRootPackage ( final String rootPackage , String mapping ) { if ( packages == null ) { packages = new String [ 0 ] ; } if ( mappings == null ) { mappings = new String [ 0 ] ; } // fix mapping if ( mapping . length ( ) > 0 ) { // mapping must start with the slash if ( ! mapping . startsWith ( StringPool . SLASH ) ) { mapping = StringPool . SLASH + mapping ; } // mapping must NOT end with the slash if ( mapping . endsWith ( StringPool . SLASH ) ) { mapping = StringUtil . substring ( mapping , 0 , - 1 ) ; } } // detect duplicates for ( int i = 0 ; i < packages . length ; i ++ ) { if ( packages [ i ] . equals ( rootPackage ) ) { if ( mappings [ i ] . equals ( mapping ) ) { // both package and the mappings are the same return ; } throw new MadvocException ( "Different mappings for the same root package: " + rootPackage ) ; } } packages = ArraysUtil . append ( packages , rootPackage ) ; mappings = ArraysUtil . append ( mappings , mapping ) ; }


Input: Sets root package to package of given class . [CODESPLIT] public void addRootPackageOf ( final Class actionClass , final String mapping ) { addRootPackage ( actionClass . getPackage ( ) . getName ( ) , mapping ) ; }


Input: Finds closest root package for the given action path . [CODESPLIT] public String findRootPackageForActionPath ( final String actionPath ) { if ( mappings == null ) { return null ; } int ndx = - 1 ; int delta = Integer . MAX_VALUE ; for ( int i = 0 ; i < mappings . length ; i ++ ) { String mapping = mappings [ i ] ; boolean found = false ; if ( actionPath . equals ( mapping ) ) { found = true ; } else { mapping += StringPool . SLASH ; if ( actionPath . startsWith ( mapping ) ) { found = true ; } } if ( found ) { int distance = actionPath . length ( ) - mapping . length ( ) ; if ( distance < delta ) { ndx = i ; delta = distance ; } } } if ( ndx == - 1 ) { return null ; } return packages [ ndx ] ; }


Input: Finds mapping for given action class . Returns <code > null< / code > if no mapping is found . If there is more then one matching root package the closest one will be returned . [CODESPLIT] public String findPackagePathForActionPackage ( final String actionPackage ) { if ( packages == null ) { return null ; } if ( packagePaths == null ) { packagePaths = new HashMap <> ( ) ; } String packagePath = packagePaths . get ( actionPackage ) ; if ( packagePath != null ) { return packagePath ; } int ndx = - 1 ; int delta = Integer . MAX_VALUE ; for ( int i = 0 ; i < packages . length ; i ++ ) { String rootPackage = packages [ i ] ; if ( rootPackage . equals ( actionPackage ) ) { // exact match ndx = i ; delta = 0 ; break ; } rootPackage += ' ' ; if ( actionPackage . startsWith ( rootPackage ) ) { // found, action package contains root package int distanceFromTheRoot = actionPackage . length ( ) - rootPackage . length ( ) ; if ( distanceFromTheRoot < delta ) { ndx = i ; delta = distanceFromTheRoot ; } } } if ( ndx == - 1 ) { return null ; } String packageActionPath = delta == 0 ? StringPool . EMPTY : StringUtil . substring ( actionPackage , - delta - 1 , 0 ) ; packageActionPath = packageActionPath . replace ( ' ' , ' ' ) ; String result = mappings [ ndx ] + packageActionPath ; packagePaths . put ( actionPackage , result ) ; return result ; }


Input: { [CODESPLIT] public DbSession beginTransaction ( final JtxTransactionMode jtxMode , final boolean active ) { DbSession session = new DbSession ( connectionProvider ) ; if ( active ) { log . debug ( "begin jtx" ) ; session . beginTransaction ( JtxDbUtil . convertToDbMode ( jtxMode ) ) ; } return session ; }


Input: { [CODESPLIT] public void commitTransaction ( final DbSession resource ) { if ( resource . isTransactionActive ( ) ) { log . debug ( "commit jtx" ) ; resource . commitTransaction ( ) ; } resource . closeSession ( ) ; }


Input: { [CODESPLIT] public void rollbackTransaction ( final DbSession resource ) { try { if ( resource . isTransactionActive ( ) ) { log . debug ( "rollback tx" ) ; resource . rollbackTransaction ( ) ; } } catch ( Exception ex ) { throw new JtxException ( ex ) ; } finally { resource . closeSession ( ) ; } }


Input: Returns JSON violations string . Contains javascript array with elements that contain : <ul > <li > name - violation name< / li > <li > msg - message code i . e . constraint class name< / li > < / ul > [CODESPLIT] public static String createViolationsJsonString ( final HttpServletRequest request , final List < Violation > violations ) { if ( violations == null ) { return StringPool . EMPTY ; } StringBuilder sb = new StringBuilder ( ) . append ( ' ' ) ; for ( int i = 0 , violationsSize = violations . size ( ) ; i < violationsSize ; i ++ ) { Violation violation = violations . get ( i ) ; if ( i != 0 ) { sb . append ( ' ' ) ; } sb . append ( ' ' ) ; sb . append ( "\"name\":\"" ) . append ( violation . getName ( ) ) . append ( ' ' ) . append ( ' ' ) ; sb . append ( "\"msg\":\"" ) . append ( resolveValidationMessage ( request , violation ) ) . append ( ' ' ) ; sb . append ( ' ' ) ; } sb . append ( ' ' ) ; return sb . toString ( ) ; }


Input: Prepares validation messages . Key is either validation constraint class name or violation name . [CODESPLIT] public static String resolveValidationMessage ( final HttpServletRequest request , final Violation violation ) { ValidationConstraint vc = violation . getConstraint ( ) ; String key = vc != null ? vc . getClass ( ) . getName ( ) : violation . getName ( ) ; String msg = LocalizationUtil . findMessage ( request , key ) ; if ( msg != null ) { return beanTemplateParser . parseWithBean ( msg , violation ) ; } return null ; }


Input: Removes later duplicated references in an array . Returns new instance of BeanReferences if there was changes otherwise returns the same instance . [CODESPLIT] public BeanReferences removeDuplicateNames ( ) { if ( names . length < 2 ) { return this ; } int nullCount = 0 ; for ( int i = 1 ; i < names . length ; i ++ ) { String thisRef = names [ i ] ; if ( thisRef == null ) { nullCount ++ ; continue ; } for ( int j = 0 ; j < i ; j ++ ) { if ( names [ j ] == null ) { continue ; } if ( thisRef . equals ( names [ j ] ) ) { names [ i ] = null ; break ; } } } if ( nullCount == 0 ) { return this ; } String [ ] newRefs = new String [ names . length - nullCount ] ; int ndx = 0 ; for ( String name : names ) { if ( name == null ) { continue ; } newRefs [ ndx ] = name ; ndx ++ ; } return new BeanReferences ( newRefs ) ; }


Input: Adds props files or patterns . [CODESPLIT] @ Override public JoyProps addPropsFile ( final String namePattern ) { requireNotStarted ( props ) ; this . propsNamePatterns . add ( namePattern ) ; return this ; }


Input: Creates and loads application props . It first loads system properties ( registered as <code > sys . * < / code > ) and then environment properties ( registered as <code > env . * < / code > ) . Finally props files are read from the classpath . All properties are loaded using <p > If props have been already loaded does nothing . [CODESPLIT] @ Override public void start ( ) { initLogger ( ) ; log . info ( "PROPS start ----------" ) ; props = createProps ( ) ; props . loadSystemProperties ( "sys" ) ; props . loadEnvironment ( "env" ) ; log . debug ( "Loaded sys&env props: " + props . countTotalProperties ( ) + " properties." ) ; props . setActiveProfiles ( propsProfiles . toArray ( new String [ 0 ] ) ) ; // prepare patterns final String [ ] patterns = new String [ propsNamePatterns . size ( ) + 1 ] ; patterns [ 0 ] = "/" + nameSupplier . get ( ) + "*.prop*" ; for ( int i = 0 ; i < propsNamePatterns . size ( ) ; i ++ ) { patterns [ i + 1 ] = propsNamePatterns . get ( i ) ; } log . debug ( "Loading props from classpath..." ) ; final long startTime = System . currentTimeMillis ( ) ; props . loadFromClasspath ( patterns ) ; log . debug ( "Props scanning completed in " + ( System . currentTimeMillis ( ) - startTime ) + "ms." ) ; log . debug ( "Total properties: " + props . countTotalProperties ( ) ) ; log . info ( "PROPS OK!" ) ; }


Input: Creates new { [CODESPLIT] protected Props createProps ( ) { final Props props = new Props ( ) ; props . setSkipEmptyProps ( true ) ; props . setIgnoreMissingMacros ( true ) ; return props ; }


Input: Iterates all targets . [CODESPLIT] public void forEachTarget ( final Consumer < Target > targetConsumer ) { for ( final Target target : targets ) { targetConsumer . accept ( target ) ; } }


Input: Iterates all targets and for each target iterates all IN injection points of given scope . [CODESPLIT] public void forEachTargetAndIn ( final MadvocScope scope , final BiConsumer < Target , InjectionPoint > biConsumer ) { for ( final Target target : targets ) { final ScopeData scopeData = target . scopeData ( ) ; if ( scopeData . in ( ) == null ) { continue ; } for ( final InjectionPoint in : scopeData . in ( ) ) { if ( in . scope ( ) != scope ) { continue ; } biConsumer . accept ( target , in ) ; } } }


Input: Iterates all targets and for each target iterates all OUT injection points of given scope . [CODESPLIT] public void forEachTargetAndOut ( final MadvocScope scope , final BiConsumer < Target , InjectionPoint > biConsumer ) { for ( final Target target : targets ) { final ScopeData scopeData = target . scopeData ( ) ; if ( scopeData . out ( ) == null ) { continue ; } for ( final InjectionPoint out : scopeData . out ( ) ) { if ( out . scope ( ) != scope ) { continue ; } biConsumer . accept ( target , out ) ; } } }


Input: Collects all parameters from target into an array . [CODESPLIT] public Object [ ] extractParametersValues ( ) { final Object [ ] values = new Object [ targets . length - 1 ] ; for ( int i = 1 ; i < targets . length ; i ++ ) { values [ i - 1 ] = targets [ i ] . value ( ) ; } return values ; }


Input: Joins action and parameters into one single array of Targets . [CODESPLIT] protected Target [ ] makeTargets ( final Target actionTarget , final MethodParam [ ] methodParams ) { if ( methodParams == null ) { // action does not have method parameters, so there is just one target return new Target [ ] { actionTarget } ; } // action has method arguments, so there is more then one target final Target [ ] target = new Target [ methodParams . length + 1 ] ; target [ 0 ] = actionTarget ; final Object action = actionTarget . value ( ) ; for ( int i = 0 ; i < methodParams . length ; i ++ ) { final MethodParam methodParam = methodParams [ i ] ; final Class paramType = methodParam . type ( ) ; final Target paramTarget ; if ( methodParam . annotationType ( ) == null ) { // parameter is NOT annotated, create new value for the target // the class itself will be a base class, and should be scanned final ScopeData newScopeData = methodParam . scopeData ( ) . inspector ( ) . inspectClassScopesWithCache ( paramType ) ; paramTarget = Target . ofValue ( createActionMethodArgument ( paramType , action ) , newScopeData ) ; } else if ( methodParam . annotationType ( ) == Out . class ) { // parameter is annotated with *only* OUT annotation // create the output value now AND to save the type paramTarget = Target . ofMethodParam ( methodParam , createActionMethodArgument ( paramType , action ) ) ; } else { // parameter is annotated with any IN annotation // create target with NO value, as the value will be created later paramTarget = Target . ofMethodParam ( methodParam , type -> createActionMethodArgument ( type , action ) ) ; } target [ i + 1 ] = paramTarget ; } return target ; }


Input: Creates action method arguments . [CODESPLIT] @ SuppressWarnings ( { "unchecked" , "NullArgumentToVariableArgMethod" } ) protected Object createActionMethodArgument ( final Class type , final Object action ) { try { if ( type . getEnclosingClass ( ) == null || Modifier . isStatic ( type . getModifiers ( ) ) ) { // regular or static class return ClassUtil . newInstance ( type ) ; } else { // member class Constructor ctor = type . getDeclaredConstructor ( type . getDeclaringClass ( ) ) ; ctor . setAccessible ( true ) ; return ctor . newInstance ( action ) ; } } catch ( Exception ex ) { throw new MadvocException ( ex ) ; } }


Input: Stores session in map and broadcasts event to registered listeners . [CODESPLIT] @ Override public void sessionCreated ( final HttpSessionEvent httpSessionEvent ) { HttpSession session = httpSessionEvent . getSession ( ) ; sessionMap . putIfAbsent ( session . getId ( ) , session ) ; for ( HttpSessionListener listener : listeners ) { listener . sessionCreated ( httpSessionEvent ) ; } }


Input: Removes session from a map and broadcasts event to registered listeners . [CODESPLIT] @ Override public void sessionDestroyed ( final HttpSessionEvent httpSessionEvent ) { HttpSession session = httpSessionEvent . getSession ( ) ; sessionMap . remove ( session . getId ( ) ) ; for ( HttpSessionListener listener : listeners ) { listener . sessionDestroyed ( httpSessionEvent ) ; } }


Input: Returns the string at position { [CODESPLIT] public String getString ( final int pos ) { CharSequence cs = ( CharSequence ) list . get ( pos ) ; return cs == null ? null : cs . toString ( ) ; }


Input: Returns the integer at position { [CODESPLIT] public Integer getInteger ( final int pos ) { Number number = ( Number ) list . get ( pos ) ; if ( number == null ) { return null ; } if ( number instanceof Integer ) { // avoid unnecessary unbox/box return ( Integer ) number ; } return number . intValue ( ) ; }


Input: Returns the long at position { [CODESPLIT] public Long getLong ( final int pos ) { Number number = ( Number ) list . get ( pos ) ; if ( number == null ) { return null ; } if ( number instanceof Long ) { // avoids unnecessary unbox/box return ( Long ) number ; } return number . longValue ( ) ; }


Input: Returns the double at position { [CODESPLIT] public Double getDouble ( final int pos ) { Number number = ( Number ) list . get ( pos ) ; if ( number == null ) { return null ; } if ( number instanceof Double ) { // avoids unnecessary unbox/box return ( Double ) number ; } return number . doubleValue ( ) ; }


Input: Returns the Float at position { [CODESPLIT] public Float getFloat ( final int pos ) { Number number = ( Number ) list . get ( pos ) ; if ( number == null ) { return null ; } if ( number instanceof Float ) { // avoids unnecessary unbox/box return ( Float ) number ; } return number . floatValue ( ) ; }


Input: Retruns the JsonObject at position { [CODESPLIT] public JsonObject getJsonObject ( final int pos ) { Object val = list . get ( pos ) ; if ( val instanceof Map ) { val = new JsonObject ( ( Map ) val ) ; } return ( JsonObject ) val ; }


Input: Returns the JsonArray at position { [CODESPLIT] public JsonArray getJsonArray ( final int pos ) { Object val = list . get ( pos ) ; if ( val instanceof List ) { val = new JsonArray ( ( List ) val ) ; } return ( JsonArray ) val ; }


Input: Returns the byte [] at position { [CODESPLIT] public byte [ ] getBinary ( final int pos ) { String val = ( String ) list . get ( pos ) ; if ( val == null ) { return null ; } return Base64 . getDecoder ( ) . decode ( val ) ; }


Input: Returns the object value at position { [CODESPLIT] public Object getValue ( final int pos ) { Object val = list . get ( pos ) ; if ( val instanceof Map ) { val = new JsonObject ( ( Map ) val ) ; } else if ( val instanceof List ) { val = new JsonArray ( ( List ) val ) ; } return val ; }


Input: Adds an enum to the JSON array . <p > JSON has no concept of encoding Enums so the Enum will be converted to a String using the { [CODESPLIT] public JsonArray add ( final Enum value ) { if ( value == null ) { list . add ( null ) ; } else { list . add ( value . name ( ) ) ; } return this ; }


Input: Adds an object to the JSON array . [CODESPLIT] public JsonArray add ( Object value ) { Objects . requireNonNull ( value ) ; value = JsonObject . resolveValue ( value ) ; list . add ( value ) ; return this ; }


Input: Appends all of the elements in the specified array to the end of this JSON array . [CODESPLIT] public JsonArray addAll ( final JsonArray array ) { Objects . requireNonNull ( array ) ; list . addAll ( array . list ) ; return this ; }


Input: Removes the value at the specified position in the JSON array . [CODESPLIT] public Object remove ( final int pos ) { Object removed = list . remove ( pos ) ; if ( removed instanceof Map ) { return new JsonObject ( ( Map ) removed ) ; } if ( removed instanceof ArrayList ) { return new JsonArray ( ( List ) removed ) ; } return removed ; }


Input: Dispatches to the template location created from result value and JSP extension . Does its forward via a <code > RequestDispatcher< / code > . If the dispatch fails a 404 error will be sent back in the http response . [CODESPLIT] @ Override public void render ( final ActionRequest actionRequest , final Object resultValue ) throws Exception { final PathResult pathResult ; if ( resultValue == null ) { pathResult = resultOf ( StringPool . EMPTY ) ; } else { if ( resultValue instanceof String ) { pathResult = resultOf ( resultValue ) ; } else { pathResult = ( PathResult ) resultValue ; } } final String resultBasePath = actionRequest . getActionRuntime ( ) . getResultBasePath ( ) ; final String path = pathResult != null ? pathResult . path ( ) : StringPool . EMPTY ; final String actionAndResultPath = resultBasePath + ( pathResult != null ? ' ' + path : StringPool . EMPTY ) ; String target = targetCache . get ( actionAndResultPath ) ; if ( target == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "new target: " + actionAndResultPath ) ; } target = resolveTarget ( actionRequest , path ) ; if ( target == null ) { targetNotFound ( actionRequest , actionAndResultPath ) ; return ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "target found: " + target ) ; } // store target in cache targetCache . put ( actionAndResultPath , target ) ; } // the target exists, continue renderView ( actionRequest , target ) ; }


Input: Locates the target file from action path and the result value . [CODESPLIT] protected String resolveTarget ( final ActionRequest actionRequest , final String resultValue ) { String resultBasePath = actionRequest . getActionRuntime ( ) . getResultBasePath ( ) ; ResultPath resultPath = resultMapper . resolveResultPath ( resultBasePath , resultValue ) ; String actionPath = resultPath . path ( ) ; String path = actionPath ; String value = resultPath . value ( ) ; if ( StringUtil . isEmpty ( value ) ) { value = null ; } String target ; while ( true ) { // variant #1: with value if ( value != null ) { if ( path == null ) { // only value remains int lastSlashNdx = actionPath . lastIndexOf ( ' ' ) ; if ( lastSlashNdx != - 1 ) { target = actionPath . substring ( 0 , lastSlashNdx + 1 ) + value ; } else { target = ' ' + value ; } } else { target = path + ' ' + value ; } target = locateTarget ( actionRequest , target ) ; if ( target != null ) { break ; } } if ( path != null ) { // variant #2: without value target = locateTarget ( actionRequest , path ) ; if ( target != null ) { break ; } } // continue if ( path == null ) { // path not found return null ; } int dotNdx = MadvocUtil . lastIndexOfDotAfterSlash ( path ) ; if ( dotNdx == - 1 ) { path = null ; } else { path = path . substring ( 0 , dotNdx ) ; } } return target ; }


Input: Called when target not found . By default sends 404 to the response . [CODESPLIT] protected void targetNotFound ( final ActionRequest actionRequest , final String actionAndResultPath ) throws IOException { final HttpServletResponse response = actionRequest . getHttpServletResponse ( ) ; if ( ! response . isCommitted ( ) ) { response . sendError ( SC_NOT_FOUND , "Result not found: " + actionAndResultPath ) ; } }


Input: Redirects to the given location . Provided path is parsed action is used as a value context . [CODESPLIT] @ Override public void render ( final ActionRequest actionRequest , final Object resultValue ) throws Exception { final Redirect redirectResult ; if ( resultValue == null ) { redirectResult = Redirect . to ( StringPool . EMPTY ) ; } else { if ( resultValue instanceof String ) { redirectResult = Redirect . to ( ( String ) resultValue ) ; } else { redirectResult = ( Redirect ) resultValue ; } } final String resultBasePath = actionRequest . getActionRuntime ( ) . getResultBasePath ( ) ; final String redirectPath = redirectResult . path ( ) ; final String resultPath ; if ( redirectPath . startsWith ( "http://" ) || redirectPath . startsWith ( "https://" ) ) { resultPath = redirectPath ; } else { resultPath = resultMapper . resolveResultPathString ( resultBasePath , redirectPath ) ; } HttpServletRequest request = actionRequest . getHttpServletRequest ( ) ; HttpServletResponse response = actionRequest . getHttpServletResponse ( ) ; String path = resultPath ; path = beanTemplateParser . parseWithBean ( path , actionRequest . getAction ( ) ) ; DispatcherUtil . redirect ( request , response , path ) ; }


Input: ---------------------------------------------------------------- input [CODESPLIT] private void processInputStartTag ( final Tag tag ) { // INPUT CharSequence tagType = tag . getAttributeValue ( TYPE ) ; if ( tagType == null ) { return ; } CharSequence nameSequence = tag . getAttributeValue ( NAME ) ; if ( nameSequence == null ) { return ; } String name = nameSequence . toString ( ) ; Object valueObject = resolver . value ( name ) ; if ( valueObject == null ) { return ; } String tagTypeName = tagType . toString ( ) . toLowerCase ( ) ; if ( tagTypeName . equals ( TEXT ) || tagTypeName . equals ( HIDDEN ) || tagTypeName . equals ( IMAGE ) || tagTypeName . equals ( PASSWORD ) ) { String value = valueToString ( name , valueObject ) ; if ( value == null ) { return ; } tag . setAttribute ( VALUE , value ) ; } else if ( tagTypeName . equals ( CHECKBOX ) ) { CharSequence tagValue = tag . getAttributeValue ( VALUE ) ; if ( tagValue == null ) { tagValue = TRUE ; } tagValue = tagValue . toString ( ) ; if ( valueObject . getClass ( ) . isArray ( ) ) { // checkbox group String [ ] vs = StringUtil . toStringArray ( valueObject ) ; for ( String vsk : vs ) { if ( ( vsk != null ) && ( vsk . contentEquals ( tagValue ) ) ) { tag . setAttribute ( CHECKED , null ) ; } } } else if ( tagValue . equals ( valueObject . toString ( ) ) ) { tag . setAttribute ( CHECKED , null ) ; } } else if ( tagType . equals ( RADIO ) ) { CharSequence tagValue = tag . getAttributeValue ( VALUE ) ; if ( tagValue != null ) { tagValue = tagValue . toString ( ) ; if ( tagValue . equals ( valueObject . toString ( ) ) ) { tag . setAttribute ( CHECKED , null ) ; } } } }


Input: Converts value to a string . [CODESPLIT] protected String valueToString ( final String name , final Object valueObject ) { if ( ! valueObject . getClass ( ) . isArray ( ) ) { return valueObject . toString ( ) ; } // array String [ ] array = ( String [ ] ) valueObject ; if ( valueNameIndexes == null ) { valueNameIndexes = new HashMap <> ( ) ; } MutableInteger index = valueNameIndexes . get ( name ) ; if ( index == null ) { index = new MutableInteger ( 0 ) ; valueNameIndexes . put ( name , index ) ; } if ( index . value >= array . length ) { return null ; } String result = array [ index . value ] ; index . value ++ ; return result ; }


Input: Configures an interceptor . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public < T extends ActionInterceptor > MadvocRouter interceptor ( final Class < T > actionInterceptorClass ) { interceptorsManager . resolve ( actionInterceptorClass ) ; return this ; }


Input: Configures an interceptor . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public < T extends ActionInterceptor > MadvocRouter interceptor ( final Class < T > actionInterceptorClass , final Consumer < T > interceptorConsumer ) { T interceptor = ( T ) interceptorsManager . resolve ( actionInterceptorClass ) ; interceptorConsumer . accept ( interceptor ) ; return this ; }


Input: Returns action filter instance for further configuration . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public < T extends ActionFilter > MadvocRouter filter ( final Class < T > actionFilterClass ) { filtersManager . resolve ( actionFilterClass ) ; return this ; }


Input: Returns <code > true< / code > if node matches the pseudoclass within current results . [CODESPLIT] public boolean match ( final List < Node > currentResults , final Node node , final int index , final E expression ) { return true ; }


Input: Returns pseudo - function name . [CODESPLIT] public String getPseudoFunctionName ( ) { String name = getClass ( ) . getSimpleName ( ) . toLowerCase ( ) ; name = name . replace ( ' ' , ' ' ) ; return name ; }


Input: Returns action string in form actionClass#actionMethod . [CODESPLIT] public String createActionString ( ) { if ( actionHandler != null ) { return actionHandler . getClass ( ) . getName ( ) ; } String className = actionClass . getName ( ) ; final int ndx = className . indexOf ( "$$" ) ; if ( ndx != - 1 ) { className = className . substring ( 0 , ndx ) ; } return className + ' ' + actionClassMethod . getName ( ) ; }


Input: { [CODESPLIT] @ Override public Integer get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { return Integer . valueOf ( rs . getInt ( index ) ) ; }


Input: { [CODESPLIT] @ Override public void set ( final PreparedStatement st , final int index , final Integer value , final int dbSqlType ) throws SQLException { st . setInt ( index , value . intValue ( ) ) ; }


Input: Resolves all properties for given type . [CODESPLIT] public PropertyInjectionPoint [ ] resolve ( Class type , final boolean autowire ) { final List < PropertyInjectionPoint > list = new ArrayList <> ( ) ; final Set < String > usedPropertyNames = new HashSet <> ( ) ; // lookup fields while ( type != Object . class ) { final ClassDescriptor cd = ClassIntrospector . get ( ) . lookup ( type ) ; final PropertyDescriptor [ ] allPropertyDescriptors = cd . getAllPropertyDescriptors ( ) ; for ( PropertyDescriptor propertyDescriptor : allPropertyDescriptors ) { if ( propertyDescriptor . isGetterOnly ( ) ) { continue ; } if ( usedPropertyNames . contains ( propertyDescriptor . getName ( ) ) ) { continue ; } Class propertyType = propertyDescriptor . getType ( ) ; if ( ClassUtil . isTypeOf ( propertyType , Collection . class ) ) { continue ; } BeanReferences reference = referencesResolver . readReferenceFromAnnotation ( propertyDescriptor ) ; if ( reference == null ) { if ( ! autowire ) { continue ; } else { reference = referencesResolver . buildDefaultReference ( propertyDescriptor ) ; } } list . add ( new PropertyInjectionPoint ( propertyDescriptor , reference ) ) ; usedPropertyNames . add ( propertyDescriptor . getName ( ) ) ; } // go to the supertype type = type . getSuperclass ( ) ; } final PropertyInjectionPoint [ ] fields ; if ( list . isEmpty ( ) ) { fields = PropertyInjectionPoint . EMPTY ; } else { fields = list . toArray ( new PropertyInjectionPoint [ 0 ] ) ; } return fields ; }


Input: Connects to the SOCKS4 proxy and returns proxified socket . [CODESPLIT] private Socket createSocks4ProxySocket ( final String host , final int port ) { Socket socket = null ; final String proxyHost = proxy . getProxyAddress ( ) ; final int proxyPort = proxy . getProxyPort ( ) ; final String user = proxy . getProxyUsername ( ) ; try { socket = Sockets . connect ( proxyHost , proxyPort , connectionTimeout ) ; final InputStream in = socket . getInputStream ( ) ; final OutputStream out = socket . getOutputStream ( ) ; socket . setTcpNoDelay ( true ) ; byte [ ] buf = new byte [ 1024 ] ; // 1) CONNECT int index = 0 ; buf [ index ++ ] = 4 ; buf [ index ++ ] = 1 ; buf [ index ++ ] = ( byte ) ( port >>> 8 ) ; buf [ index ++ ] = ( byte ) ( port & 0xff ) ; InetAddress addr = InetAddress . getByName ( host ) ; byte [ ] byteAddress = addr . getAddress ( ) ; for ( byte byteAddres : byteAddress ) { buf [ index ++ ] = byteAddres ; } if ( user != null ) { System . arraycopy ( user . getBytes ( ) , 0 , buf , index , user . length ( ) ) ; index += user . length ( ) ; } buf [ index ++ ] = 0 ; out . write ( buf , 0 , index ) ; // 2) RESPONSE int len = 6 ; int s = 0 ; while ( s < len ) { int i = in . read ( buf , s , len - s ) ; if ( i <= 0 ) { throw new HttpException ( ProxyInfo . ProxyType . SOCKS4 , "stream is closed" ) ; } s += i ; } if ( buf [ 0 ] != 0 ) { throw new HttpException ( ProxyInfo . ProxyType . SOCKS4 , "proxy returned VN " + buf [ 0 ] ) ; } if ( buf [ 1 ] != 90 ) { try { socket . close ( ) ; } catch ( Exception ignore ) { } throw new HttpException ( ProxyInfo . ProxyType . SOCKS4 , "proxy returned CD " + buf [ 1 ] ) ; } byte [ ] temp = new byte [ 2 ] ; in . read ( temp , 0 , 2 ) ; return socket ; } catch ( RuntimeException rtex ) { closeSocket ( socket ) ; throw rtex ; } catch ( Exception ex ) { closeSocket ( socket ) ; throw new HttpException ( ProxyInfo . ProxyType . SOCKS4 , ex . toString ( ) , ex ) ; } }


Input: Reads a { @link #type } attribute . This method must return a <i > new< / i > { @link Attribute } object of type { @link #type } corresponding to the length bytes starting at offset in the given ClassReader . [CODESPLIT] protected Attribute read ( final ClassReader classReader , final int offset , final int length , final char [ ] charBuffer , final int codeAttributeOffset , final Label [ ] labels ) { Attribute attribute = new Attribute ( type ) ; attribute . content = new byte [ length ] ; System . arraycopy ( classReader . b , offset , attribute . content , 0 , length ) ; return attribute ; }


Input: Returns the byte array form of the content of this attribute . The 6 header bytes ( attribute_name_index and attribute_length ) must <i > not< / i > be added in the returned ByteVector . [CODESPLIT] protected ByteVector write ( final ClassWriter classWriter , final byte [ ] code , final int codeLength , final int maxStack , final int maxLocals ) { return new ByteVector ( content ) ; }


Input: Returns the number of attributes of the attribute list that begins with this attribute . [CODESPLIT] final int getAttributeCount ( ) { int count = 0 ; Attribute attribute = this ; while ( attribute != null ) { count += 1 ; attribute = attribute . nextAttribute ; } return count ; }


Input: Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute . This size includes the 6 header bytes ( attribute_name_index and attribute_length ) per attribute . Also adds the attribute type names to the constant pool . [CODESPLIT] final int computeAttributesSize ( final SymbolTable symbolTable ) { final byte [ ] code = null ; final int codeLength = 0 ; final int maxStack = - 1 ; final int maxLocals = - 1 ; return computeAttributesSize ( symbolTable , code , codeLength , maxStack , maxLocals ) ; }


Input: Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute . This size includes the 6 header bytes ( attribute_name_index and attribute_length ) per attribute . Also adds the attribute type names to the constant pool . [CODESPLIT] final int computeAttributesSize ( final SymbolTable symbolTable , final byte [ ] code , final int codeLength , final int maxStack , final int maxLocals ) { final ClassWriter classWriter = symbolTable . classWriter ; int size = 0 ; Attribute attribute = this ; while ( attribute != null ) { symbolTable . addConstantUtf8 ( attribute . type ) ; size += 6 + attribute . write ( classWriter , code , codeLength , maxStack , maxLocals ) . length ; attribute = attribute . nextAttribute ; } return size ; }


Input: Puts all the attributes of the attribute list that begins with this attribute in the given byte vector . This includes the 6 header bytes ( attribute_name_index and attribute_length ) per attribute . [CODESPLIT] final void putAttributes ( final SymbolTable symbolTable , final ByteVector output ) { final byte [ ] code = null ; final int codeLength = 0 ; final int maxStack = - 1 ; final int maxLocals = - 1 ; putAttributes ( symbolTable , code , codeLength , maxStack , maxLocals , output ) ; }


Input: Puts all the attributes of the attribute list that begins with this attribute in the given byte vector . This includes the 6 header bytes ( attribute_name_index and attribute_length ) per attribute . [CODESPLIT] final void putAttributes ( final SymbolTable symbolTable , final byte [ ] code , final int codeLength , final int maxStack , final int maxLocals , final ByteVector output ) { final ClassWriter classWriter = symbolTable . classWriter ; Attribute attribute = this ; while ( attribute != null ) { ByteVector attributeContent = attribute . write ( classWriter , code , codeLength , maxStack , maxLocals ) ; // Put attribute_name_index and attribute_length. output . putShort ( symbolTable . addConstantUtf8 ( attribute . type ) ) . putInt ( attributeContent . length ) ; output . putByteArray ( attributeContent . data , 0 , attributeContent . length ) ; attribute = attribute . nextAttribute ; } }


Input: Returns all action results as new set . [CODESPLIT] public Set < ActionResult > getAllActionResults ( ) { final Set < ActionResult > set = new HashSet <> ( allResults . size ( ) ) ; allResults . forEachValue ( set :: add ) ; return set ; }


Input: Registers new action result instance . If action result of the same class is already registered registration will be skipped . If result for the same result type or same target class exist it will be replaced! However default Jodd results will <i > never< / i > replace other results . After the registration results are initialized . [CODESPLIT] protected ActionResult register ( final ActionResult result ) { Class < ? extends ActionResult > actionResultClass = result . getClass ( ) ; // check existing ActionResult existingResult = allResults . get ( actionResultClass ) ; if ( existingResult != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "ActionResult already registered: " + actionResultClass ) ; } return existingResult ; } allResults . put ( actionResultClass , result ) ; // + init initializeResult ( result ) ; return result ; }


Input: Lookups for action result and { [CODESPLIT] private ActionResult lookupAndRegisterIfMissing ( final Class < ? extends ActionResult > actionResultClass ) { ActionResult actionResult = allResults . get ( actionResultClass ) ; if ( actionResult == null ) { actionResult = register ( actionResultClass ) ; } return actionResult ; }


Input: Lookups for { [CODESPLIT] public ActionResult lookup ( final ActionRequest actionRequest , final Object resultObject ) { ActionResult actionResultHandler = null ; // + read @RenderWith value on method { final ActionRuntime actionRuntime = actionRequest . getActionRuntime ( ) ; final Class < ? extends ActionResult > actionResultClass = actionRuntime . getActionResult ( ) ; if ( actionResultClass != null ) { actionResultHandler = lookupAndRegisterIfMissing ( actionResultClass ) ; } } // + use @RenderWith value on resulting object if exist if ( actionResultHandler == null && resultObject != null ) { final RenderWith renderWith = resultObject . getClass ( ) . getAnnotation ( RenderWith . class ) ; if ( renderWith != null ) { actionResultHandler = lookupAndRegisterIfMissing ( renderWith . value ( ) ) ; } else if ( resultObject instanceof ActionResult ) { // special case - returned value is already the ActionResult actionResultHandler = ( ActionResult ) resultObject ; } } // + use action configuration if ( actionResultHandler == null ) { final ActionRuntime actionRuntime = actionRequest . getActionRuntime ( ) ; final Class < ? extends ActionResult > actionResultClass = actionRuntime . getDefaultActionResult ( ) ; if ( actionResultClass != null ) { actionResultHandler = lookupAndRegisterIfMissing ( actionResultClass ) ; } } if ( actionResultHandler == null ) { throw new MadvocException ( "ActionResult not found for: " + resultObject ) ; } // set action result object into action request! actionRequest . bindActionResult ( resultObject ) ; return actionResultHandler ; }


Input: Creates new { [CODESPLIT] protected ActionResult createResult ( final Class < ? extends ActionResult > actionResultClass ) { try { return ClassUtil . newInstance ( actionResultClass ) ; } catch ( Exception ex ) { throw new MadvocException ( "Invalid Madvoc result: " + actionResultClass , ex ) ; } }


Input: Match if one character equals to any of the given character . [CODESPLIT] public static boolean equalsOne ( final char c , final CharSequence match ) { for ( int i = 0 ; i < match . length ( ) ; i ++ ) { char aMatch = match . charAt ( i ) ; if ( c == aMatch ) { return true ; } } return false ; }


Input: Finds index of the first character in given charsequence the matches any from the given set of characters . [CODESPLIT] public static int findFirstEqual ( final CharSequence source , final int index , final CharSequence match ) { for ( int i = index ; i < source . length ( ) ; i ++ ) { if ( equalsOne ( source . charAt ( i ) , match ) ) { return i ; } } return - 1 ; }


Input: Finds index of the first character in given array the matches any from the given set of characters . [CODESPLIT] public static int findFirstEqual ( final char [ ] source , final int index , final char match ) { for ( int i = index ; i < source . length ; i ++ ) { if ( source [ i ] == match ) { return i ; } } return - 1 ; }


Input: Adds several arguments . [CODESPLIT] public CommandLine args ( final String ... arguments ) { if ( arguments != null && arguments . length > 0 ) { Collections . addAll ( cmdLine , arguments ) ; } return this ; }


Input: Sets environment variable . [CODESPLIT] public CommandLine env ( final String key , final String value ) { if ( env == null ) { env = new HashMap <> ( ) ; } env . put ( key , value ) ; return this ; }


Input: Runs command and returns process result . [CODESPLIT] public ProcessRunner . ProcessResult run ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; out = err = baos ; try { baos . write ( StringUtil . join ( cmdLine , ' ' ) . getBytes ( ) ) ; baos . write ( StringPool . BYTES_NEW_LINE ) ; } catch ( IOException ignore ) { } ProcessBuilder processBuilder = new ProcessBuilder ( ) ; processBuilder . command ( cmdLine ) ; if ( cleanEnvironment ) { processBuilder . environment ( ) . clear ( ) ; } if ( env != null ) { processBuilder . environment ( ) . putAll ( env ) ; } processBuilder . directory ( workingDirectory ) ; Process process = null ; try { process = processBuilder . start ( ) ; } catch ( IOException ioex ) { return writeException ( baos , ioex ) ; } StreamGobbler outputGobbler = new StreamGobbler ( process . getInputStream ( ) , out , outPrefix ) ; StreamGobbler errorGobbler = new StreamGobbler ( process . getErrorStream ( ) , err , errPrefix ) ; outputGobbler . start ( ) ; errorGobbler . start ( ) ; int result ; try { result = process . waitFor ( ) ; } catch ( InterruptedException iex ) { return writeException ( baos , iex ) ; } outputGobbler . waitFor ( ) ; errorGobbler . waitFor ( ) ; return new ProcessRunner . ProcessResult ( result , baos . toString ( ) ) ; }


Input: Invoke the listener based on type . Not very OOP but works . [CODESPLIT] public static void invoke ( final Object listener , final Class listenerType ) { if ( listenerType == Init . class ) { ( ( Init ) listener ) . init ( ) ; return ; } if ( listenerType == Start . class ) { ( ( Start ) listener ) . start ( ) ; return ; } if ( listenerType == Ready . class ) { ( ( Ready ) listener ) . ready ( ) ; return ; } if ( listenerType == Stop . class ) { ( ( Stop ) listener ) . stop ( ) ; return ; } throw new MadvocException ( "Invalid listener" ) ; }


Input: Sets this frame to the value of the given frame . [CODESPLIT] final void copyFrom ( final Frame frame ) { inputLocals = frame . inputLocals ; inputStack = frame . inputStack ; outputStackStart = 0 ; outputLocals = frame . outputLocals ; outputStack = frame . outputStack ; outputStackTop = frame . outputStackTop ; initializationCount = frame . initializationCount ; initializations = frame . initializations ; }


Input: Returns the abstract type corresponding to the given public API frame element type . [CODESPLIT] static int getAbstractTypeFromApiFormat ( final SymbolTable symbolTable , final Object type ) { if ( type instanceof Integer ) { return CONSTANT_KIND | ( ( Integer ) type ) . intValue ( ) ; } else if ( type instanceof String ) { String descriptor = Type . getObjectType ( ( String ) type ) . getDescriptor ( ) ; return getAbstractTypeFromDescriptor ( symbolTable , descriptor , 0 ) ; } else { return UNINITIALIZED_KIND | symbolTable . addUninitializedType ( "" , ( ( Label ) type ) . bytecodeOffset ) ; } }


Input: Returns the abstract type corresponding to the given type descriptor . [CODESPLIT] private static int getAbstractTypeFromDescriptor ( final SymbolTable symbolTable , final String buffer , final int offset ) { String internalName ; switch ( buffer . charAt ( offset ) ) { case ' ' : return 0 ; case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : return INTEGER ; case ' ' : return FLOAT ; case ' ' : return LONG ; case ' ' : return DOUBLE ; case ' ' : internalName = buffer . substring ( offset + 1 , buffer . length ( ) - 1 ) ; return REFERENCE_KIND | symbolTable . addType ( internalName ) ; case ' ' : int elementDescriptorOffset = offset + 1 ; while ( buffer . charAt ( elementDescriptorOffset ) == ' ' ) { ++ elementDescriptorOffset ; } int typeValue ; switch ( buffer . charAt ( elementDescriptorOffset ) ) { case ' ' : typeValue = BOOLEAN ; break ; case ' ' : typeValue = CHAR ; break ; case ' ' : typeValue = BYTE ; break ; case ' ' : typeValue = SHORT ; break ; case ' ' : typeValue = INTEGER ; break ; case ' ' : typeValue = FLOAT ; break ; case ' ' : typeValue = LONG ; break ; case ' ' : typeValue = DOUBLE ; break ; case ' ' : internalName = buffer . substring ( elementDescriptorOffset + 1 , buffer . length ( ) - 1 ) ; typeValue = REFERENCE_KIND | symbolTable . addType ( internalName ) ; break ; default : throw new IllegalArgumentException ( ) ; } return ( ( elementDescriptorOffset - offset ) << DIM_SHIFT ) | typeValue ; default : throw new IllegalArgumentException ( ) ; } }


Input: Sets the input frame from the given method description . This method is used to initialize the first frame of a method which is implicit ( i . e . not stored explicitly in the StackMapTable attribute ) . [CODESPLIT] final void setInputFrameFromDescriptor ( final SymbolTable symbolTable , final int access , final String descriptor , final int maxLocals ) { inputLocals = new int [ maxLocals ] ; inputStack = new int [ 0 ] ; int inputLocalIndex = 0 ; if ( ( access & Opcodes . ACC_STATIC ) == 0 ) { if ( ( access & Constants . ACC_CONSTRUCTOR ) == 0 ) { inputLocals [ inputLocalIndex ++ ] = REFERENCE_KIND | symbolTable . addType ( symbolTable . getClassName ( ) ) ; } else { inputLocals [ inputLocalIndex ++ ] = UNINITIALIZED_THIS ; } } for ( Type argumentType : Type . getArgumentTypes ( descriptor ) ) { int abstractType = getAbstractTypeFromDescriptor ( symbolTable , argumentType . getDescriptor ( ) , 0 ) ; inputLocals [ inputLocalIndex ++ ] = abstractType ; if ( abstractType == LONG || abstractType == DOUBLE ) { inputLocals [ inputLocalIndex ++ ] = TOP ; } } while ( inputLocalIndex < maxLocals ) { inputLocals [ inputLocalIndex ++ ] = TOP ; } }


Input: Sets the input frame from the given public API frame description . [CODESPLIT] final void setInputFrameFromApiFormat ( final SymbolTable symbolTable , final int numLocal , final Object [ ] local , final int numStack , final Object [ ] stack ) { int inputLocalIndex = 0 ; for ( int i = 0 ; i < numLocal ; ++ i ) { inputLocals [ inputLocalIndex ++ ] = getAbstractTypeFromApiFormat ( symbolTable , local [ i ] ) ; if ( local [ i ] == Opcodes . LONG || local [ i ] == Opcodes . DOUBLE ) { inputLocals [ inputLocalIndex ++ ] = TOP ; } } while ( inputLocalIndex < inputLocals . length ) { inputLocals [ inputLocalIndex ++ ] = TOP ; } int numStackTop = 0 ; for ( int i = 0 ; i < numStack ; ++ i ) { if ( stack [ i ] == Opcodes . LONG || stack [ i ] == Opcodes . DOUBLE ) { ++ numStackTop ; } } inputStack = new int [ numStack + numStackTop ] ; int inputStackIndex = 0 ; for ( int i = 0 ; i < numStack ; ++ i ) { inputStack [ inputStackIndex ++ ] = getAbstractTypeFromApiFormat ( symbolTable , stack [ i ] ) ; if ( stack [ i ] == Opcodes . LONG || stack [ i ] == Opcodes . DOUBLE ) { inputStack [ inputStackIndex ++ ] = TOP ; } } outputStackTop = 0 ; initializationCount = 0 ; }


Input: Returns the abstract type stored at the given local variable index in the output frame . [CODESPLIT] private int getLocal ( final int localIndex ) { if ( outputLocals == null || localIndex >= outputLocals . length ) { // If this local has never been assigned in this basic block, it is still equal to its value // in the input frame. return LOCAL_KIND | localIndex ; } else { int abstractType = outputLocals [ localIndex ] ; if ( abstractType == 0 ) { // If this local has never been assigned in this basic block, so it is still equal to its // value in the input frame. abstractType = outputLocals [ localIndex ] = LOCAL_KIND | localIndex ; } return abstractType ; } }


Input: Replaces the abstract type stored at the given local variable index in the output frame . [CODESPLIT] private void setLocal ( final int localIndex , final int abstractType ) { // Create and/or resize the output local variables array if necessary. if ( outputLocals == null ) { outputLocals = new int [ 10 ] ; } int outputLocalsLength = outputLocals . length ; if ( localIndex >= outputLocalsLength ) { int [ ] newOutputLocals = new int [ Math . max ( localIndex + 1 , 2 * outputLocalsLength ) ] ; System . arraycopy ( outputLocals , 0 , newOutputLocals , 0 , outputLocalsLength ) ; outputLocals = newOutputLocals ; } // Set the local variable. outputLocals [ localIndex ] = abstractType ; }


Input: Pushes the given abstract type on the output frame stack . [CODESPLIT] private void push ( final int abstractType ) { // Create and/or resize the output stack array if necessary. if ( outputStack == null ) { outputStack = new int [ 10 ] ; } int outputStackLength = outputStack . length ; if ( outputStackTop >= outputStackLength ) { int [ ] newOutputStack = new int [ Math . max ( outputStackTop + 1 , 2 * outputStackLength ) ] ; System . arraycopy ( outputStack , 0 , newOutputStack , 0 , outputStackLength ) ; outputStack = newOutputStack ; } // Pushes the abstract type on the output stack. outputStack [ outputStackTop ++ ] = abstractType ; // Updates the maximum size reached by the output stack, if needed (note that this size is // relative to the input stack size, which is not known yet). short outputStackSize = ( short ) ( outputStackStart + outputStackTop ) ; if ( outputStackSize > owner . outputStackMax ) { owner . outputStackMax = outputStackSize ; } }


Input: Pushes the abstract type corresponding to the given descriptor on the output frame stack . [CODESPLIT] private void push ( final SymbolTable symbolTable , final String descriptor ) { int typeDescriptorOffset = descriptor . charAt ( 0 ) == ' ' ? descriptor . indexOf ( ' ' ) + 1 : 0 ; int abstractType = getAbstractTypeFromDescriptor ( symbolTable , descriptor , typeDescriptorOffset ) ; if ( abstractType != 0 ) { push ( abstractType ) ; if ( abstractType == LONG || abstractType == DOUBLE ) { push ( TOP ) ; } } }


Input: Pops the given number of abstract types from the output frame stack . [CODESPLIT] private void pop ( final int elements ) { if ( outputStackTop >= elements ) { outputStackTop -= elements ; } else { // If the number of elements to be popped is greater than the number of elements in the output // stack, clear it, and pop the remaining elements from the input stack. outputStackStart -= elements - outputStackTop ; outputStackTop = 0 ; } }


Input: Pops as many abstract types from the output frame stack as described by the given descriptor . [CODESPLIT] private void pop ( final String descriptor ) { char firstDescriptorChar = descriptor . charAt ( 0 ) ; if ( firstDescriptorChar == ' ' ) { pop ( ( Type . getArgumentsAndReturnSizes ( descriptor ) >> 2 ) - 1 ) ; } else if ( firstDescriptorChar == ' ' || firstDescriptorChar == ' ' ) { pop ( 2 ) ; } else { pop ( 1 ) ; } }


Input: Adds an abstract type to the list of types on which a constructor is invoked in the basic block . [CODESPLIT] private void addInitializedType ( final int abstractType ) { // Create and/or resize the initializations array if necessary. if ( initializations == null ) { initializations = new int [ 2 ] ; } int initializationsLength = initializations . length ; if ( initializationCount >= initializationsLength ) { int [ ] newInitializations = new int [ Math . max ( initializationCount + 1 , 2 * initializationsLength ) ] ; System . arraycopy ( initializations , 0 , newInitializations , 0 , initializationsLength ) ; initializations = newInitializations ; } // Store the abstract type. initializations [ initializationCount ++ ] = abstractType ; }


Input: Returns the initialized abstract type corresponding to the given abstract type . [CODESPLIT] private int getInitializedType ( final SymbolTable symbolTable , final int abstractType ) { if ( abstractType == UNINITIALIZED_THIS || ( abstractType & ( DIM_MASK | KIND_MASK ) ) == UNINITIALIZED_KIND ) { for ( int i = 0 ; i < initializationCount ; ++ i ) { int initializedType = initializations [ i ] ; int dim = initializedType & DIM_MASK ; int kind = initializedType & KIND_MASK ; int value = initializedType & VALUE_MASK ; if ( kind == LOCAL_KIND ) { initializedType = dim + inputLocals [ value ] ; } else if ( kind == STACK_KIND ) { initializedType = dim + inputStack [ inputStack . length - value ] ; } if ( abstractType == initializedType ) { if ( abstractType == UNINITIALIZED_THIS ) { return REFERENCE_KIND | symbolTable . addType ( symbolTable . getClassName ( ) ) ; } else { return REFERENCE_KIND | symbolTable . addType ( symbolTable . getType ( abstractType & VALUE_MASK ) . value ) ; } } } } return abstractType ; }


Input: Simulates the action of the given instruction on the output stack frame . [CODESPLIT] void execute ( final int opcode , final int arg , final Symbol argSymbol , final SymbolTable symbolTable ) { // Abstract types popped from the stack or read from local variables. int abstractType1 ; int abstractType2 ; int abstractType3 ; int abstractType4 ; switch ( opcode ) { case Opcodes . NOP : case Opcodes . INEG : case Opcodes . LNEG : case Opcodes . FNEG : case Opcodes . DNEG : case Opcodes . I2B : case Opcodes . I2C : case Opcodes . I2S : case Opcodes . GOTO : case Opcodes . RETURN : break ; case Opcodes . ACONST_NULL : push ( NULL ) ; break ; case Opcodes . ICONST_M1 : case Opcodes . ICONST_0 : case Opcodes . ICONST_1 : case Opcodes . ICONST_2 : case Opcodes . ICONST_3 : case Opcodes . ICONST_4 : case Opcodes . ICONST_5 : case Opcodes . BIPUSH : case Opcodes . SIPUSH : case Opcodes . ILOAD : push ( INTEGER ) ; break ; case Opcodes . LCONST_0 : case Opcodes . LCONST_1 : case Opcodes . LLOAD : push ( LONG ) ; push ( TOP ) ; break ; case Opcodes . FCONST_0 : case Opcodes . FCONST_1 : case Opcodes . FCONST_2 : case Opcodes . FLOAD : push ( FLOAT ) ; break ; case Opcodes . DCONST_0 : case Opcodes . DCONST_1 : case Opcodes . DLOAD : push ( DOUBLE ) ; push ( TOP ) ; break ; case Opcodes . LDC : switch ( argSymbol . tag ) { case Symbol . CONSTANT_INTEGER_TAG : push ( INTEGER ) ; break ; case Symbol . CONSTANT_LONG_TAG : push ( LONG ) ; push ( TOP ) ; break ; case Symbol . CONSTANT_FLOAT_TAG : push ( FLOAT ) ; break ; case Symbol . CONSTANT_DOUBLE_TAG : push ( DOUBLE ) ; push ( TOP ) ; break ; case Symbol . CONSTANT_CLASS_TAG : push ( REFERENCE_KIND | symbolTable . addType ( "java/lang/Class" ) ) ; break ; case Symbol . CONSTANT_STRING_TAG : push ( REFERENCE_KIND | symbolTable . addType ( "java/lang/String" ) ) ; break ; case Symbol . CONSTANT_METHOD_TYPE_TAG : push ( REFERENCE_KIND | symbolTable . addType ( "java/lang/invoke/MethodType" ) ) ; break ; case Symbol . CONSTANT_METHOD_HANDLE_TAG : push ( REFERENCE_KIND | symbolTable . addType ( "java/lang/invoke/MethodHandle" ) ) ; break ; case Symbol . CONSTANT_DYNAMIC_TAG : push ( symbolTable , argSymbol . value ) ; break ; default : throw new AssertionError ( ) ; } break ; case Opcodes . ALOAD : push ( getLocal ( arg ) ) ; break ; case Opcodes . LALOAD : case Opcodes . D2L : pop ( 2 ) ; push ( LONG ) ; push ( TOP ) ; break ; case Opcodes . DALOAD : case Opcodes . L2D : pop ( 2 ) ; push ( DOUBLE ) ; push ( TOP ) ; break ; case Opcodes . AALOAD : pop ( 1 ) ; abstractType1 = pop ( ) ; push ( abstractType1 == NULL ? abstractType1 : ELEMENT_OF + abstractType1 ) ; break ; case Opcodes . ISTORE : case Opcodes . FSTORE : case Opcodes . ASTORE : abstractType1 = pop ( ) ; setLocal ( arg , abstractType1 ) ; if ( arg > 0 ) { int previousLocalType = getLocal ( arg - 1 ) ; if ( previousLocalType == LONG || previousLocalType == DOUBLE ) { setLocal ( arg - 1 , TOP ) ; } else if ( ( previousLocalType & KIND_MASK ) == LOCAL_KIND || ( previousLocalType & KIND_MASK ) == STACK_KIND ) { // The type of the previous local variable is not known yet, but if it later appears // to be LONG or DOUBLE, we should then use TOP instead. setLocal ( arg - 1 , previousLocalType | TOP_IF_LONG_OR_DOUBLE_FLAG ) ; } } break ; case Opcodes . LSTORE : case Opcodes . DSTORE : pop ( 1 ) ; abstractType1 = pop ( ) ; setLocal ( arg , abstractType1 ) ; setLocal ( arg + 1 , TOP ) ; if ( arg > 0 ) { int previousLocalType = getLocal ( arg - 1 ) ; if ( previousLocalType == LONG || previousLocalType == DOUBLE ) { setLocal ( arg - 1 , TOP ) ; } else if ( ( previousLocalType & KIND_MASK ) == LOCAL_KIND || ( previousLocalType & KIND_MASK ) == STACK_KIND ) { // The type of the previous local variable is not known yet, but if it later appears // to be LONG or DOUBLE, we should then use TOP instead. setLocal ( arg - 1 , previousLocalType | TOP_IF_LONG_OR_DOUBLE_FLAG ) ; } } break ; case Opcodes . IASTORE : case Opcodes . BASTORE : case Opcodes . CASTORE : case Opcodes . SASTORE : case Opcodes . FASTORE : case Opcodes . AASTORE : pop ( 3 ) ; break ; case Opcodes . LASTORE : case Opcodes . DASTORE : pop ( 4 ) ; break ; case Opcodes . POP : case Opcodes . IFEQ : case Opcodes . IFNE : case Opcodes . IFLT : case Opcodes . IFGE : case Opcodes . IFGT : case Opcodes . IFLE : case Opcodes . IRETURN : case Opcodes . FRETURN : case Opcodes . ARETURN : case Opcodes . TABLESWITCH : case Opcodes . LOOKUPSWITCH : case Opcodes . ATHROW : case Opcodes . MONITORENTER : case Opcodes . MONITOREXIT : case Opcodes . IFNULL : case Opcodes . IFNONNULL : pop ( 1 ) ; break ; case Opcodes . POP2 : case Opcodes . IF_ICMPEQ : case Opcodes . IF_ICMPNE : case Opcodes . IF_ICMPLT : case Opcodes . IF_ICMPGE : case Opcodes . IF_ICMPGT : case Opcodes . IF_ICMPLE : case Opcodes . IF_ACMPEQ : case Opcodes . IF_ACMPNE : case Opcodes . LRETURN : case Opcodes . DRETURN : pop ( 2 ) ; break ; case Opcodes . DUP : abstractType1 = pop ( ) ; push ( abstractType1 ) ; push ( abstractType1 ) ; break ; case Opcodes . DUP_X1 : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; push ( abstractType1 ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; break ; case Opcodes . DUP_X2 : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; abstractType3 = pop ( ) ; push ( abstractType1 ) ; push ( abstractType3 ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; break ; case Opcodes . DUP2 : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; break ; case Opcodes . DUP2_X1 : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; abstractType3 = pop ( ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; push ( abstractType3 ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; break ; case Opcodes . DUP2_X2 : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; abstractType3 = pop ( ) ; abstractType4 = pop ( ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; push ( abstractType4 ) ; push ( abstractType3 ) ; push ( abstractType2 ) ; push ( abstractType1 ) ; break ; case Opcodes . SWAP : abstractType1 = pop ( ) ; abstractType2 = pop ( ) ; push ( abstractType1 ) ; push ( abstractType2 ) ; break ; case Opcodes . IALOAD : case Opcodes . BALOAD : case Opcodes . CALOAD : case Opcodes . SALOAD : case Opcodes . IADD : case Opcodes . ISUB : case Opcodes . IMUL : case Opcodes . IDIV : case Opcodes . IREM : case Opcodes . IAND : case Opcodes . IOR : case Opcodes . IXOR : case Opcodes . ISHL : case Opcodes . ISHR : case Opcodes . IUSHR : case Opcodes . L2I : case Opcodes . D2I : case Opcodes . FCMPL : case Opcodes . FCMPG : pop ( 2 ) ; push ( INTEGER ) ; break ; case Opcodes . LADD : case Opcodes . LSUB : case Opcodes . LMUL : case Opcodes . LDIV : case Opcodes . LREM : case Opcodes . LAND : case Opcodes . LOR : case Opcodes . LXOR : pop ( 4 ) ; push ( LONG ) ; push ( TOP ) ; break ; case Opcodes . FALOAD : case Opcodes . FADD : case Opcodes . FSUB : case Opcodes . FMUL : case Opcodes . FDIV : case Opcodes . FREM : case Opcodes . L2F : case Opcodes . D2F : pop ( 2 ) ; push ( FLOAT ) ; break ; case Opcodes . DADD : case Opcodes . DSUB : case Opcodes . DMUL : case Opcodes . DDIV : case Opcodes . DREM : pop ( 4 ) ; push ( DOUBLE ) ; push ( TOP ) ; break ; case Opcodes . LSHL : case Opcodes . LSHR : case Opcodes . LUSHR : pop ( 3 ) ; push ( LONG ) ; push ( TOP ) ; break ; case Opcodes . IINC : setLocal ( arg , INTEGER ) ; break ; case Opcodes . I2L : case Opcodes . F2L : pop ( 1 ) ; push ( LONG ) ; push ( TOP ) ; break ; case Opcodes . I2F : pop ( 1 ) ; push ( FLOAT ) ; break ; case Opcodes . I2D : case Opcodes . F2D : pop ( 1 ) ; push ( DOUBLE ) ; push ( TOP ) ; break ; case Opcodes . F2I : case Opcodes . ARRAYLENGTH : case Opcodes . INSTANCEOF : pop ( 1 ) ; push ( INTEGER ) ; break ; case Opcodes . LCMP : case Opcodes . DCMPL : case Opcodes . DCMPG : pop ( 4 ) ; push ( INTEGER ) ; break ; case Opcodes . JSR : case Opcodes . RET : throw new IllegalArgumentException ( "JSR/RET are not supported with computeFrames option" ) ; case Opcodes . GETSTATIC : push ( symbolTable , argSymbol . value ) ; break ; case Opcodes . PUTSTATIC : pop ( argSymbol . value ) ; break ; case Opcodes . GETFIELD : pop ( 1 ) ; push ( symbolTable , argSymbol . value ) ; break ; case Opcodes . PUTFIELD : pop ( argSymbol . value ) ; pop ( ) ; break ; case Opcodes . INVOKEVIRTUAL : case Opcodes . INVOKESPECIAL : case Opcodes . INVOKESTATIC : case Opcodes . INVOKEINTERFACE : pop ( argSymbol . value ) ; if ( opcode != Opcodes . INVOKESTATIC ) { abstractType1 = pop ( ) ; if ( opcode == Opcodes . INVOKESPECIAL && argSymbol . name . charAt ( 0 ) == ' ' ) { addInitializedType ( abstractType1 ) ; } } push ( symbolTable , argSymbol . value ) ; break ; case Opcodes . INVOKEDYNAMIC : pop ( argSymbol . value ) ; push ( symbolTable , argSymbol . value ) ; break ; case Opcodes . NEW : push ( UNINITIALIZED_KIND | symbolTable . addUninitializedType ( argSymbol . value , arg ) ) ; break ; case Opcodes . NEWARRAY : pop ( ) ; switch ( arg ) { case Opcodes . T_BOOLEAN : push ( ARRAY_OF | BOOLEAN ) ; break ; case Opcodes . T_CHAR : push ( ARRAY_OF | CHAR ) ; break ; case Opcodes . T_BYTE : push ( ARRAY_OF | BYTE ) ; break ; case Opcodes . T_SHORT : push ( ARRAY_OF | SHORT ) ; break ; case Opcodes . T_INT : push ( ARRAY_OF | INTEGER ) ; break ; case Opcodes . T_FLOAT : push ( ARRAY_OF | FLOAT ) ; break ; case Opcodes . T_DOUBLE : push ( ARRAY_OF | DOUBLE ) ; break ; case Opcodes . T_LONG : push ( ARRAY_OF | LONG ) ; break ; default : throw new IllegalArgumentException ( ) ; } break ; case Opcodes . ANEWARRAY : String arrayElementType = argSymbol . value ; pop ( ) ; if ( arrayElementType . charAt ( 0 ) == ' ' ) { push ( symbolTable , ' ' + arrayElementType ) ; } else { push ( ARRAY_OF | REFERENCE_KIND | symbolTable . addType ( arrayElementType ) ) ; } break ; case Opcodes . CHECKCAST : String castType = argSymbol . value ; pop ( ) ; if ( castType . charAt ( 0 ) == ' ' ) { push ( symbolTable , castType ) ; } else { push ( REFERENCE_KIND | symbolTable . addType ( castType ) ) ; } break ; case Opcodes . MULTIANEWARRAY : pop ( arg ) ; push ( symbolTable , argSymbol . value ) ; break ; default : throw new IllegalArgumentException ( ) ; } }


Input: Merges the type at the given index in the given abstract type array with the given type . Returns { @literal true } if the type array has been modified by this operation . [CODESPLIT] private static boolean merge ( final SymbolTable symbolTable , final int sourceType , final int [ ] dstTypes , final int dstIndex ) { int dstType = dstTypes [ dstIndex ] ; if ( dstType == sourceType ) { // If the types are equal, merge(sourceType, dstType) = dstType, so there is no change. return false ; } int srcType = sourceType ; if ( ( sourceType & ~ DIM_MASK ) == NULL ) { if ( dstType == NULL ) { return false ; } srcType = NULL ; } if ( dstType == 0 ) { // If dstTypes[dstIndex] has never been assigned, merge(srcType, dstType) = srcType. dstTypes [ dstIndex ] = srcType ; return true ; } int mergedType ; if ( ( dstType & DIM_MASK ) != 0 || ( dstType & KIND_MASK ) == REFERENCE_KIND ) { // If dstType is a reference type of any array dimension. if ( srcType == NULL ) { // If srcType is the NULL type, merge(srcType, dstType) = dstType, so there is no change. return false ; } else if ( ( srcType & ( DIM_MASK | KIND_MASK ) ) == ( dstType & ( DIM_MASK | KIND_MASK ) ) ) { // If srcType has the same array dimension and the same kind as dstType. if ( ( dstType & KIND_MASK ) == REFERENCE_KIND ) { // If srcType and dstType are reference types with the same array dimension, // merge(srcType, dstType) = dim(srcType) | common super class of srcType and dstType. mergedType = ( srcType & DIM_MASK ) | REFERENCE_KIND | symbolTable . addMergedType ( srcType & VALUE_MASK , dstType & VALUE_MASK ) ; } else { // If srcType and dstType are array types of equal dimension but different element types, // merge(srcType, dstType) = dim(srcType) - 1 | java/lang/Object. int mergedDim = ELEMENT_OF + ( srcType & DIM_MASK ) ; mergedType = mergedDim | REFERENCE_KIND | symbolTable . addType ( "java/lang/Object" ) ; } } else if ( ( srcType & DIM_MASK ) != 0 || ( srcType & KIND_MASK ) == REFERENCE_KIND ) { // If srcType is any other reference or array type, // merge(srcType, dstType) = min(srcDdim, dstDim) | java/lang/Object // where srcDim is the array dimension of srcType, minus 1 if srcType is an array type // with a non reference element type (and similarly for dstDim). int srcDim = srcType & DIM_MASK ; if ( srcDim != 0 && ( srcType & KIND_MASK ) != REFERENCE_KIND ) { srcDim = ELEMENT_OF + srcDim ; } int dstDim = dstType & DIM_MASK ; if ( dstDim != 0 && ( dstType & KIND_MASK ) != REFERENCE_KIND ) { dstDim = ELEMENT_OF + dstDim ; } mergedType = Math . min ( srcDim , dstDim ) | REFERENCE_KIND | symbolTable . addType ( "java/lang/Object" ) ; } else { // If srcType is any other type, merge(srcType, dstType) = TOP. mergedType = TOP ; } } else if ( dstType == NULL ) { // If dstType is the NULL type, merge(srcType, dstType) = srcType, or TOP if srcType is not a // an array type or a reference type. mergedType = ( srcType & DIM_MASK ) != 0 || ( srcType & KIND_MASK ) == REFERENCE_KIND ? srcType : TOP ; } else { // If dstType is any other type, merge(srcType, dstType) = TOP whatever srcType. mergedType = TOP ; } if ( mergedType != dstType ) { dstTypes [ dstIndex ] = mergedType ; return true ; } return false ; }


Input: Makes the given { @link MethodWriter } visit the input frame of this { @link Frame } . The visit is done with the { @link MethodWriter#visitFrameStart } { @link MethodWriter#visitAbstractType } and { @link MethodWriter#visitFrameEnd } methods . [CODESPLIT] final void accept ( final MethodWriter methodWriter ) { // Compute the number of locals, ignoring TOP types that are just after a LONG or a DOUBLE, and // all trailing TOP types. int [ ] localTypes = inputLocals ; int numLocal = 0 ; int numTrailingTop = 0 ; int i = 0 ; while ( i < localTypes . length ) { int localType = localTypes [ i ] ; i += ( localType == LONG || localType == DOUBLE ) ? 2 : 1 ; if ( localType == TOP ) { numTrailingTop ++ ; } else { numLocal += numTrailingTop + 1 ; numTrailingTop = 0 ; } } // Compute the stack size, ignoring TOP types that are just after a LONG or a DOUBLE. int [ ] stackTypes = inputStack ; int numStack = 0 ; i = 0 ; while ( i < stackTypes . length ) { int stackType = stackTypes [ i ] ; i += ( stackType == LONG || stackType == DOUBLE ) ? 2 : 1 ; numStack ++ ; } // Visit the frame and its content. int frameIndex = methodWriter . visitFrameStart ( owner . bytecodeOffset , numLocal , numStack ) ; i = 0 ; while ( numLocal -- > 0 ) { int localType = localTypes [ i ] ; i += ( localType == LONG || localType == DOUBLE ) ? 2 : 1 ; methodWriter . visitAbstractType ( frameIndex ++ , localType ) ; } i = 0 ; while ( numStack -- > 0 ) { int stackType = stackTypes [ i ] ; i += ( stackType == LONG || stackType == DOUBLE ) ? 2 : 1 ; methodWriter . visitAbstractType ( frameIndex ++ , stackType ) ; } methodWriter . visitFrameEnd ( ) ; }


Input: Put the given abstract type in the given ByteVector using the JVMS verification_type_info format used in StackMapTable attributes . [CODESPLIT] static void putAbstractType ( final SymbolTable symbolTable , final int abstractType , final ByteVector output ) { int arrayDimensions = ( abstractType & Frame . DIM_MASK ) >> DIM_SHIFT ; if ( arrayDimensions == 0 ) { int typeValue = abstractType & VALUE_MASK ; switch ( abstractType & KIND_MASK ) { case CONSTANT_KIND : output . putByte ( typeValue ) ; break ; case REFERENCE_KIND : output . putByte ( ITEM_OBJECT ) . putShort ( symbolTable . addConstantClass ( symbolTable . getType ( typeValue ) . value ) . index ) ; break ; case UNINITIALIZED_KIND : output . putByte ( ITEM_UNINITIALIZED ) . putShort ( ( int ) symbolTable . getType ( typeValue ) . data ) ; break ; default : throw new AssertionError ( ) ; } } else { // Case of an array type, we need to build its descriptor first. StringBuilder typeDescriptor = new StringBuilder ( ) ; while ( arrayDimensions -- > 0 ) { typeDescriptor . append ( ' ' ) ; } if ( ( abstractType & KIND_MASK ) == REFERENCE_KIND ) { typeDescriptor . append ( ' ' ) . append ( symbolTable . getType ( abstractType & VALUE_MASK ) . value ) . append ( ' ' ) ; } else { switch ( abstractType & VALUE_MASK ) { case Frame . ITEM_ASM_BOOLEAN : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_ASM_BYTE : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_ASM_CHAR : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_ASM_SHORT : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_INTEGER : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_FLOAT : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_LONG : typeDescriptor . append ( ' ' ) ; break ; case Frame . ITEM_DOUBLE : typeDescriptor . append ( ' ' ) ; break ; default : throw new AssertionError ( ) ; } } output . putByte ( ITEM_OBJECT ) . putShort ( symbolTable . addConstantClass ( typeDescriptor . toString ( ) ) . index ) ; } }


Input: Prunes expired elements from the cache . Returns the number of removed objects . [CODESPLIT] @ Override protected int pruneCache ( ) { int count = 0 ; Iterator < CacheObject < K , V > > values = cacheMap . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { CacheObject co = values . next ( ) ; if ( co . isExpired ( ) ) { values . remove ( ) ; count ++ ; } } return count ; }


Input: Schedules prune . [CODESPLIT] public void schedulePrune ( final long delay ) { if ( pruneTimer != null ) { pruneTimer . cancel ( ) ; } pruneTimer = new Timer ( ) ; pruneTimer . schedule ( new TimerTask ( ) { @ Override public void run ( ) { prune ( ) ; } } , delay , delay ) ; }


Input: Visit the module corresponding to the class . [CODESPLIT] public ModuleVisitor visitModule ( final String name , final int access , final String version ) { if ( api < Opcodes . ASM6 ) { throw new UnsupportedOperationException ( "This feature requires ASM6" ) ; } if ( cv != null ) { return cv . visitModule ( name , access , version ) ; } return null ; }


Input: Visits the nest host class of the class . A nest is a set of classes of the same package that share access to their private members . One of these classes called the host lists the other members of the nest which in turn should link to the host of their nest . This method must be called only once and only if the visited class is a non - host member of a nest . A class is implicitly its own nest so it s invalid to call this method with the visited class name as argument . [CODESPLIT] public void visitNestHost ( final String nestHost ) { if ( api < Opcodes . ASM7 ) { throw new UnsupportedOperationException ( "This feature requires ASM7" ) ; } if ( cv != null ) { cv . visitNestHost ( nestHost ) ; } }


Input: Visits the enclosing class of the class . This method must be called only if the class has an enclosing class . [CODESPLIT] public void visitOuterClass ( final String owner , final String name , final String descriptor ) { if ( cv != null ) { cv . visitOuterClass ( owner , name , descriptor ) ; } }


Input: Visits an annotation of the class . [CODESPLIT] public AnnotationVisitor visitAnnotation ( final String descriptor , final boolean visible ) { if ( cv != null ) { return cv . visitAnnotation ( descriptor , visible ) ; } return null ; }


Input: Visits a member of the nest . A nest is a set of classes of the same package that share access to their private members . One of these classes called the host lists the other members of the nest which in turn should link to the host of their nest . This method must be called only if the visited class is the host of a nest . A nest host is implicitly a member of its own nest so it s invalid to call this method with the visited class name as argument . [CODESPLIT] public void visitNestMember ( final String nestMember ) { if ( api < Opcodes . ASM7 ) { throw new UnsupportedOperationException ( "This feature requires ASM7" ) ; } if ( cv != null ) { cv . visitNestMember ( nestMember ) ; } }


Input: Visits information about an inner class . This inner class is not necessarily a member of the class being visited . [CODESPLIT] public void visitInnerClass ( final String name , final String outerName , final String innerName , final int access ) { if ( cv != null ) { cv . visitInnerClass ( name , outerName , innerName , access ) ; } }


Input: Visits a field of the class . [CODESPLIT] public FieldVisitor visitField ( final int access , final String name , final String descriptor , final String signature , final Object value ) { if ( cv != null ) { return cv . visitField ( access , name , descriptor , signature , value ) ; } return null ; }


Input: ---------------------------------------------------------------- provider [CODESPLIT] @ Override public synchronized void init ( ) { try { Class . forName ( driverClass ) ; } catch ( ClassNotFoundException cnfex ) { throw new DbSqlException ( "JDBC driver not found: " + driverClass , cnfex ) ; } }


Input: Returns existing thread session or new one if already not exist . If session doesn t exist it will be created using default connection provider . [CODESPLIT] public static DbThreadSession getThreadSession ( ) { DbThreadSession session = ( DbThreadSession ) ThreadDbSessionHolder . get ( ) ; if ( session == null ) { session = new DbThreadSession ( ) ; } return session ; }


Input: Closes thread session . [CODESPLIT] public static void closeThreadSession ( ) { DbThreadSession session = ( DbThreadSession ) ThreadDbSessionHolder . get ( ) ; if ( session != null ) { session . closeSession ( ) ; } }


Input: Creates execution array that will invoke all filters actions and results in correct order . [CODESPLIT] protected ActionWrapper [ ] createExecutionArray ( ) { int totalInterceptors = ( this . actionRuntime . getInterceptors ( ) != null ? this . actionRuntime . getInterceptors ( ) . length : 0 ) ; int totalFilters = ( this . actionRuntime . getFilters ( ) != null ? this . actionRuntime . getFilters ( ) . length : 0 ) ; ActionWrapper [ ] executionArray = new ActionWrapper [ totalFilters + 1 + totalInterceptors + 1 ] ; // filters int index = 0 ; if ( totalFilters > 0 ) { System . arraycopy ( actionRuntime . getFilters ( ) , 0 , executionArray , index , totalFilters ) ; index += totalFilters ; } // result is executed AFTER the action AND interceptors executionArray [ index ++ ] = actionRequest -> { Object actionResult = actionRequest . invoke ( ) ; ActionRequest . this . madvocController . render ( ActionRequest . this , actionResult ) ; return actionResult ; } ; // interceptors if ( totalInterceptors > 0 ) { System . arraycopy ( actionRuntime . getInterceptors ( ) , 0 , executionArray , index , totalInterceptors ) ; index += totalInterceptors ; } // action executionArray [ index ] = actionRequest -> { actionResult = invokeActionMethod ( ) ; return actionResult ; } ; return executionArray ; }


Input: Invokes action method after starting all interceptors . After method invocation all interceptors will finish in opposite order . [CODESPLIT] protected Object invokeActionMethod ( ) throws Exception { if ( actionRuntime . isActionHandlerDefined ( ) ) { actionRuntime . getActionHandler ( ) . handle ( this ) ; return null ; } final Object [ ] params = targets . extractParametersValues ( ) ; try { return actionRuntime . getActionClassMethod ( ) . invoke ( action , params ) ; } catch ( InvocationTargetException itex ) { throw wrapToException ( unwrapThrowable ( itex ) ) ; } }


Input: Reads request body only once and returns it to user . [CODESPLIT] public String readRequestBody ( ) { if ( requestBody == null ) { try { requestBody = ServletUtil . readRequestBodyFromStream ( getHttpServletRequest ( ) ) ; } catch ( IOException ioex ) { requestBody = StringPool . EMPTY ; } } return requestBody ; }


Input: Calculates the first item index of requested page . [CODESPLIT] public static int calcFirstItemIndexOfPage ( int page , final int pageSize , final int total ) { if ( total == 0 ) { return 0 ; } if ( page < 1 ) { page = 1 ; } int first = ( page - 1 ) * pageSize ; if ( first >= total ) { first = ( ( total - 1 ) / pageSize ) * pageSize ; // first item on the last page } return first ; }


Input: Calculates first item index of the page . [CODESPLIT] public static int calcFirstItemIndexOfPage ( final PageRequest pageRequest , final int total ) { return calcFirstItemIndexOfPage ( pageRequest . getPage ( ) , pageRequest . getSize ( ) , total ) ; }


Input: Parses int value or throws <code > CSSellyException< / code > on failure . [CODESPLIT] protected int parseInt ( final String value ) { try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException nfex ) { throw new CSSellyException ( nfex ) ; } }


Input: Matches expression with the value . [CODESPLIT] public boolean match ( final int value ) { if ( a == 0 ) { return value == b ; } if ( a > 0 ) { if ( value < b ) { return false ; } return ( value - b ) % a == 0 ; } if ( value > b ) { return false ; } return ( b - value ) % ( - a ) == 0 ; }


Input: Converts char array into byte array by replacing each character with two bytes . [CODESPLIT] public static byte [ ] toRawByteArray ( final char [ ] carr ) { byte [ ] barr = new byte [ carr . length << 1 ] ; for ( int i = 0 , bpos = 0 ; i < carr . length ; i ++ ) { char c = carr [ i ] ; barr [ bpos ++ ] = ( byte ) ( ( c & 0xFF00 ) >> 8 ) ; barr [ bpos ++ ] = ( byte ) ( c & 0x00FF ) ; } return barr ; }


Input: Finds index of the first character in given array the differs from the given set of characters . [CODESPLIT] public static int findFirstDiff ( final char [ ] source , final int index , final char [ ] match ) { for ( int i = index ; i < source . length ; i ++ ) { if ( ! equalsOne ( source [ i ] , match ) ) { return i ; } } return - 1 ; }


Input: Renders node name . [CODESPLIT] protected String resolveNodeName ( final Node node ) { switch ( tagCase ) { case DEFAULT : return node . getNodeName ( ) ; case RAW : return node . getNodeRawName ( ) ; case LOWERCASE : return node . getNodeRawName ( ) . toLowerCase ( ) ; case UPPERCASE : return node . getNodeRawName ( ) . toUpperCase ( ) ; } return null ; }


Input: Renders attribute name . [CODESPLIT] protected String resolveAttributeName ( final Node node , final Attribute attribute ) { switch ( attributeCase ) { case DEFAULT : return attribute . getName ( ) ; case RAW : return attribute . getRawName ( ) ; case LOWERCASE : return attribute . getRawName ( ) . toLowerCase ( ) ; case UPPERCASE : return attribute . getRawName ( ) . toUpperCase ( ) ; } return null ; }


Input: Renders attribute . [CODESPLIT] protected void renderAttribute ( final Node node , final Attribute attribute , final Appendable appendable ) throws IOException { String name = resolveAttributeName ( node , attribute ) ; String value = attribute . getValue ( ) ; appendable . append ( name ) ; if ( value != null ) { appendable . append ( ' ' ) ; appendable . append ( ' ' ) ; appendable . append ( HtmlEncoder . attributeDoubleQuoted ( value ) ) ; appendable . append ( ' ' ) ; } }


Input: Loads props from the file . Assumes UTF8 encoding unless the file ends with . properties than it uses ISO 8859 - 1 . [CODESPLIT] public Props load ( final File file ) throws IOException { final String extension = FileNameUtil . getExtension ( file . getAbsolutePath ( ) ) ; final String data ; if ( extension . equalsIgnoreCase ( "properties" ) ) { data = FileUtil . readString ( file , StringPool . ISO_8859_1 ) ; } else { data = FileUtil . readString ( file ) ; } parse ( data ) ; return this ; }


Input: Loads properties from the file in provided encoding . [CODESPLIT] public Props load ( final File file , final String encoding ) throws IOException { parse ( FileUtil . readString ( file , encoding ) ) ; return this ; }


Input: Loads properties from input stream . Stream is not closed at the end . [CODESPLIT] public Props load ( final InputStream in ) throws IOException { final Writer out = new FastCharArrayWriter ( ) ; StreamUtil . copy ( in , out ) ; parse ( out . toString ( ) ) ; return this ; }


Input: Loads base properties from the provided java properties . Null values are ignored . [CODESPLIT] public Props load ( final Map < ? , ? > p ) { for ( final Map . Entry < ? , ? > entry : p . entrySet ( ) ) { final String name = entry . getKey ( ) . toString ( ) ; final Object value = entry . getValue ( ) ; if ( value == null ) { continue ; } data . putBaseProperty ( name , value . toString ( ) , false ) ; } return this ; }


Input: Loads base properties from java Map using provided prefix . Null values are ignored . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public Props load ( final Map < ? , ? > map , final String prefix ) { String realPrefix = prefix ; realPrefix += ' ' ; for ( final Map . Entry entry : map . entrySet ( ) ) { final String name = entry . getKey ( ) . toString ( ) ; final Object value = entry . getValue ( ) ; if ( value == null ) { continue ; } data . putBaseProperty ( realPrefix + name , value . toString ( ) , false ) ; } return this ; }


Input: Loads system properties with given prefix . If prefix is <code > null< / code > it will not be ignored . [CODESPLIT] public Props loadSystemProperties ( final String prefix ) { final Properties environmentProperties = System . getProperties ( ) ; load ( environmentProperties , prefix ) ; return this ; }


Input: Loads environment properties with given prefix . If prefix is <code > null< / code > it will not be used . [CODESPLIT] public Props loadEnvironment ( final String prefix ) { final Map < String , String > environmentMap = System . getenv ( ) ; load ( environmentMap , prefix ) ; return this ; }


Input: Loads props and properties from the classpath . [CODESPLIT] public Props loadFromClasspath ( final String ... patterns ) { ClassScanner . create ( ) . registerEntryConsumer ( entryData -> { String usedEncoding = JoddCore . encoding ; if ( StringUtil . endsWithIgnoreCase ( entryData . name ( ) , ".properties" ) ) { usedEncoding = StringPool . ISO_8859_1 ; } final String encoding = usedEncoding ; UncheckedException . runAndWrapException ( ( ) -> load ( entryData . openInputStream ( ) , encoding ) ) ; } ) . includeResources ( true ) . ignoreException ( true ) . excludeCommonJars ( ) . excludeAllEntries ( true ) . includeEntries ( patterns ) . scanDefaultClasspath ( ) . start ( ) ; return this ; }


Input: Returns value of property using active profiles or default value if not found . [CODESPLIT] public String getValueOrDefault ( final String key , final String defaultValue ) { initialize ( ) ; final String value = data . lookupValue ( key , activeProfiles ) ; if ( value == null ) { return defaultValue ; } return value ; }


Input: Returns double value of given property or { [CODESPLIT] public Double getDoubleValue ( final String key ) { final String value = getValue ( key ) ; if ( value == null ) { return null ; } return Double . valueOf ( value ) ; }


Input: Returns <code > string< / code > value of given profiles . If key is not found under listed profiles base properties will be searched . Returns <code > null< / code > if property doesn t exist . [CODESPLIT] public String getValue ( final String key , final String ... profiles ) { initialize ( ) ; return data . lookupValue ( key , profiles ) ; }


Input: Sets value on some profile . [CODESPLIT] public void setValue ( final String key , final String value , final String profile ) { if ( profile == null ) { data . putBaseProperty ( key , value , false ) ; } else { data . putProfileProperty ( key , value , profile , false ) ; } initialized = false ; }


Input: Extracts props belonging to active profiles . [CODESPLIT] public void extractProps ( final Map target ) { initialize ( ) ; data . extract ( target , activeProfiles , null , null ) ; }


Input: Extract props of given profiles . [CODESPLIT] public void extractProps ( final Map target , final String ... profiles ) { initialize ( ) ; data . extract ( target , profiles , null , null ) ; }


Input: Extracts subset of properties that matches given wildcards . [CODESPLIT] public void extractSubProps ( final Map target , final String ... wildcardPatterns ) { initialize ( ) ; data . extract ( target , activeProfiles , wildcardPatterns , null ) ; }


Input: Returns inner map from the props with given prefix . Keys in returned map will not have the prefix . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public Map < String , Object > innerMap ( final String prefix ) { initialize ( ) ; return data . extract ( null , activeProfiles , null , prefix ) ; }


Input: Adds child map to the props on given prefix . [CODESPLIT] public void addInnerMap ( String prefix , final Map < ? , ? > map , final String profile ) { if ( ! StringUtil . endsWithChar ( prefix , ' ' ) ) { prefix += StringPool . DOT ; } for ( Map . Entry < ? , ? > entry : map . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; key = prefix + key ; setValue ( key , entry . getValue ( ) . toString ( ) , profile ) ; } }


Input: Resolves active profiles from special property . This property can be only a base property! If default active property is not defined nothing happens . Otherwise it will replace currently active profiles . [CODESPLIT] protected void resolveActiveProfiles ( ) { if ( activeProfilesProp == null ) { activeProfiles = null ; return ; } final PropsEntry pv = data . getBaseProperty ( activeProfilesProp ) ; if ( pv == null ) { // no active profile set as the property, exit return ; } final String value = pv . getValue ( ) ; if ( StringUtil . isBlank ( value ) ) { activeProfiles = null ; return ; } activeProfiles = StringUtil . splitc ( value , ' ' ) ; StringUtil . trimAll ( activeProfiles ) ; }


Input: Returns all profiles names . [CODESPLIT] public String [ ] getAllProfiles ( ) { String [ ] profiles = new String [ data . profileProperties . size ( ) ] ; int index = 0 ; for ( String profileName : data . profileProperties . keySet ( ) ) { profiles [ index ] = profileName ; index ++ ; } return profiles ; }


Input: Returns all the profiles that define certain prop s key name . Key name is given as a wildcard or it can be matched fully . [CODESPLIT] public String [ ] getProfilesFor ( final String propKeyNameWildcard ) { HashSet < String > profiles = new HashSet <> ( ) ; profile : for ( Map . Entry < String , Map < String , PropsEntry > > entries : data . profileProperties . entrySet ( ) ) { String profileName = entries . getKey ( ) ; Map < String , PropsEntry > value = entries . getValue ( ) ; for ( String propKeyName : value . keySet ( ) ) { if ( Wildcard . equalsOrMatch ( propKeyName , propKeyNameWildcard ) ) { profiles . add ( profileName ) ; continue profile ; } } } return profiles . toArray ( new String [ 0 ] ) ; }


Input: Adds property injection point . [CODESPLIT] protected void addPropertyInjectionPoint ( final PropertyInjectionPoint pip ) { if ( properties == null ) { properties = new PropertyInjectionPoint [ 1 ] ; properties [ 0 ] = pip ; } else { properties = ArraysUtil . append ( properties , pip ) ; } }


Input: Adds set injection point . [CODESPLIT] protected void addSetInjectionPoint ( final SetInjectionPoint sip ) { if ( sets == null ) { sets = new SetInjectionPoint [ 1 ] ; sets [ 0 ] = sip ; } else { sets = ArraysUtil . append ( sets , sip ) ; } }


Input: Adds method injection point . [CODESPLIT] protected void addMethodInjectionPoint ( final MethodInjectionPoint mip ) { if ( methods == null ) { methods = new MethodInjectionPoint [ 1 ] ; methods [ 0 ] = mip ; } else { methods = ArraysUtil . append ( methods , mip ) ; } }


Input: Adds init methods . [CODESPLIT] protected void addInitMethodPoints ( final InitMethodPoint [ ] methods ) { if ( initMethods == null ) { initMethods = methods ; } else { initMethods = ArraysUtil . join ( initMethods , methods ) ; } }


Input: Adds destroy methods . [CODESPLIT] protected void addDestroyMethodPoints ( final DestroyMethodPoint [ ] methods ) { if ( destroyMethods == null ) { destroyMethods = methods ; } else { destroyMethods = ArraysUtil . join ( destroyMethods , methods ) ; } }


Input: Returns target class if proxetta applied on given class . If not returns given class as result . [CODESPLIT] public static Class resolveTargetClass ( final Class proxy ) { final String name = proxy . getName ( ) ; if ( name . endsWith ( ProxettaNames . proxyClassNameSuffix ) ) { return proxy . getSuperclass ( ) ; } if ( name . endsWith ( ProxettaNames . wrapperClassNameSuffix ) ) { return getTargetWrapperType ( proxy ) ; } return proxy ; }


Input: Injects some target instance into { [CODESPLIT] public static void injectTargetIntoWrapper ( final Object target , final Object wrapper , final String targetFieldName ) { try { final Field field = wrapper . getClass ( ) . getField ( targetFieldName ) ; field . setAccessible ( true ) ; field . set ( wrapper , target ) ; } catch ( Exception ex ) { throw new ProxettaException ( ex ) ; } }


Input: Injects target instance into proxy using default target field name . [CODESPLIT] public static void injectTargetIntoWrapper ( final Object target , final Object wrapper ) { injectTargetIntoWrapper ( target , wrapper , ProxettaNames . wrapperTargetFieldName ) ; }


Input: Returns wrapper target type . [CODESPLIT] public static Class getTargetWrapperType ( final Class wrapperClass ) { try { final Field field = wrapperClass . getDeclaredField ( ProxettaNames . wrapperTargetFieldName ) ; return field . getType ( ) ; } catch ( NoSuchFieldException nsfex ) { throw new ProxettaException ( nsfex ) ; } }


Input: Prunes expired and if cache is still full the LFU element ( s ) from the cache . On LFU removal access count is normalized to value which had removed object . Returns the number of removed objects . [CODESPLIT] @ Override protected int pruneCache ( ) { int count = 0 ; CacheObject < K , V > comin = null ; // remove expired items and find cached object with minimal access count Iterator < CacheObject < K , V > > values = cacheMap . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { CacheObject < K , V > co = values . next ( ) ; if ( co . isExpired ( ) ) { values . remove ( ) ; onRemove ( co . key , co . cachedObject ) ; count ++ ; continue ; } if ( comin == null ) { comin = co ; } else { if ( co . accessCount < comin . accessCount ) { comin = co ; } } } if ( ! isFull ( ) ) { return count ; } // decrease access count to all cached objects if ( comin != null ) { long minAccessCount = comin . accessCount ; values = cacheMap . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { CacheObject < K , V > co = values . next ( ) ; co . accessCount -= minAccessCount ; if ( co . accessCount <= 0 ) { values . remove ( ) ; onRemove ( co . key , co . cachedObject ) ; count ++ ; } } } return count ; }