Java Doc for FunctionObject.java in  » Scripting » rhino » org » mozilla » javascript » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » rhino » org.mozilla.javascript 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mozilla.javascript.ScriptableObject
      org.mozilla.javascript.IdScriptableObject
         org.mozilla.javascript.BaseFunction
            org.mozilla.javascript.FunctionObject

FunctionObject
public class FunctionObject extends BaseFunction (Code)


Field Summary
final public static  intJAVA_BOOLEAN_TYPE
    
final public static  intJAVA_DOUBLE_TYPE
    
final public static  intJAVA_INT_TYPE
    
final public static  intJAVA_OBJECT_TYPE
    
final public static  intJAVA_SCRIPTABLE_TYPE
    
final public static  intJAVA_STRING_TYPE
    
final public static  intJAVA_UNSUPPORTED_TYPE
    
 MemberBoxmember
    
final static  longserialVersionUID
    

Constructor Summary
public  FunctionObject(String name, Member methodOrConstructor, Scriptable scope)
     Create a JavaScript function object from a Java method.

The member argument must be either a java.lang.reflect.Method or a java.lang.reflect.Constructor and must match one of two forms.

The first form is a member with zero or more parameters of the following types: Object, String, boolean, Scriptable, int, or double.


Method Summary
public  voidaddAsConstructor(Scriptable scope, Scriptable prototype)
     Define this function as a JavaScript constructor.

Sets up the "prototype" and "constructor" properties.

public  Objectcall(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
     Performs conversions on argument types if needed and invokes the underlying Java method or constructor.
public static  ObjectconvertArg(Context cx, Scriptable scope, Object arg, int typeTag)
    
public static  ObjectconvertArg(Context cx, Scriptable scope, Object arg, Class desired)
    
public  ScriptablecreateObject(Context cx, Scriptable scope)
     Return new Scriptable instance using the default constructor for the class of the underlying Java method.
static  MethodfindSingleMethod(Method[] methods, String name)
    
public  intgetArity()
     Return the value defined by the method used to construct the object (number of parameters of the method, or 1 if the method is a "varargs" form).
public  StringgetFunctionName()
    
public  intgetLength()
     Return the same value as FunctionObject.getArity() .
static  Method[]getMethodList(Class clazz)
     Returns all public methods declared by the specified class.
public  MembergetMethodOrConstructor()
     Get Java method or constructor this function represent.
public static  intgetTypeTag(Class type)
    
 voidinitAsConstructor(Scriptable scope, Scriptable prototype)
    
 booleanisVarArgsConstructor()
    
 booleanisVarArgsMethod()
    

Field Detail
JAVA_BOOLEAN_TYPE
final public static int JAVA_BOOLEAN_TYPE(Code)



JAVA_DOUBLE_TYPE
final public static int JAVA_DOUBLE_TYPE(Code)



JAVA_INT_TYPE
final public static int JAVA_INT_TYPE(Code)



JAVA_OBJECT_TYPE
final public static int JAVA_OBJECT_TYPE(Code)



JAVA_SCRIPTABLE_TYPE
final public static int JAVA_SCRIPTABLE_TYPE(Code)



JAVA_STRING_TYPE
final public static int JAVA_STRING_TYPE(Code)



JAVA_UNSUPPORTED_TYPE
final public static int JAVA_UNSUPPORTED_TYPE(Code)



member
MemberBox member(Code)



serialVersionUID
final static long serialVersionUID(Code)




Constructor Detail
FunctionObject
public FunctionObject(String name, Member methodOrConstructor, Scriptable scope)(Code)
Create a JavaScript function object from a Java method.

The member argument must be either a java.lang.reflect.Method or a java.lang.reflect.Constructor and must match one of two forms.

The first form is a member with zero or more parameters of the following types: Object, String, boolean, Scriptable, int, or double. The Long type is not supported because the double representation of a long (which is the EMCA-mandated storage type for Numbers) may lose precision. If the member is a Method, the return value must be void or one of the types allowed for parameters.

The runtime will perform appropriate conversions based upon the type of the parameter. A parameter type of Object specifies that no conversions are to be done. A parameter of type String will use Context.toString to convert arguments. Similarly, parameters of type double, boolean, and Scriptable will cause Context.toNumber, Context.toBoolean, and Context.toObject, respectively, to be called.

If the method is not static, the Java 'this' value will correspond to the JavaScript 'this' value. Any attempt to call the function with a 'this' value that is not of the right Java type will result in an error.

The second form is the variable arguments (or "varargs") form. If the FunctionObject will be used as a constructor, the member must have the following parameters

 (Context cx, Object[] args, Function ctorObj,
 boolean inNewExpr)
and if it is a Method, be static and return an Object result.

Otherwise, if the FunctionObject will not be used to define a constructor, the member must be a static Method with parameters (Context cx, Scriptable thisObj, Object[] args, Function funObj)

 and an Object result.

When the function varargs form is called as part of a function call, the args parameter contains the arguments, with thisObj set to the JavaScript 'this' value. funObj is the function object for the invoked function.

When the constructor varargs form is called or invoked while evaluating a new expression, args contains the arguments, ctorObj refers to this FunctionObject, and inNewExpr is true if and only if a new expression caused the call. This supports defining a function that has different behavior when called as a constructor than when invoked as a normal function call. (For example, the Boolean constructor, when called as a function, will convert to boolean rather than creating a new object.)


Parameters:
  name - the name of the function
Parameters:
  methodOrConstructor - a java.lang.reflect.Method or a java.lang.reflect.Constructorthat defines the object
Parameters:
  scope - enclosing scope of function
See Also:   org.mozilla.javascript.Scriptable





Method Detail
addAsConstructor
public void addAsConstructor(Scriptable scope, Scriptable prototype)(Code)
Define this function as a JavaScript constructor.

Sets up the "prototype" and "constructor" properties. Also calls setParent and setPrototype with appropriate values. Then adds the function object as a property of the given scope, using prototype.getClassName() as the name of the property.
Parameters:
  scope - the scope in which to define the constructor (typicallythe global object)
Parameters:
  prototype - the prototype object
See Also:   org.mozilla.javascript.Scriptable.setParentScope
See Also:   org.mozilla.javascript.Scriptable.setPrototype
See Also:   org.mozilla.javascript.Scriptable.getClassName




call
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)(Code)
Performs conversions on argument types if needed and invokes the underlying Java method or constructor.

