@ SuppressWarnings ( "unchecked" ) private < T > T parseElement ( Element element , Class < T > cls ) { T value ; if ( element == null ) { value = null ; } else if ( MwsObject . class . isAssignableFrom ( cls ) ) { value = MwsUtl . newInstance ( cls ) ; Element holdElement = currentElement ; Node holdChild = currentChild ; setCurrentElement ( element ) ; ( ( MwsObject ) value ) . readFragmentFrom ( this ) ; currentElement = holdElement ; currentChild = holdChild ; } else if ( cls == Object . class ) { value = ( T ) element ; } else { String v = getElementText ( element ) ; value = parseString ( v , cls ) ; } return value ; }
Read an element into a new instance of a class .