Package org.htmlunit.corejs.javascript
Class MemberBox
- java.lang.Object
-
- org.htmlunit.corejs.javascript.MemberBox
-
- All Implemented Interfaces:
java.io.Serializable
final class MemberBox extends java.lang.Object implements java.io.SerializableWrapper class for Method and Constructor instances to cache getParameterTypes() results, recover from IllegalAccessException in some cases and provide serialization support.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Class<?>[]argTypes(package private) FunctionasGetterFunction(package private) FunctionasSetterFunction(package private) java.lang.ObjectdelegateToprivate java.lang.reflect.MembermemberObjectprivate static java.lang.Class<?>[]primitivesprivate static longserialVersionUID(package private) booleanvararg
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) FunctionasGetterFunction(java.lang.String name, Scriptable scope)Function returned by calls to __lookupGetter__(package private) FunctionasSetterFunction(java.lang.String name, Scriptable scope)Function returned by calls to __lookupSetter__(package private) java.lang.reflect.Constructor<?>ctor()(package private) java.lang.Class<?>getDeclaringClass()(package private) java.lang.StringgetName()private voidinit(java.lang.reflect.Constructor<?> constructor)private voidinit(java.lang.reflect.Method method)(package private) java.lang.Objectinvoke(java.lang.Object target, java.lang.Object[] args)(package private) booleanisCtor()(package private) booleanisMethod()(package private) booleanisPublic()(package private) booleanisStatic()(package private) java.lang.reflect.Membermember()(package private) java.lang.reflect.Methodmethod()(package private) java.lang.ObjectnewInstance(java.lang.Object[] args)private static java.lang.reflect.MemberreadMember(java.io.ObjectInputStream in)Reads a Method or a Constructor from the stream.private voidreadObject(java.io.ObjectInputStream in)private static java.lang.Class<?>[]readParameters(java.io.ObjectInputStream in)Reads an array of parameter types from the stream.private static java.lang.reflect.MethodsearchAccessibleMethod(java.lang.reflect.Method method, java.lang.Class<?>[] params)(package private) java.lang.StringtoJavaDeclaration()java.lang.StringtoString()private static voidwriteMember(java.io.ObjectOutputStream out, java.lang.reflect.Member member)Writes a Constructor or Method object.private voidwriteObject(java.io.ObjectOutputStream out)private static voidwriteParameters(java.io.ObjectOutputStream out, java.lang.Class<?>[] parms)Writes an array of parameter types to the stream.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
memberObject
private transient java.lang.reflect.Member memberObject
-
argTypes
transient java.lang.Class<?>[] argTypes
-
vararg
transient boolean vararg
-
asGetterFunction
transient Function asGetterFunction
-
asSetterFunction
transient Function asSetterFunction
-
delegateTo
transient java.lang.Object delegateTo
-
primitives
private static final java.lang.Class<?>[] primitives
-
-
Method Detail
-
init
private void init(java.lang.reflect.Method method)
-
init
private void init(java.lang.reflect.Constructor<?> constructor)
-
method
java.lang.reflect.Method method()
-
ctor
java.lang.reflect.Constructor<?> ctor()
-
member
java.lang.reflect.Member member()
-
isMethod
boolean isMethod()
-
isCtor
boolean isCtor()
-
isStatic
boolean isStatic()
-
isPublic
boolean isPublic()
-
getName
java.lang.String getName()
-
getDeclaringClass
java.lang.Class<?> getDeclaringClass()
-
toJavaDeclaration
java.lang.String toJavaDeclaration()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
asGetterFunction
Function asGetterFunction(java.lang.String name, Scriptable scope)
Function returned by calls to __lookupGetter__
-
asSetterFunction
Function asSetterFunction(java.lang.String name, Scriptable scope)
Function returned by calls to __lookupSetter__
-
invoke
java.lang.Object invoke(java.lang.Object target, java.lang.Object[] args)
-
newInstance
java.lang.Object newInstance(java.lang.Object[] args)
-
searchAccessibleMethod
private static java.lang.reflect.Method searchAccessibleMethod(java.lang.reflect.Method method, java.lang.Class<?>[] params)
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
writeMember
private static void writeMember(java.io.ObjectOutputStream out, java.lang.reflect.Member member) throws java.io.IOExceptionWrites a Constructor or Method object.Methods and Constructors are not serializable, so we must serialize information about the class, the name, and the parameters and recreate upon deserialization.
- Throws:
java.io.IOException
-
readMember
private static java.lang.reflect.Member readMember(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads a Method or a Constructor from the stream.- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeParameters
private static void writeParameters(java.io.ObjectOutputStream out, java.lang.Class<?>[] parms) throws java.io.IOExceptionWrites an array of parameter types to the stream.Requires special handling because primitive types cannot be found upon deserialization by the default Java implementation.
- Throws:
java.io.IOException
-
readParameters
private static java.lang.Class<?>[] readParameters(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads an array of parameter types from the stream.- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-