Implements Function.call.
See Also:   org.mozilla.javascript.Function.call(ContextScriptableScriptableObject[])




convertArg
public static Object convertArg(Context cx, Scriptable scope, Object arg, int typeTag)(Code)



convertArg
public static Object convertArg(Context cx, Scriptable scope, Object arg, Class desired)(Code)
FunctionObject.getTypeTag(Class)FunctionObject.convertArg(Context,Scriptable,Object,int)



createObject
public Scriptable createObject(Context cx, Scriptable scope)(Code)
Return new Scriptable instance using the default constructor for the class of the underlying Java method. Return null to indicate that the call method should be used to create new objects.



findSingleMethod
static Method findSingleMethod(Method[] methods, String name)(Code)



getArity
public int getArity()(Code)
Return the value defined by the method used to construct the object (number of parameters of the method, or 1 if the method is a "varargs" form).



getFunctionName
public String getFunctionName()(Code)



getLength
public int getLength()(Code)
Return the same value as FunctionObject.getArity() .



getMethodList
static Method[] getMethodList(Class clazz)(Code)
Returns all public methods declared by the specified class. This excludes inherited methods.
Parameters:
  clazz - the class from which to pull public declared methods the public methods declared in the specified class
See Also:   Class.getDeclaredMethods



getMethodOrConstructor
public Member getMethodOrConstructor()(Code)
Get Java method or constructor this function represent.



getTypeTag
public static int getTypeTag(Class type)(Code)
One of JAVA_*_TYPE constants to indicate desired typeor FunctionObject.JAVA_UNSUPPORTED_TYPE if the convertion is notpossible



initAsConstructor
void initAsConstructor(Scriptable scope, Scriptable prototype)(Code)



isVarArgsConstructor
boolean isVarArgsConstructor()(Code)



isVarArgsMethod
boolean isVarArgsMethod()(Code)



Fields inherited from org.mozilla.javascript.BaseFunction
final static long serialVersionUID(Code)(Java Doc)

Methods inherited from org.mozilla.javascript.BaseFunction
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)(Code)(Java Doc)
public Scriptable construct(Context cx, Scriptable scope, Object[] args)(Code)(Java Doc)
public Scriptable createObject(Context cx, Scriptable scope)(Code)(Java Doc)
String decompile(int indent, int flags)(Code)(Java Doc)
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)(Code)(Java Doc)
protected void fillConstructorProperties(IdFunctionObject ctor)(Code)(Java Doc)
protected int findInstanceIdInfo(String s)(Code)(Java Doc)
protected int findPrototypeId(String s)(Code)(Java Doc)
public int getArity()(Code)(Java Doc)
public String getClassName()(Code)(Java Doc)
protected Scriptable getClassPrototype()(Code)(Java Doc)
public String getFunctionName()(Code)(Java Doc)
protected String getInstanceIdName(int id)(Code)(Java Doc)
protected Object getInstanceIdValue(int id)(Code)(Java Doc)
public int getLength()(Code)(Java Doc)
protected int getMaxInstanceId()(Code)(Java Doc)
final Object getPrototypeProperty()(Code)(Java Doc)
public boolean hasInstance(Scriptable instance)(Code)(Java Doc)
static void init(Scriptable scope, boolean sealed)(Code)(Java Doc)
protected void initPrototypeId(int id)(Code)(Java Doc)
static boolean isApply(IdFunctionObject f)(Code)(Java Doc)
static boolean isApplyOrCall(IdFunctionObject f)(Code)(Java Doc)
public void setImmunePrototypeProperty(Object value)(Code)(Java Doc)
protected void setInstanceIdValue(int id, Object value)(Code)(Java Doc)

