StandardOperation.java revision 1922:a3022cc65b17
153541Sshin/*
253541Sshin * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
353541Sshin * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
453541Sshin *
553541Sshin * This code is free software; you can redistribute it and/or modify it
653541Sshin * under the terms of the GNU General Public License version 2 only, as
753541Sshin * published by the Free Software Foundation.  Oracle designates this
853541Sshin * particular file as subject to the "Classpath" exception as provided
953541Sshin * by Oracle in the LICENSE file that accompanied this code.
1053541Sshin *
1153541Sshin * This code is distributed in the hope that it will be useful, but WITHOUT
1253541Sshin * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1353541Sshin * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1453541Sshin * version 2 for more details (a copy is included in the LICENSE file that
1553541Sshin * accompanied this code).
1653541Sshin *
1753541Sshin * You should have received a copy of the GNU General Public License version
1853541Sshin * 2 along with this work; if not, write to the Free Software Foundation,
1953541Sshin * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2053541Sshin *
2153541Sshin * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2253541Sshin * or visit www.oracle.com if you need additional information or have any
2353541Sshin * questions.
2453541Sshin */
2553541Sshin
2653541Sshin/*
2753541Sshin * This file is available under and governed by the GNU General Public
2853541Sshin * License version 2 only, as published by the Free Software Foundation.
2953541Sshin * However, the following notice accompanied the original version of this
3053541Sshin * file, and Oracle licenses the original version of this file under the BSD
3153541Sshin * license:
3253541Sshin */
3353541Sshin/*
3453541Sshin   Copyright 2015 Attila Szegedi
3553541Sshin
3653541Sshin   Licensed under both the Apache License, Version 2.0 (the "Apache License")
3753541Sshin   and the BSD License (the "BSD License"), with licensee being free to
3853541Sshin   choose either of the two at their discretion.
3953541Sshin
4053541Sshin   You may not use this file except in compliance with either the Apache
4153541Sshin   License or the BSD License.
4253541Sshin
4353541Sshin   If you choose to use this file in compliance with the Apache License, the
4453541Sshin   following notice applies to you:
4553541Sshin
4653541Sshin       You may obtain a copy of the Apache License at
4753541Sshin
4853541Sshin           http://www.apache.org/licenses/LICENSE-2.0
4953541Sshin
5053541Sshin       Unless required by applicable law or agreed to in writing, software
5153541Sshin       distributed under the License is distributed on an "AS IS" BASIS,
5253541Sshin       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
5353541Sshin       implied. See the License for the specific language governing
5453541Sshin       permissions and limitations under the License.
5553541Sshin
5653541Sshin   If you choose to use this file in compliance with the BSD License, the
5753541Sshin   following notice applies to you:
5853541Sshin
5953541Sshin       Redistribution and use in source and binary forms, with or without
6053541Sshin       modification, are permitted provided that the following conditions are
6153541Sshin       met:
6253541Sshin       * Redistributions of source code must retain the above copyright
6353541Sshin         notice, this list of conditions and the following disclaimer.
6453541Sshin       * Redistributions in binary form must reproduce the above copyright
6553541Sshin         notice, this list of conditions and the following disclaimer in the
6653541Sshin         documentation and/or other materials provided with the distribution.
6753541Sshin       * Neither the name of the copyright holder nor the names of
6853541Sshin         contributors may be used to endorse or promote products derived from
6953541Sshin         this software without specific prior written permission.
7053541Sshin
7153541Sshin       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
7253541Sshin       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
7353541Sshin       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
7453541Sshin       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
7553541Sshin       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
7653541Sshin       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
7753541Sshin       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
7853541Sshin       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
7953541Sshin       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
8053541Sshin       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
8153541Sshin       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8253541Sshin*/
8353541Sshin
8453541Sshinpackage jdk.dynalink;
8553541Sshin
8653541Sshin/**
8753541Sshin * Defines the standard dynamic operations. The operations {@link #GET} and {@link #SET} must
8853541Sshin * be used as part of a {@link NamespaceOperation}. {@link NamedOperation} can then be further used on these
8953541Sshin * {@link NamespaceOperation}s to bind the name parameter of {@link #GET} and {@link #SET} operations, in which case it
9053541Sshin * disappears from their type signature.
9153541Sshin * {@link NamedOperation} can also be used to decorate {@link #CALL} and {@link #NEW} operations with a
9253541Sshin * diagnostic name, and as such it does not affect their type signature.
9353541Sshin */
9453541Sshinpublic enum StandardOperation implements Operation {
9553541Sshin    /**
9653541Sshin     * Get the value from a namespace defined on an object. Call sites with this
9753541Sshin     * operation should have a signature of
9853541Sshin     * <code>(receiver,&nbsp;name)&rarr;value</code> or
9953541Sshin     * <code>(receiver)&rarr;value</code> when used with {@link NamedOperation}, with
10053541Sshin     * all parameters and return type being of any type (either primitive or
10153541Sshin     * reference). This operation must always be used as part of a {@link NamespaceOperation}.
10253541Sshin     */
10353541Sshin    GET,
10453541Sshin    /**
10553541Sshin     * Set the value in a namespace defined on an object. Call sites with this
10653541Sshin     * operation should have a signature of
10753541Sshin     * <code>(receiver,&nbsp;name,&nbsp;value)&rarr;void</code> or
10853541Sshin     * <code>(receiver,&nbsp;value)&rarr;void</code> when used with {@link NamedOperation},
10953541Sshin     * with all parameters and return type being of any type (either primitive
11053541Sshin     * or reference). This operation must always be used as part of a {@link NamespaceOperation}.
11153541Sshin     */
11253541Sshin    SET,
11353541Sshin    /**
11453541Sshin     * Call a callable object. Call sites with this operation should have a
11553541Sshin     * signature of <code>(callable,&nbsp;receiver,&nbsp;arguments...)&rarr;value</code>,
11653541Sshin     * with all parameters and return type being of any type (either primitive or
11753541Sshin     * reference). Typically, the callables are presumed to be methods of an object, so
11853541Sshin     * an explicit receiver value is always passed to the callable before the arguments.
11953541Sshin     * If a callable has no concept of a receiver, it is free to ignore the value of the
12053541Sshin     * receiver argument.
12153541Sshin     * The {@code CALL} operation is allowed to be used with a
12253541Sshin     * {@link NamedOperation} even though it does not take a name. Using it with
12353541Sshin     * a named operation won't affect its signature; the name is solely meant to
12453541Sshin     * be used as a diagnostic description for error messages.
12553541Sshin     */
12653541Sshin    CALL,
12753541Sshin    /**
12853541Sshin     * Call a constructor object. Call sites with this operation should have a
12953541Sshin     * signature of <code>(constructor,&nbsp;arguments...)&rarr;value</code>, with all
13053541Sshin     * parameters and return type being of any type (either primitive or
13153541Sshin     * reference). The {@code NEW} operation is allowed to be used with a
13253541Sshin     * {@link NamedOperation} even though it does not take a name. Using it with
13353541Sshin     * a named operation won't affect its signature; the name is solely meant to
13453541Sshin     * be used as a diagnostic description for error messages.
13553541Sshin     */
13653541Sshin    NEW
13753541Sshin}
13853541Sshin