public Namespace jelly ( Class t ) { String n = t . getName ( ) ; if ( TagLibrary . class . isAssignableFrom ( t ) ) { // if the given class is a tag library itself, just record it context . registerTagLibrary ( n , n ) ; } else { String path = n . replace ( ' ' , ' ' ) ; URL res = t . getClassLoader ( ) . getResource ( path + "/taglib" ) ; if ( res != null ) { // this class itself is not a tag library, but it contains Jelly side files that are tag files. // (some of them might be views, but some of them are tag files, anyway. JellyContext parseContext = MetaClassLoader . get ( t . getClassLoader ( ) ) . loadTearOff ( JellyClassLoaderTearOff . class ) . createContext ( ) ; context . registerTagLibrary ( n , new CustomTagLibrary ( parseContext , t . getClassLoader ( ) , n , path ) ) ; } else { throw new IllegalArgumentException ( "Cannot find taglib from " + t ) ; } } return new Namespace ( this , n , "-" ) ; // doesn't matter what the prefix is, since they are known to be taglibs }
Loads a jelly tag library .