Package jadex.javaparser.javaccimpl
Class ReflectNode
- java.lang.Object
- 
- jadex.javaparser.javaccimpl.SimpleNode
- 
- jadex.javaparser.javaccimpl.ExpressionNode
- 
- jadex.javaparser.javaccimpl.ReflectNode
 
 
 
- 
- All Implemented Interfaces:
- IParsedExpression,- Node,- java.io.Serializable
 
 public class ReflectNode extends ExpressionNode A node for a constructor or method invocation or field access.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.reflect.MethodaccessorThe field accessor method (for static and nonstatic fields).protected java.lang.Object[]argsThe argument values (for constructors and methods).protected java.lang.Class[]argtypesThe argument types (for constructors and methods).protected java.lang.ClassclazzThe clazz.static intCONSTRUCTORThe constructor type.protected java.lang.reflect.Constructor[]constructorsThe possible constructors (for constructor nodes).protected java.lang.reflect.FieldfieldThe field (for static and nonstatic fields).static intFIELDThe field type.static intMETHODThe method type.protected java.lang.reflect.Method[]methodsThe possible methods (for static and nonstatic methods).protected booleanreloadableFlag indicating that this node is a candidate dynamic class reloading (currently only supported for plan constructors).protected java.lang.ClassreloadedclassThe dynamically reloaded class (currently only for constructor nodes).static intSTATIC_FIELDThe static field type.static intSTATIC_METHODThe static method type.protected inttypeThe reflect node type.- 
Fields inherited from class jadex.javaparser.javaccimpl.ExpressionNodeconstant, constant_value, expressiontext, imports, static_type, text
 - 
Fields inherited from class jadex.javaparser.javaccimpl.SimpleNodechildren, id, parent
 
- 
 - 
Constructor SummaryConstructors Constructor Description ReflectNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)Create an expression node.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectaccessField(java.lang.Object ref, java.lang.Class clazz, IValueFetcher fetcher)Access a field.booleanequals(java.lang.Object o)Test if two nodes are equal.protected java.lang.reflect.Constructor[]findConstructors(java.lang.Class clazz, java.lang.Class[] argtypes)Find all matching constructors of a given class.protected java.lang.reflect.Method[]findMethods(java.lang.Class clazz, java.lang.Class[] argtypes)Find all matching methods of a given class.protected java.lang.reflect.MethodgetMethodForMethod(java.lang.reflect.Method method)Find method declared in public class for a given method.intgetType()Get the constructor type.java.lang.ObjectgetValue(IValueFetcher fetcher)Evaluate the expression in the given state with respect to given parameters.inthashCode()Get the hash code for the node.protected java.lang.ObjectinvokeConstructor(java.lang.Class clazz, java.lang.Class[] argtypes, java.lang.Object[] args)Find and invoke a constructor.protected java.lang.ObjectinvokeMethod(java.lang.Object ref, java.lang.Class clazz, java.lang.Class[] argtypes, java.lang.Object[] args)Find and invoke a method.voidprecompile()Precompute the set of matching constructors if possible.voidsetType(int type)Set the constructor type.java.lang.StringtoPlainString()Create a string representation of this node and its subnodes.- 
Methods inherited from class jadex.javaparser.javaccimpl.ExpressionNodeappendText, getConstantValue, getExpressionText, getParameters, getStaticType, getText, getUnboundParameterNodes, isConstant, precompileTree, setConstant, setConstantValue, setExpressionText, setStaticType, setText, subnodeToString, throwEvaluationException, throwParseException, toString, toString
 - 
Methods inherited from class jadex.javaparser.javaccimpl.SimpleNodedump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent
 
- 
 
- 
- 
- 
Field Detail- 
CONSTRUCTORpublic static final int CONSTRUCTOR The constructor type.- See Also:
- Constant Field Values
 
 - 
STATIC_METHODpublic static final int STATIC_METHOD The static method type.- See Also:
- Constant Field Values
 
 - 
STATIC_FIELDpublic static final int STATIC_FIELD The static field type.- See Also:
- Constant Field Values
 
 - 
METHODpublic static final int METHOD The method type.- See Also:
- Constant Field Values
 
 - 
FIELDpublic static final int FIELD The field type.- See Also:
- Constant Field Values
 
 - 
