Path: blob/master/src/jdk.dynalink/share/classes/jdk/dynalink/StandardOperation.java
41154 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* This file is available under and governed by the GNU General Public27* License version 2 only, as published by the Free Software Foundation.28* However, the following notice accompanied the original version of this29* file, and Oracle licenses the original version of this file under the BSD30* license:31*/32/*33Copyright 2015 Attila Szegedi3435Redistribution and use in source and binary forms, with or without36modification, are permitted provided that the following conditions are37met:38* Redistributions of source code must retain the above copyright39notice, this list of conditions and the following disclaimer.40* Redistributions in binary form must reproduce the above copyright41notice, this list of conditions and the following disclaimer in the42documentation and/or other materials provided with the distribution.43* Neither the name of the copyright holder nor the names of44contributors may be used to endorse or promote products derived from45this software without specific prior written permission.4647THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS48IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED49TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A50PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER51BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR52CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF53SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR54BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,55WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR56OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF57ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.58*/5960package jdk.dynalink;6162/**63* Defines the standard dynamic operations. The operations {@link #GET} and {@link #SET} must64* be used as part of a {@link NamespaceOperation}. {@link NamedOperation} can then be further used on these65* {@link NamespaceOperation}s to bind the name parameter of {@link #GET} and {@link #SET} operations, in which case it66* disappears from their type signature.67* {@link NamedOperation} can also be used to decorate {@link #CALL} and {@link #NEW} operations with a68* diagnostic name, and as such it does not affect their type signature.69*/70public enum StandardOperation implements Operation {71/**72* Get the value from a namespace defined on an object. Call sites with this73* operation should have a signature of74* <code>(receiver, name)→value</code> or75* <code>(receiver)→value</code> when used with {@link NamedOperation}, with76* all parameters and return type being of any type (either primitive or77* reference). This operation must always be used as part of a {@link NamespaceOperation}.78*/79GET,80/**81* Set the value in a namespace defined on an object. Call sites with this82* operation should have a signature of83* <code>(receiver, name, value)→void</code> or84* <code>(receiver, value)→void</code> when used with {@link NamedOperation},85* with all parameters and return type being of any type (either primitive86* or reference). This operation must always be used as part of a {@link NamespaceOperation}.87*/88SET,89/**90* Removes the value from a namespace defined on an object. Call sites with this91* operation should have a signature of92* <code>(receiver, name)→void</code> or93* <code>(receiver)→void</code> when used with {@link NamedOperation},94* with all parameters being of any type (either primitive95* or reference). This operation must always be used as part of a {@link NamespaceOperation}.96*/97REMOVE,98/**99* Call a callable object. Call sites with this operation should have a100* signature of <code>(callable, receiver, arguments...)→value</code>,101* with all parameters and return type being of any type (either primitive or102* reference). Typically, the callables are presumed to be methods of an object, so103* an explicit receiver value is always passed to the callable before the arguments.104* If a callable has no concept of a receiver, it is free to ignore the value of the105* receiver argument.106* The {@code CALL} operation is allowed to be used with a107* {@link NamedOperation} even though it does not take a name. Using it with108* a named operation won't affect its signature; the name is solely meant to109* be used as a diagnostic description for error messages.110*/111CALL,112/**113* Call a constructor object. Call sites with this operation should have a114* signature of <code>(constructor, arguments...)→value</code>, with all115* parameters and return type being of any type (either primitive or116* reference). The {@code NEW} operation is allowed to be used with a117* {@link NamedOperation} even though it does not take a name. Using it with118* a named operation won't affect its signature; the name is solely meant to119* be used as a diagnostic description for error messages.120*/121NEW122}123124125