Function.java revision 1312:d1689c1df3aa
1233294Sstas/* 2178825Sdfr * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. 3178825Sdfr * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4120945Snectar * 5178825Sdfr * This code is free software; you can redistribute it and/or modify it 6178825Sdfr * under the terms of the GNU General Public License version 2 only, as 7178825Sdfr * published by the Free Software Foundation. Oracle designates this 8120945Snectar * particular file as subject to the "Classpath" exception as provided 9178825Sdfr * by Oracle in the LICENSE file that accompanied this code. 10178825Sdfr * 11120945Snectar * This code is distributed in the hope that it will be useful, but WITHOUT 12178825Sdfr * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13178825Sdfr * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14178825Sdfr * version 2 for more details (a copy is included in the LICENSE file that 15120945Snectar * accompanied this code). 16178825Sdfr * 17178825Sdfr * You should have received a copy of the GNU General Public License version 18178825Sdfr * 2 along with this work; if not, write to the Free Software Foundation, 19120945Snectar * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20178825Sdfr * 21178825Sdfr * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22178825Sdfr * or visit www.oracle.com if you need additional information or have any 23178825Sdfr * questions. 24178825Sdfr */ 25178825Sdfr 26178825Sdfrpackage jdk.nashorn.internal.objects.annotations; 27178825Sdfr 28178825Sdfrimport static jdk.nashorn.internal.objects.annotations.Attribute.DEFAULT_ATTRIBUTES; 29178825Sdfr 30178825Sdfrimport java.lang.annotation.ElementType; 31178825Sdfrimport java.lang.annotation.Retention; 32233294Sstasimport java.lang.annotation.RetentionPolicy; 33178825Sdfrimport java.lang.annotation.Target; 34178825Sdfr 35120945Snectar/** 36120945Snectar * Annotation to specify a JavaScript "function" property. 37120945Snectar * Note that -1 means varargs. So, -2 is used as invalid arity. 38120945Snectar * 39120945Snectar */ 40120945Snectar@Retention(RetentionPolicy.RUNTIME) 41120945Snectar@Target(ElementType.METHOD) 42120945Snectarpublic @interface Function { 43120945Snectar /** 44120945Snectar * @return the name of the property. If empty, the name is inferred. 45120945Snectar */ 46120945Snectar public String name() default ""; 47120945Snectar 48120945Snectar /** 49120945Snectar * @return the attribute flags for this function. 50120945Snectar */ 51120945Snectar public int attributes() default DEFAULT_ATTRIBUTES; 52120945Snectar 53120945Snectar /** 54120945Snectar * @return the arity of the function. By default computed from the method 55120945Snectar * signature. 56120945Snectar */ 57120945Snectar public int arity() default -2; 58120945Snectar 59120945Snectar /** 60120945Snectar * @return where this function lives. 61120945Snectar */ 62178825Sdfr public Where where() default Where.PROTOTYPE; 63178825Sdfr} 64120945Snectar