Methods inherited from org.mozilla.javascript.IdScriptableObject
final public void activatePrototypeMap(int maxPrototypeId)(Code)(Java Doc)
protected void addIdFunctionProperty(Scriptable obj, Object tag, int id, String name, int arity)(Code)(Java Doc)
final protected Object defaultGet(String name)(Code)(Java Doc)
final protected void defaultPut(String name, Object value)(Code)(Java Doc)
public void delete(String name)(Code)(Java Doc)
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)(Code)(Java Doc)
final public IdFunctionObject exportAsJSClass(int maxPrototypeId, Scriptable scope, boolean sealed)(Code)(Java Doc)
protected void fillConstructorProperties(IdFunctionObject ctor)(Code)(Java Doc)
protected int findInstanceIdInfo(String name)(Code)(Java Doc)
protected int findPrototypeId(String name)(Code)(Java Doc)
public Object get(String name, Scriptable start)(Code)(Java Doc)
public int getAttributes(String name)(Code)(Java Doc)
Object[] getIds(boolean getAll)(Code)(Java Doc)
protected String getInstanceIdName(int id)(Code)(Java Doc)
protected Object getInstanceIdValue(int id)(Code)(Java Doc)
protected int getMaxInstanceId()(Code)(Java Doc)
public boolean has(String name, Scriptable start)(Code)(Java Doc)
final public boolean hasPrototypeMap()(Code)(Java Doc)
protected static EcmaError incompatibleCallError(IdFunctionObject f)(Code)(Java Doc)
final public void initPrototypeConstructor(IdFunctionObject f)(Code)(Java Doc)
protected void initPrototypeId(int id)(Code)(Java Doc)
final public void initPrototypeMethod(Object tag, int id, String name, int arity)(Code)(Java Doc)
final public void initPrototypeValue(int id, String name, Object value, int attributes)(Code)(Java Doc)
protected static int instanceIdInfo(int attributes, int id)(Code)(Java Doc)
public void put(String name, Scriptable start, Object value)(Code)(Java Doc)
public void setAttributes(String name, int attributes)(Code)(Java Doc)
protected void setInstanceIdValue(int id, Object value)(Code)(Java Doc)

Fields inherited from org.mozilla.javascript.ScriptableObject
final public static int CONST(Code)(Java Doc)
final public static int DONTENUM(Code)(Java Doc)
final public static int EMPTY(Code)(Java Doc)
final public static int PERMANENT(Code)(Java Doc)
final public static int READONLY(Code)(Java Doc)
final public static int UNINITIALIZED_CONST(Code)(Java Doc)

