public Composite add ( Object o ) { if ( nest != null ) nest . add ( o ) ; else { if ( o != null ) { if ( o instanceof Element ) { if ( o instanceof Page ) throw new IllegalArgumentException ( "Can't insert Page in Composite" ) ; elements . add ( o ) ; } else if ( o instanceof String ) elements . add ( o ) ; else elements . add ( o . toString ( ) ) ; } } return this ; }
Add an Object to the Composite by converting it to a Element or . String