typeprotected int type The reflect node type.
 - 
clazzprotected java.lang.Class clazz The clazz.
 - 
argtypesprotected transient java.lang.Class[] argtypes The argument types (for constructors and methods).
 - 
argsprotected transient java.lang.Object[] args The argument values (for constructors and methods).
 - 
constructorsprotected transient java.lang.reflect.Constructor[] constructors The possible constructors (for constructor nodes).
 - 
reloadedclassprotected transient java.lang.Class reloadedclass The dynamically reloaded class (currently only for constructor nodes).
 - 
methodsprotected transient java.lang.reflect.Method[] methods The possible methods (for static and nonstatic methods).
 - 
accessorprotected transient java.lang.reflect.Method accessor The field accessor method (for static and nonstatic fields).
 - 
fieldprotected transient java.lang.reflect.Field field The field (for static and nonstatic fields).
 - 
reloadableprotected boolean reloadable Flag indicating that this node is a candidate dynamic class reloading (currently only supported for plan constructors).
 
- 
 - 
Method Detail- 
setTypepublic void setType(int type) Set the constructor type.- Parameters:
- type- The constrcutor type.
 
 - 
getTypepublic int getType() Get the constructor type.- Returns:
- The constructor type.
 
 - 
precompilepublic void precompile() Precompute the set of matching constructors if possible.- Overrides:
- precompilein class- ExpressionNode
 
 - 
getValuepublic java.lang.Object getValue(IValueFetcher fetcher) Evaluate the expression in the given state with respect to given parameters.- Specified by:
- getValuein interface- IParsedExpression
- Specified by:
- getValuein class- ExpressionNode
- Parameters:
- params- The parameters (string, value pairs), if any.
- Returns:
- The value of the term.
 
 - 
toPlainStringpublic java.lang.String toPlainString() Create a string representation of this node and its subnodes.- Specified by:
- toPlainStringin interface- Node
- Overrides:
- toPlainStringin class- ExpressionNode
- Returns:
- A string representation of this node.
 
 - 
findConstructorsprotected java.lang.reflect.Constructor[] findConstructors(java.lang.Class clazz, java.lang.Class[] argtypes)Find all matching constructors of a given class.- Parameters:
- clazz- The class.
- argtypes- The argument types.
- Returns:
- The matched constructors.
 
 - 
findMethodsprotected java.lang.reflect.Method[] findMethods(java.lang.Class clazz, java.lang.Class[] argtypes)Find all matching methods of a given class.- Parameters:
- clazz- The class.
- argtypes- The argument types.
- Returns:
- The matched methods.
 
 - 
invokeConstructorprotected java.lang.Object invokeConstructor(java.lang.Class clazz, java.lang.Class[] argtypes, java.lang.Object[] args) throws java.lang.ExceptionFind and invoke a constructor.- Parameters:
- clazz- The class to instantiate.
- argtypes- The actual argument types.
- args- The actual argument values.
- Returns:
- The instantiated object.
- Throws:
- java.lang.Exception
 
 - 
invokeMethodprotected java.lang.Object invokeMethod(java.lang.Object ref, java.lang.Class clazz, java.lang.Class[] argtypes, java.lang.Object[] args) throws java.lang.ExceptionFind and invoke a method.- Parameters:
- ref- The object on which to invoke (may be null for static methods).
- clazz- The class to instantiate.
- argtypes- The actual argument types.
- args- The actual argument values.
- Returns:
- The return value.
- Throws:
- java.lang.Exception
 
 - 
accessFieldprotected java.lang.Object accessField(java.lang.Object ref, java.lang.Class clazz, IValueFetcher fetcher) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.NoSuchFieldExceptionAccess a field.- Throws:
- java.lang.IllegalAccessException
- java.lang.IllegalArgumentException
- java.lang.NoSuchFieldException
 
 - 
getMethodForMethodprotected java.lang.reflect.Method getMethodForMethod(java.lang.reflect.Method method) Find method declared in public class for a given method.
 - 
equalspublic boolean equals(java.lang.Object o) Test if two nodes are equal.- Overrides:
- equalsin class- ExpressionNode
 
 - 
hashCodepublic int hashCode() Get the hash code for the node.- Overrides:
- hashCodein class- ExpressionNode
 
 
- 
 
-