private Object _deserializeComponent ( Element elComp ) throws ConverterException { // String type=elStruct.getAttribute("type"); String name = elComp . getAttribute ( "name" ) ; String md5 = elComp . getAttribute ( "md5" ) ; // TLPC PageContext pc = ThreadLocalPageContext . get ( ) ; // Load comp Component comp = null ; try { comp = pc . loadComponent ( name ) ; if ( ! ComponentUtil . md5 ( comp ) . equals ( md5 ) ) { throw new ConverterException ( "component [" + name + "] in this enviroment has not the same interface as the component to load, it is possible that one off the components has Functions added dynamicly." ) ; } } catch ( ConverterException e ) { throw e ; } catch ( Exception e ) { throw new ConverterException ( e . getMessage ( ) ) ; } NodeList list = elComp . getChildNodes ( ) ; ComponentScope scope = comp . getComponentScope ( ) ; int len = list . getLength ( ) ; String scopeName ; Element var , value ; Collection . Key key ; for ( int i = 0 ; i < len ; i ++ ) { Node node = list . item ( i ) ; if ( node instanceof Element ) { var = ( Element ) node ; value = getChildElement ( ( Element ) node ) ; scopeName = var . getAttribute ( "scope" ) ; if ( value != null ) { key = Caster . toKey ( var . getAttribute ( "name" ) , null ) ; if ( key == null ) continue ; if ( "variables" . equalsIgnoreCase ( scopeName ) ) scope . setEL ( key , _deserialize ( value ) ) ; else comp . setEL ( key , _deserialize ( value ) ) ; } } } return comp ; }
Desirialize a Component Object