/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Dynamically implements {@link TypedXmlWriter} interfaces.
*
* @author Kohsuke Kawaguchi
*/
/**
* Initially, point to the start tag token, but
* once we know we are done with the start tag, we will reset it to null
* so that the token sequence can be GC-ed.
*/
/**
* Namespace URI of this element.
*/
/**
* When this element can accept more child content, this value
* is non-null and holds the last child {@link Content}.
*
* If this element is committed, this parameter is null.
*/
/**
* Uncommitted {@link ContainerElement}s form a doubly-linked list,
* so that the parent can close them recursively.
*/
/**
* Set to true if the start eleent is blocked.
*/
private boolean blocked;
if(isRoot())
}
private boolean isRoot() {
}
private boolean isCommitted() {
}
return document;
}
boolean isBlocked() {
return blocked && !isCommitted();
}
public void block() {
blocked = true;
}
// forward to myself
try {
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
}
return proxy; // allow method chaining
}
return proxy; // allow method chaining
}
}
/**
* Writes an attribute.
*/
}
private void checkStartTag() {
throw new IllegalStateException("start tag has already been written");
}
/**
* Writes a new element.
*/
// the last precedence: default name
if(e!=null) {
// then the annotation on this method
}
// look for the annotation on the declaring class
}
// then default to the XmlNamespace
}
// leaf element with just a value
}
return null;
}
// sub writer
}
}
/**
* Decides the namespace URI of the given package.
*/
else
nsUri = "";
return nsUri;
}
/**
* Appends this child object to the tail.
*/
}
public void commit() {
commit(true);
}
}
if(isCommitted()) return;
if(isRoot())
addChild(new EndDocument());
// _commit predecessors if so told
if(includingAllPredecessors) {
// e.prevOpen should change as a result of committing it.
}
}
}
// _commit all children recursively
while(lastOpenChild!=null)
lastOpenChild._commit(false);
// remove this node from the link
if(parent.lastOpenChild==this) {
} else {
}
}
}
}
}
}
}
_namespace(uri,false);
}
throw new IllegalArgumentException();
}
}
// we need to allow this method even when startTag has already been completed.
// checkStartTag();
}
}
}
}
}
}
return facadeType.cast(Proxy.newProxyInstance(facadeType.getClassLoader(),new Class[]{facadeType},this));
}
public <T extends TypedXmlWriter> T _element(String nsUri, String localName, Class<T> contentModel) {
// update uncommitted link list
if(lastOpenChild!=null) {
assert lastOpenChild.parent==this;
}
this.lastOpenChild = child;
}
}