src/share/jaxws_classes/com/oracle/webservices/internal/api/message/PropertySet.java

Tue, 09 Apr 2013 14:51:13 +0100

author
alanb
date
Tue, 09 Apr 2013 14:51:13 +0100
changeset 368
0989ad8c0860
child 374
72e03566f0a6
permissions
-rw-r--r--

8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com

alanb@368 1 /*
alanb@368 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
alanb@368 3 *
alanb@368 4 * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
alanb@368 5 *
alanb@368 6 * The contents of this file are subject to the terms of either the GNU
alanb@368 7 * General Public License Version 2 only ("GPL") or the Common Development
alanb@368 8 * and Distribution License("CDDL") (collectively, the "License"). You
alanb@368 9 * may not use this file except in compliance with the License. You can
alanb@368 10 * obtain a copy of the License at
alanb@368 11 * http://glassfish.java.net/public/CDDL+GPL_1_1.html
alanb@368 12 * or packager/legal/LICENSE.txt. See the License for the specific
alanb@368 13 * language governing permissions and limitations under the License.
alanb@368 14 *
alanb@368 15 * When distributing the software, include this License Header Notice in each
alanb@368 16 * file and include the License file at packager/legal/LICENSE.txt.
alanb@368 17 *
alanb@368 18 * GPL Classpath Exception:
alanb@368 19 * Oracle designates this particular file as subject to the "Classpath"
alanb@368 20 * exception as provided by Oracle in the GPL Version 2 section of the License
alanb@368 21 * file that accompanied this code.
alanb@368 22 *
alanb@368 23 * Modifications:
alanb@368 24 * If applicable, add the following below the License Header, with the fields
alanb@368 25 * enclosed by brackets [] replaced by your own identifying information:
alanb@368 26 * "Portions Copyright [year] [name of copyright owner]"
alanb@368 27 *
alanb@368 28 * Contributor(s):
alanb@368 29 * If you wish your version of this file to be governed by only the CDDL or
alanb@368 30 * only the GPL Version 2, indicate your decision by adding "[Contributor]
alanb@368 31 * elects to include this software in this distribution under the [CDDL or GPL
alanb@368 32 * Version 2] license." If you don't indicate a single choice of license, a
alanb@368 33 * recipient has the option to distribute your version of this file under
alanb@368 34 * either the CDDL, the GPL Version 2 or to extend the choice of license to
alanb@368 35 * its licensees as provided above. However, if you add GPL Version 2 code
alanb@368 36 * and therefore, elected the GPL Version 2 license, then the option applies
alanb@368 37 * only if the new code is made subject to such option by the copyright
alanb@368 38 * holder.
alanb@368 39 */
alanb@368 40
alanb@368 41 package com.oracle.webservices.internal.api.message;
alanb@368 42
alanb@368 43 import java.lang.annotation.ElementType;
alanb@368 44 import java.lang.annotation.Inherited;
alanb@368 45 import java.lang.annotation.Retention;
alanb@368 46 import java.lang.annotation.RetentionPolicy;
alanb@368 47 import java.lang.annotation.Target;
alanb@368 48 import java.util.Map;
alanb@368 49
alanb@368 50 import javax.xml.ws.handler.MessageContext;
alanb@368 51
alanb@368 52 /**
alanb@368 53 * A set of "properties" that can be accessed via strongly-typed fields
alanb@368 54 * as well as reflexibly through the property name.
alanb@368 55 *
alanb@368 56 * @author Kohsuke Kawaguchi
alanb@368 57 */
alanb@368 58 public interface PropertySet {
alanb@368 59
alanb@368 60 /**
alanb@368 61 * Marks a field on {@link PropertySet} as a
alanb@368 62 * property of {@link MessageContext}.
alanb@368 63 *
alanb@368 64 * <p>
alanb@368 65 * To make the runtime processing easy, this annotation
alanb@368 66 * must be on a public field (since the property name
alanb@368 67 * can be set through {@link Map} anyway, you won't be
alanb@368 68 * losing abstraction by doing so.)
alanb@368 69 *
alanb@368 70 * <p>
alanb@368 71 * For similar reason, this annotation can be only placed
alanb@368 72 * on a reference type, not primitive type.
alanb@368 73 *
alanb@368 74 * @author Kohsuke Kawaguchi
alanb@368 75 */
alanb@368 76 @Inherited
alanb@368 77 @Retention(RetentionPolicy.RUNTIME)
alanb@368 78 @Target({ElementType.FIELD,ElementType.METHOD})
alanb@368 79 public @interface Property {
alanb@368 80 /**
alanb@368 81 * Name of the property.
alanb@368 82 */
alanb@368 83 String[] value();
alanb@368 84 }
alanb@368 85
alanb@368 86 public boolean containsKey(Object key);
alanb@368 87
alanb@368 88 /**
alanb@368 89 * Gets the name of the property.
alanb@368 90 *
alanb@368 91 * @param key
alanb@368 92 * This field is typed as {@link Object} to follow the {@link Map#get(Object)}
alanb@368 93 * convention, but if anything but {@link String} is passed, this method
alanb@368 94 * just returns null.
alanb@368 95 */
alanb@368 96 public Object get(Object key);
alanb@368 97
alanb@368 98 /**
alanb@368 99 * Sets a property.
alanb@368 100 *
alanb@368 101 * <h3>Implementation Note</h3>
alanb@368 102 * This method is slow. Code inside JAX-WS should define strongly-typed
alanb@368 103 * fields in this class and access them directly, instead of using this.
alanb@368 104 *
alanb@368 105 * @see Property
alanb@368 106 */
alanb@368 107 public Object put(String key, Object value);
alanb@368 108
alanb@368 109 /**
alanb@368 110 * Checks if this {@link PropertySet} supports a property of the given name.
alanb@368 111 */
alanb@368 112 public boolean supports(Object key);
alanb@368 113
alanb@368 114 public Object remove(Object key);
alanb@368 115
alanb@368 116 /**
alanb@368 117 * Creates a {@link Map} view of this {@link PropertySet}.
alanb@368 118 *
alanb@368 119 * <p>
alanb@368 120 * This map is partially live, in the sense that values you set to it
alanb@368 121 * will be reflected to {@link PropertySet}.
alanb@368 122 *
alanb@368 123 * <p>
alanb@368 124 * However, this map may not pick up changes made
alanb@368 125 * to {@link PropertySet} after the view is created.
alanb@368 126 *
alanb@368 127 * @deprecated use newer implementation {@link com.sun.xml.internal.ws.api.PropertySet#asMap()} which produces
alanb@368 128 * readwrite {@link Map}
alanb@368 129 *
alanb@368 130 * @return
alanb@368 131 * always non-null valid instance.
alanb@368 132 */
alanb@368 133 @Deprecated
alanb@368 134 public Map<String,Object> createMapView();
alanb@368 135
alanb@368 136 /**
alanb@368 137 * Creates a modifiable {@link Map} view of this {@link PropertySet}.
alanb@368 138 * <p/>
alanb@368 139 * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to
alanb@368 140 * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet}
alanb@368 141 * object are automatically reflected in this {@link Map}.
alanb@368 142 * <p/>
alanb@368 143 * If necessary, it also can hold other values (not present on {@link PropertySet}) -
alanb@368 144 * {@see PropertySet#mapAllowsAdditionalProperties}
alanb@368 145 *
alanb@368 146 * @return always non-null valid instance.
alanb@368 147 */
alanb@368 148 public Map<String, Object> asMap();
alanb@368 149 }

mercurial