1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Property.java Tue Mar 06 16:09:35 2012 -0800 1.3 @@ -0,0 +1,144 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.bind.v2.runtime.property; 1.30 + 1.31 +import java.io.IOException; 1.32 + 1.33 +import javax.xml.bind.JAXBContext; 1.34 +import javax.xml.bind.JAXBElement; 1.35 +import javax.xml.stream.XMLStreamException; 1.36 + 1.37 +import com.sun.xml.internal.bind.api.AccessorException; 1.38 +import com.sun.xml.internal.bind.v2.model.core.ID; 1.39 +import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; 1.40 +import com.sun.xml.internal.bind.v2.model.core.PropertyKind; 1.41 +import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; 1.42 +import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; 1.43 +import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; 1.44 +import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; 1.45 + 1.46 +import org.xml.sax.SAXException; 1.47 + 1.48 +/** 1.49 + * A JAXB property that constitutes a JAXB-bound bean. 1.50 + * 1.51 + * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 1.52 + */ 1.53 +public interface Property<BeanT> extends StructureLoaderBuilder { 1.54 + 1.55 +// // is this method necessary? --> probably not 1.56 +// RuntimePropertyInfo owner(); 1.57 + 1.58 + /** 1.59 + * Resets the property value on the given object. 1.60 + * 1.61 + * <p> 1.62 + * ... for example by setting 0 or null. 1.63 + */ 1.64 + void reset( BeanT o ) throws AccessorException; 1.65 + 1.66 + /** 1.67 + * @see JaxBeanInfo#serializeBody(Object, XMLSerializer) 1.68 + * 1.69 + * @param outerPeer 1.70 + * used when this property is expected to print out an element 1.71 + * and that should be associated with this outer peer. normally null. 1.72 + * this is only used for {@link JaxBeanInfo} for {@link JAXBElement}s. 1.73 + * @throws AccessorException 1.74 + * If thrown, caught by the caller and reported. 1.75 + */ 1.76 + public void serializeBody(BeanT beanT, XMLSerializer target, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException; 1.77 + 1.78 + /** 1.79 + * @see JaxBeanInfo#serializeURIs(Object, XMLSerializer) 1.80 + */ 1.81 + public void serializeURIs(BeanT beanT, XMLSerializer target) throws SAXException, AccessorException; 1.82 + 1.83 + /** 1.84 + * Returns true if 1.85 + * {@link #serializeURIs(Object,XMLSerializer)} performs some meaningful action. 1.86 + */ 1.87 + public boolean hasSerializeURIAction(); 1.88 + 1.89 +// /** 1.90 +// * Builds the unmarshaller. 1.91 +// * 1.92 +// * @param grammar 1.93 +// * the context object to which this property ultimately belongs to. 1.94 +// * a property will only belong to one grammar, but to reduce the memory footprint 1.95 +// * we don't keep that information stored in {@link Property}, and instead we 1.96 +// * just pass the value as a parameter when needed. 1.97 +// */ 1.98 +// Unmarshaller.Handler createUnmarshallerHandler(JAXBContextImpl grammar, Unmarshaller.Handler tail); 1.99 + 1.100 + /** 1.101 + * Gets the value of the property. 1.102 + * 1.103 + * This method is only used when the corresponding {@link PropertyInfo#id()} is {@link ID#ID}, 1.104 + * and therefore the return type is fixed to {@link String}. 1.105 + */ 1.106 + String getIdValue(BeanT bean) throws AccessorException, SAXException; 1.107 + 1.108 + /** 1.109 + * Gets the Kind of property 1.110 + * @return 1.111 + * always non-null. 1.112 + */ 1.113 + PropertyKind getKind(); 1.114 + 1.115 + 1.116 + // UGLY HACK to support JAX-WS 1.117 + // if other clients want to access those functionalities, 1.118 + // we should design a better model 1.119 + /** 1.120 + * If this property is mapped to the specified element, 1.121 + * return an accessor to it. 1.122 + * 1.123 + * @return 1.124 + * null if the property is not mapped to the specified element. 1.125 + */ 1.126 + Accessor getElementPropertyAccessor(String nsUri,String localName); 1.127 + 1.128 + /** 1.129 + * Called at the end of the {@link JAXBContext} initialization phase 1.130 + * to clean up any unnecessary references. 1.131 + */ 1.132 + void wrapUp(); 1.133 + 1.134 + /** 1.135 + * Provides more {@link RuntimePropertyInfo} information on the property. 1.136 + * 1.137 + * @return 1.138 + * null if RETAIN_REFERENCE_TO_INFO property is not set on the {@link JAXBContext} 1.139 + */ 1.140 + public RuntimePropertyInfo getInfo(); 1.141 + 1.142 + public boolean isHiddenByOverride(); 1.143 + 1.144 + public void setHiddenByOverride(boolean hidden); 1.145 + 1.146 + public String getFieldName(); 1.147 +}