/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class is intended to handle <new> element.
* It describes instantiation of the object.
* The {@code class} attribute denotes
* the name of the class to instantiate.
* The inner elements specifies the arguments of the constructor.
* For example:<pre>
* <new class="java.lang.Long">
* <string>10</string>
* </new></pre>
* is equivalent to {@code new Long("10")} in Java code.
* <p>The following atributes are supported:
* <dl>
* <dt>class
* <dd>the type of object for instantiation
* <dt>id
* <dd>the identifier of the variable that is intended to store the result
* </dl>
*
* @since 1.7
*
* @author Sergey A. Malenkov
*/
/**
* Parses attributes of the element.
* The following atributes are supported:
* <dl>
* <dt>class
* <dd>the type of object for instantiation
* <dt>id
* <dd>the identifier of the variable that is intended to store the result
* </dl>
*
* @param name the attribute name
* @param value the attribute value
*/
} else {
}
}
/**
* Adds the argument to the list of arguments
* that is used to calculate the value of this element.
*
* @param argument the value of the element that contained in this one
*/
throw new IllegalStateException("Could not add argument to evaluated element");
}
}
/**
* Returns the context of the method.
* The context of the static method is the class object.
* The context of the non-static method is the value of the parent element.
*
* @return the context of the method
*/
? this.type
: super.getContextBean();
}
/**
* Returns the value of this element.
*
* @return the value of this element
*/
try {
}
}
finally {
}
}
return this.value;
}
/**
* Calculates the value of this element
* using the base class and the array of arguments.
* By default, it creates an instance of the base class.
* This method should be overridden in those handlers
* that extend behavior of this element.
*
* @param type the base class
* @param args the array of arguments
* @return the value of this element
* @throws Exception if calculation is failed
*/
throw new IllegalArgumentException("Class name is not set");
}
if (constructor.isVarArgs()) {
}
}
/**
* Converts the array of arguments to the array of corresponding classes.
* If argument is {@code null} the class is {@code null} too.
*
* @param arguments the array of arguments
* @return the array of corresponding classes
*/
}
}
return types;
}
/**
* Resolves variable arguments.
*
* @param arguments the array of arguments
* @param types the array of parameter types
* @return the resolved array of arguments
*/
return arguments;
}
return arguments;
}
}
return args;
}
}