public <T extends AbstractJaxb> boolean replace(T target, T replacement)
            throws TagTypeUnmatchException {
        String id = target.getId();
        if (id == null) {
            for (int i = 0; i < 256; i++) {
                id = UUID.randomUUID().toString();
                if (this.getById(id) == null && replacement.getById(id) == null) {
                    target.setId(id);
                    break;
                }
            }
        }
        return ReplaceByIdUtil.replaceById(id, this, replacement);
    }
public < T extends AbstractJaxb > boolean replace ( T target , T replacement ) throws TagTypeUnmatchException { String id = target . getId ( ) ; if ( id == null ) { for ( int i = 0 ; i < 256 ; i ++ ) { id = UUID . randomUUID ( ) . toString ( ) ; if ( this . getById ( id ) == null && replacement . getById ( id ) == null ) { target . setId ( id ) ; break ; } } } return ReplaceByIdUtil . replaceById ( id , this , replacement ) ; }
<p>
replace element that has specified attribute within descendant element of
oneself. you can't replace oneself. It will be replaced by deep copy of
"replacement"
</p>

@param target
@param replacement
@return if success to replace, return true. if no hit, return false.
@throws TagTypeUnmatchException