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

changeset 368
0989ad8c0860
child 374
72e03566f0a6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/PropertySet.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -0,0 +1,149 @@
     1.4 +/*
     1.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 + *
     1.7 + * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
     1.8 + *
     1.9 + * The contents of this file are subject to the terms of either the GNU
    1.10 + * General Public License Version 2 only ("GPL") or the Common Development
    1.11 + * and Distribution License("CDDL") (collectively, the "License").  You
    1.12 + * may not use this file except in compliance with the License.  You can
    1.13 + * obtain a copy of the License at
    1.14 + * http://glassfish.java.net/public/CDDL+GPL_1_1.html
    1.15 + * or packager/legal/LICENSE.txt.  See the License for the specific
    1.16 + * language governing permissions and limitations under the License.
    1.17 + *
    1.18 + * When distributing the software, include this License Header Notice in each
    1.19 + * file and include the License file at packager/legal/LICENSE.txt.
    1.20 + *
    1.21 + * GPL Classpath Exception:
    1.22 + * Oracle designates this particular file as subject to the "Classpath"
    1.23 + * exception as provided by Oracle in the GPL Version 2 section of the License
    1.24 + * file that accompanied this code.
    1.25 + *
    1.26 + * Modifications:
    1.27 + * If applicable, add the following below the License Header, with the fields
    1.28 + * enclosed by brackets [] replaced by your own identifying information:
    1.29 + * "Portions Copyright [year] [name of copyright owner]"
    1.30 + *
    1.31 + * Contributor(s):
    1.32 + * If you wish your version of this file to be governed by only the CDDL or
    1.33 + * only the GPL Version 2, indicate your decision by adding "[Contributor]
    1.34 + * elects to include this software in this distribution under the [CDDL or GPL
    1.35 + * Version 2] license."  If you don't indicate a single choice of license, a
    1.36 + * recipient has the option to distribute your version of this file under
    1.37 + * either the CDDL, the GPL Version 2 or to extend the choice of license to
    1.38 + * its licensees as provided above.  However, if you add GPL Version 2 code
    1.39 + * and therefore, elected the GPL Version 2 license, then the option applies
    1.40 + * only if the new code is made subject to such option by the copyright
    1.41 + * holder.
    1.42 + */
    1.43 +
    1.44 +package com.oracle.webservices.internal.api.message;
    1.45 +
    1.46 +import java.lang.annotation.ElementType;
    1.47 +import java.lang.annotation.Inherited;
    1.48 +import java.lang.annotation.Retention;
    1.49 +import java.lang.annotation.RetentionPolicy;
    1.50 +import java.lang.annotation.Target;
    1.51 +import java.util.Map;
    1.52 +
    1.53 +import javax.xml.ws.handler.MessageContext;
    1.54 +
    1.55 +/**
    1.56 + * A set of "properties" that can be accessed via strongly-typed fields
    1.57 + * as well as reflexibly through the property name.
    1.58 + *
    1.59 + * @author Kohsuke Kawaguchi
    1.60 + */
    1.61 +public interface PropertySet {
    1.62 +
    1.63 +    /**
    1.64 +     * Marks a field on {@link PropertySet} as a
    1.65 +     * property of {@link MessageContext}.
    1.66 +     *
    1.67 +     * <p>
    1.68 +     * To make the runtime processing easy, this annotation
    1.69 +     * must be on a public field (since the property name
    1.70 +     * can be set through {@link Map} anyway, you won't be
    1.71 +     * losing abstraction by doing so.)
    1.72 +     *
    1.73 +     * <p>
    1.74 +     * For similar reason, this annotation can be only placed
    1.75 +     * on a reference type, not primitive type.
    1.76 +     *
    1.77 +     * @author Kohsuke Kawaguchi
    1.78 +     */
    1.79 +    @Inherited
    1.80 +    @Retention(RetentionPolicy.RUNTIME)
    1.81 +    @Target({ElementType.FIELD,ElementType.METHOD})
    1.82 +    public @interface Property {
    1.83 +        /**
    1.84 +         * Name of the property.
    1.85 +         */
    1.86 +        String[] value();
    1.87 +    }
    1.88 +
    1.89 +    public boolean containsKey(Object key);
    1.90 +
    1.91 +    /**
    1.92 +     * Gets the name of the property.
    1.93 +     *
    1.94 +     * @param key
    1.95 +     *      This field is typed as {@link Object} to follow the {@link Map#get(Object)}
    1.96 +     *      convention, but if anything but {@link String} is passed, this method
    1.97 +     *      just returns null.
    1.98 +     */
    1.99 +    public Object get(Object key);
   1.100 +
   1.101 +    /**
   1.102 +     * Sets a property.
   1.103 +     *
   1.104 +     * <h3>Implementation Note</h3>
   1.105 +     * This method is slow. Code inside JAX-WS should define strongly-typed
   1.106 +     * fields in this class and access them directly, instead of using this.
   1.107 +     *
   1.108 +     * @see Property
   1.109 +     */
   1.110 +    public Object put(String key, Object value);
   1.111 +
   1.112 +    /**
   1.113 +     * Checks if this {@link PropertySet} supports a property of the given name.
   1.114 +     */
   1.115 +    public boolean supports(Object key);
   1.116 +
   1.117 +    public Object remove(Object key);
   1.118 +
   1.119 +    /**
   1.120 +     * Creates a {@link Map} view of this {@link PropertySet}.
   1.121 +     *
   1.122 +     * <p>
   1.123 +     * This map is partially live, in the sense that values you set to it
   1.124 +     * will be reflected to {@link PropertySet}.
   1.125 +     *
   1.126 +     * <p>
   1.127 +     * However, this map may not pick up changes made
   1.128 +     * to {@link PropertySet} after the view is created.
   1.129 +     *
   1.130 +     * @deprecated use newer implementation {@link com.sun.xml.internal.ws.api.PropertySet#asMap()} which produces
   1.131 +     * readwrite {@link Map}
   1.132 +     *
   1.133 +     * @return
   1.134 +     *      always non-null valid instance.
   1.135 +     */
   1.136 +    @Deprecated
   1.137 +    public Map<String,Object> createMapView();
   1.138 +
   1.139 +    /**
   1.140 +     * Creates a modifiable {@link Map} view of this {@link PropertySet}.
   1.141 +     * <p/>
   1.142 +     * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to
   1.143 +     * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet}
   1.144 +     * object are automatically reflected in this {@link Map}.
   1.145 +     * <p/>
   1.146 +     * If necessary, it also can hold other values (not present on {@link PropertySet}) -
   1.147 +     * {@see PropertySet#mapAllowsAdditionalProperties}
   1.148 +     *
   1.149 +     * @return always non-null valid instance.
   1.150 +     */
   1.151 +    public Map<String, Object> asMap();
   1.152 +}

mercurial