private void compileTagHandlerPoolList ( Node . Nodes page ) throws JasperException { class TagHandlerPoolVisitor extends Node . Visitor { private Set < String > names = new HashSet < String > ( ) ; /* * Constructor * * @param v Set of tag handler pool names to populate */ TagHandlerPoolVisitor ( Set < String > v ) { names = v ; } /* * Gets the name of the tag handler pool for the given custom tag * and adds it to the list of tag handler pool names unless it is * already contained in it. */ public void visit ( Node . CustomTag n ) throws JasperException { if ( ! n . implementsSimpleTag ( ) ) { String name = createTagHandlerPoolName ( n . getPrefix ( ) , n . getLocalName ( ) , n . getAttributes ( ) , n . hasEmptyBody ( ) ) ; n . setTagHandlerPoolName ( name ) ; if ( ! names . contains ( name ) ) { names . add ( name ) ; } } visitBody ( n ) ; } /* * Creates the name of the tag handler pool whose tag handlers may * be (re)used to service this action. * * @return The name of the tag handler pool */ private String createTagHandlerPoolName ( String prefix , String shortName , Attributes attrs , boolean hasEmptyBody ) { String poolName = null ; poolName = "_jspx_tagPool_" + prefix + "_" + shortName ; if ( attrs != null ) { String [ ] attrNames = new String [ attrs . getLength ( ) ] ; for ( int i = 0 ; i < attrNames . length ; i ++ ) { attrNames [ i ] = attrs . getQName ( i ) ; } Arrays . sort ( attrNames , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < attrNames . length ; i ++ ) { poolName = poolName + "_" + attrNames [ i ] ; } } if ( hasEmptyBody ) { poolName = poolName + "_nobody" ; } return JspUtil . makeXmlJavaIdentifier ( poolName ) ; } } page . visit ( new TagHandlerPoolVisitor ( tagHandlerPoolNames ) ) ; }
Compiles list of tag handler pool names .