Class ClassNewInstance

  extended by com.bea.p13n.expression.internal.ComplexExpressionImpl
      extended by com.bea.p13n.expression.operator.Operator
          extended by com.bea.p13n.expression.operator.ClassNewInstance
All Implemented Interfaces
Expression, com.bea.p13n.expression.ExpressionEvents, Serializable, Cloneable

public final class ClassNewInstance
extends Operator

Implementation of the ClassNewInstance operator. Returns an newly constructed object by invoking a specified constructor.
Input 1: A Class object (or expression that evaluates to a Class) that defines the Class that should be created.
Input 2: A Class[] (or expression that evaluates to a Class[]) that defines the signature of the constructor that should be invoked. If input 2 is null the operator will attempt to deduce the constructor to call from the arguments (input 3).
Input 3: A Object[] (or expression that evaluates to a Object[]) that contains the arguments that should be passed to the constructor.
Returns: A new instance of the class, instantiated with the constructor of the provided signature using the supplied arguments..

See Also
Serialized Form

Field Summary
Fields inherited from interface com.bea.p13n.expression.ExpressionEvents
Constructor Summary
          Constructs an empty operator and operands can be added later by calling addSubExpression() on this.
ClassNewInstance(Object clazz, Object constructorSignature, Object args)
          Constructs this with the given clazz, constructorSignature
Method Summary
 Class[] getParameterSignature()
          Returns the parameter signature for this Expression.
Methods inherited from class com.bea.p13n.expression.operator.Operator
leftHandSide, operand, rightHandSide
Methods inherited from class com.bea.p13n.expression.internal.ComplexExpressionImpl
addListener, addSubExpression, clearCache, clone, createProxyExpression, equals, getCachedValue, getParent, getSource, getSubExpression, getSubExpressionCount, getUserData, hashCode, isCached, isCacheEnabled, isEqualitySubExpression, notifyListeners, removeAllSubExpressions, removeListener, removeSubExpression, removeSubExpression, setCachedValue, setCacheEnabled, setParent, setSource, setSubExpression, setUserData, toString, write
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public ClassNewInstance()
Constructs an empty operator and operands can be added later by calling addSubExpression() on this.


public ClassNewInstance(Object clazz,
                        Object constructorSignature,
                        Object args)
Constructs this with the given clazz, constructorSignatureargs parameters.

clazz - The Class whose instance has to be created.
constructorSignature - The parameter signature of a constructor that will be used to create an instance of clazz.
args - The arguments to be passed to the constructor.
Method Detail


public Class[] getParameterSignature()
Description copied from interface: Expression
Returns the parameter signature for this Expression. Because the sub-expressions within the Expression are typically arguments or operands, some type validation is performed by examining the class types of the sub-expressions against the Expression's parameter signature.
The tests that are performed are:
1. The number of sub-expressions must equals the number of parameter entries.
2. The class type of any sub-expression (or the result of evaluating the sub-expresssion) must equal the class type of the corresponding parameter entry.
3. Any null parameter entries are ignored and are considered optional sub-expressions.

the Class array containing the parameter signature.

Copyright © 2011, Oracle. All rights reserved.