Methods inherited from org.mozilla.javascript.ScriptableObject
void addLazilyInitializedValue(String name, int index, LazilyLoadedCtor init, int attributes)(Code)(Java Doc)
final public Object associateValue(Object key, Object value)(Code)(Java Doc)
public boolean avoidObjectDetection()(Code)(Java Doc)
static BaseFunction buildClassCtor(Scriptable scope, Class clazz, boolean sealed, boolean mapInheritance) throws IllegalAccessException, InstantiationException, InvocationTargetException(Code)(Java Doc)
public static Object callMethod(Scriptable obj, String methodName, Object[] args)(Code)(Java Doc)
public static Object callMethod(Context cx, Scriptable obj, String methodName, Object[] args)(Code)(Java Doc)
static void checkValidAttributes(int attributes)(Code)(Java Doc)
public static void defineClass(Scriptable scope, Class clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException(Code)(Java Doc)
public static void defineClass(Scriptable scope, Class clazz, boolean sealed) throws IllegalAccessException, InstantiationException, InvocationTargetException(Code)(Java Doc)
public static String defineClass(Scriptable scope, Class clazz, boolean sealed, boolean mapInheritance) throws IllegalAccessException, InstantiationException, InvocationTargetException(Code)(Java Doc)
public void defineConst(String name, Scriptable start)(Code)(Java Doc)
public static void defineConstProperty(Scriptable destination, String propertyName)(Code)(Java Doc)
public void defineFunctionProperties(String[] names, Class clazz, int attributes)(Code)(Java Doc)
public void defineProperty(String propertyName, Object value, int attributes)(Code)(Java Doc)
public static void defineProperty(Scriptable destination, String propertyName, Object value, int attributes)(Code)(Java Doc)
public void defineProperty(String propertyName, Class clazz, int attributes)(Code)(Java Doc)
public void defineProperty(String propertyName, Object delegateTo, Method getter, Method setter, int attributes)(Code)(Java Doc)
public void delete(String name)(Code)(Java Doc)
public void delete(int index)(Code)(Java Doc)
public static boolean deleteProperty(Scriptable obj, String name)(Code)(Java Doc)
public static boolean deleteProperty(Scriptable obj, int index)(Code)(Java Doc)
protected Object equivalentValues(Object value)(Code)(Java Doc)
public Object get(String name, Scriptable start)(Code)(Java Doc)
public Object get(int index, Scriptable start)(Code)(Java Doc)
public Object[] getAllIds()(Code)(Java Doc)
final public Object getAssociatedValue(Object key)(Code)(Java Doc)
final public int getAttributes(String name, Scriptable start)(Code)(Java Doc)
final public int getAttributes(int index, Scriptable start)(Code)(Java Doc)
public int getAttributes(String name)(Code)(Java Doc)
public int getAttributes(int index)(Code)(Java Doc)
abstract public String getClassName()(Code)(Java Doc)
public static Scriptable getClassPrototype(Scriptable scope, String className)(Code)(Java Doc)
public Object getDefaultValue(Class typeHint)(Code)(Java Doc)
public static Object getDefaultValue(Scriptable object, Class typeHint)(Code)(Java Doc)
public static Scriptable getFunctionPrototype(Scriptable scope)(Code)(Java Doc)
public Object getGetterOrSetter(String name, int index, boolean isSetter)(Code)(Java Doc)
public Object[] getIds()(Code)(Java Doc)
Object[] getIds(boolean getAll)(Code)(Java Doc)
public static Scriptable getObjectPrototype(Scriptable scope)(Code)(Java Doc)
public Scriptable getParentScope()(Code)(Java Doc)
public static Object getProperty(Scriptable obj, String name)(Code)(Java Doc)
public static Object getProperty(Scriptable obj, int index)(Code)(Java Doc)
public static Object[] getPropertyIds(Scriptable obj)(Code)(Java Doc)
public Scriptable getPrototype()(Code)(Java Doc)
public static Scriptable getTopLevelScope(Scriptable obj)(Code)(Java Doc)
public static Object getTopScopeValue(Scriptable scope, Object key)(Code)(Java Doc)
public boolean has(String name, Scriptable start)(Code)(Java Doc)
public boolean has(int index, Scriptable start)(Code)(Java Doc)
public boolean hasInstance(Scriptable instance)(Code)(Java Doc)
public static boolean hasProperty(Scriptable obj, String name)(Code)(Java Doc)
public static boolean hasProperty(Scriptable obj, int index)(Code)(Java Doc)
public boolean isConst(String name)(Code)(Java Doc)
protected boolean isGetterOrSetter(String name, int index, boolean setter)(Code)(Java Doc)
final public boolean isSealed()(Code)(Java Doc)
public void put(String name, Scriptable start, Object value)(Code)(Java Doc)
public void put(int index, Scriptable start, Object value)(Code)(Java Doc)
public void putConst(String name, Scriptable start, Object value)(Code)(Java Doc)
public static void putConstProperty(Scriptable obj, String name, Object value)(Code)(Java Doc)
public static void putProperty(Scriptable obj, String name, Object value)(Code)(Java Doc)
public static void putProperty(Scriptable obj, int index, Object value)(Code)(Java Doc)
public static void redefineProperty(Scriptable obj, String name, boolean isConst)(Code)(Java Doc)
public synchronized void sealObject()(Code)(Java Doc)
final public void setAttributes(String name, Scriptable start, int attributes)(Code)(Java Doc)
public void setAttributes(int index, Scriptable start, int attributes)(Code)(Java Doc)
public void setAttributes(String name, int attributes)(Code)(Java Doc)
public void setAttributes(int index, int attributes)(Code)(Java Doc)
public void setGetterOrSetter(String name, int index, Callable getterOrSeter, boolean isSetter)(Code)(Java Doc)
public void setParentScope(Scriptable m)(Code)(Java Doc)
public void setPrototype(Scriptable m)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.