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 Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,134 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, 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.oracle.webservices.internal.api.message; 1.30 + 1.31 +import java.lang.annotation.ElementType; 1.32 +import java.lang.annotation.Inherited; 1.33 +import java.lang.annotation.Retention; 1.34 +import java.lang.annotation.RetentionPolicy; 1.35 +import java.lang.annotation.Target; 1.36 +import java.util.Map; 1.37 + 1.38 +import javax.xml.ws.handler.MessageContext; 1.39 + 1.40 +/** 1.41 + * A set of "properties" that can be accessed via strongly-typed fields 1.42 + * as well as reflexibly through the property name. 1.43 + * 1.44 + * @author Kohsuke Kawaguchi 1.45 + */ 1.46 +public interface PropertySet { 1.47 + 1.48 + /** 1.49 + * Marks a field on {@link PropertySet} as a 1.50 + * property of {@link MessageContext}. 1.51 + * 1.52 + * <p> 1.53 + * To make the runtime processing easy, this annotation 1.54 + * must be on a public field (since the property name 1.55 + * can be set through {@link Map} anyway, you won't be 1.56 + * losing abstraction by doing so.) 1.57 + * 1.58 + * <p> 1.59 + * For similar reason, this annotation can be only placed 1.60 + * on a reference type, not primitive type. 1.61 + * 1.62 + * @author Kohsuke Kawaguchi 1.63 + */ 1.64 + @Inherited 1.65 + @Retention(RetentionPolicy.RUNTIME) 1.66 + @Target({ElementType.FIELD,ElementType.METHOD}) 1.67 + public @interface Property { 1.68 + /** 1.69 + * Name of the property. 1.70 + */ 1.71 + String[] value(); 1.72 + } 1.73 + 1.74 + public boolean containsKey(Object key); 1.75 + 1.76 + /** 1.77 + * Gets the name of the property. 1.78 + * 1.79 + * @param key 1.80 + * This field is typed as {@link Object} to follow the {@link Map#get(Object)} 1.81 + * convention, but if anything but {@link String} is passed, this method 1.82 + * just returns null. 1.83 + */ 1.84 + public Object get(Object key); 1.85 + 1.86 + /** 1.87 + * Sets a property. 1.88 + * 1.89 + * <h3>Implementation Note</h3> 1.90 + * This method is slow. Code inside JAX-WS should define strongly-typed 1.91 + * fields in this class and access them directly, instead of using this. 1.92 + * 1.93 + * @see Property 1.94 + */ 1.95 + public Object put(String key, Object value); 1.96 + 1.97 + /** 1.98 + * Checks if this {@link PropertySet} supports a property of the given name. 1.99 + */ 1.100 + public boolean supports(Object key); 1.101 + 1.102 + public Object remove(Object key); 1.103 + 1.104 + /** 1.105 + * Creates a {@link Map} view of this {@link PropertySet}. 1.106 + * 1.107 + * <p> 1.108 + * This map is partially live, in the sense that values you set to it 1.109 + * will be reflected to {@link PropertySet}. 1.110 + * 1.111 + * <p> 1.112 + * However, this map may not pick up changes made 1.113 + * to {@link PropertySet} after the view is created. 1.114 + * 1.115 + * @deprecated use newer implementation {@link com.sun.xml.internal.ws.api.PropertySet#asMap()} which produces 1.116 + * readwrite {@link Map} 1.117 + * 1.118 + * @return 1.119 + * always non-null valid instance. 1.120 + */ 1.121 + @Deprecated 1.122 + public Map<String,Object> createMapView(); 1.123 + 1.124 + /** 1.125 + * Creates a modifiable {@link Map} view of this {@link PropertySet}. 1.126 + * <p/> 1.127 + * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to 1.128 + * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet} 1.129 + * object are automatically reflected in this {@link Map}. 1.130 + * <p/> 1.131 + * If necessary, it also can hold other values (not present on {@link PropertySet}) - 1.132 + * {@see PropertySet#mapAllowsAdditionalProperties} 1.133 + * 1.134 + * @return always non-null valid instance. 1.135 + */ 1.136 + public Map<String, Object> asMap(); 1.137 +}