001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.xml.internal.bind.v2.runtime;
027:
028: import java.io.IOException;
029: import java.lang.reflect.InvocationTargetException;
030:
031: import javax.xml.bind.ValidationEvent;
032: import javax.xml.bind.helpers.ValidationEventImpl;
033: import javax.xml.stream.XMLStreamException;
034:
035: import com.sun.xml.internal.bind.api.CompositeStructure;
036: import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader;
037: import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
038:
039: import org.xml.sax.SAXException;
040:
041: /**
042: * @author Kohsuke Kawaguchi
043: */
044: public class CompositeStructureBeanInfo extends
045: JaxBeanInfo<CompositeStructure> {
046: public CompositeStructureBeanInfo(JAXBContextImpl context) {
047: super (context, null, CompositeStructure.class, false, true,
048: false);
049: }
050:
051: public String getElementNamespaceURI(CompositeStructure o) {
052: throw new UnsupportedOperationException();
053: }
054:
055: public String getElementLocalName(CompositeStructure o) {
056: throw new UnsupportedOperationException();
057: }
058:
059: public CompositeStructure createInstance(
060: UnmarshallingContext context)
061: throws IllegalAccessException, InvocationTargetException,
062: InstantiationException, SAXException {
063: throw new UnsupportedOperationException();
064: }
065:
066: public boolean reset(CompositeStructure o,
067: UnmarshallingContext context) throws SAXException {
068: throw new UnsupportedOperationException();
069: }
070:
071: public String getId(CompositeStructure o, XMLSerializer target)
072: throws SAXException {
073: return null;
074: }
075:
076: public Loader getLoader(JAXBContextImpl context,
077: boolean typeSubstitutionCapable) {
078: // no unmarshaller support for this.
079: throw new UnsupportedOperationException();
080: }
081:
082: public void serializeRoot(CompositeStructure o, XMLSerializer target)
083: throws SAXException, IOException, XMLStreamException {
084: target.reportError(new ValidationEventImpl(
085: ValidationEvent.ERROR,
086: Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o
087: .getClass().getName()), null, null));
088: }
089:
090: public void serializeURIs(CompositeStructure o, XMLSerializer target)
091: throws SAXException {
092: // noop
093: }
094:
095: public void serializeAttributes(CompositeStructure o,
096: XMLSerializer target) throws SAXException, IOException,
097: XMLStreamException {
098: // noop
099: }
100:
101: public void serializeBody(CompositeStructure o, XMLSerializer target)
102: throws SAXException, IOException, XMLStreamException {
103: int len = o.bridges.length;
104: for (int i = 0; i < len; i++) {
105: Object value = o.values[i];
106: InternalBridge bi = (InternalBridge) o.bridges[i];
107: bi.marshal(value, target);
108: }
109: }
110:
111: public Transducer<CompositeStructure> getTransducer() {
112: return null;
113: }
114: }
|