/*
* 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.
*/
import javax.management.*;
public class Utils {
private Utils() {
}
}));
}));
String.class, ObjectName.class
}));
}));
}));
static {
// compute primitives/primitiveMap/primitiveToWrapper
for (Class<?> c : primitiveWrappers) {
try {
primitives.add(p);
} catch (Exception e) {
throw new AssertionError(e);
}
}
// compute editableTypes
for (Class<?> c : primitives) {
}
for (Class<?> c : primitiveWrappers) {
}
for (Class<?> c : extraEditableClasses) {
}
// compute numericalTypes
for (Class<?> c : primitives) {
}
}
for (Class<?> c : primitiveWrappers) {
}
}
}
/**
* This method returns the class matching the name className.
* It's used to cater for the primitive types.
*/
throws ClassNotFoundException {
Class<?> c;
return c;
}
}
/**
* Check if the given collection is a uniform collection of the given type.
*/
if (e == null) {
throw new IllegalArgumentException("Null reference type");
}
if (c == null) {
throw new IllegalArgumentException("Null collection");
}
if (c.isEmpty()) {
return false;
}
for (Object o : c) {
return false;
}
}
return true;
}
/**
* Check if the given element denotes a supported array-friendly data
* structure, i.e. a data structure jconsole can render as an array.
*/
if (isSupportedArray(elem)) {
return true;
}
if (elem instanceof Collection) {
if (c.isEmpty()) {
// Empty collections of any Java type are not handled as arrays
//
return false;
} else {
// - Collections of CompositeData/TabularData are not handled
// as arrays
// - Collections of other Java types are handled as arrays
//
return !isUniformCollection(c, CompositeData.class) &&
!isUniformCollection(c, TabularData.class);
}
}
return !(elem instanceof TabularData);
}
return false;
}
/**
* Check if the given element is an array.
*
* Multidimensional arrays are not supported.
*
* Non-empty 1-dimensional arrays of CompositeData
* and TabularData are not handled as arrays but as
* tabular data.
*/
return false;
}
return false;
}
return false;
}
return true;
}
/**
* This method provides a readable classname if it's an array,
* i.e. either the classname of the component type for arrays
* of java reference types or the name of the primitive type
* for arrays of java primitive types. Otherwise, it returns null.
*/
} else {
try {
} catch (ClassNotFoundException e) {
// Should not happen
throw new IllegalArgumentException(
"Bad class name " + name, e);
}
}
}
return className;
}
/**
* This methods provides a readable classname. If the supplied name
* parameter denotes an array this method returns either the classname
* of the component type for arrays of java reference types or the name
* of the primitive type for arrays of java primitive types followed by
* n-times "[]" where 'n' denotes the arity of the array. Otherwise, if
* the supplied name doesn't denote an array it returns the same classname.
*/
return name;
}
for (int i = 0; i <= index; i++) {
}
}
/**
* This method tells whether the type is editable
* (means can be created with a String or not)
*/
}
/**
* This method inserts a default value for the standard java types,
* else it inserts the text name of the expected class type.
* It acts to give a clue as to the input type.
*/
return "0";
}
return "true";
}
if (i > 0) {
} else {
return type;
}
}
/**
* Try to create a Java object using a one-string-param constructor.
*/
throws Exception {
try {
return c.newInstance(param);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t instanceof Exception) {
throw (Exception) t;
} else {
throw e;
}
}
}
/**
* Try to convert a string value into a numerical value.
*/
throws NumberFormatException {
}
}
}
try {
} catch (NumberFormatException e) {
// OK: Ignore exception...
}
try {
} catch (NumberFormatException e1) {
// OK: Ignore exception...
}
try {
} catch (NumberFormatException e2) {
// OK: Ignore exception...
}
throw new NumberFormatException("Cannot convert string value '" +
value + "' into a numerical value");
}
/**
* This method attempts to create an object of the given "type"
* using the "value" parameter.
* e.g. calling createObjectFromString("java.lang.Integer", "10")
* will return an Integer object initialized to 10.
*/
throws Exception {
} else {
value);
}
// hack for null value
} else {
// try to create a Java object using
// the one-string-param constructor
}
return result;
}
/**
* This method is responsible for converting the inputs given by the user
* into a useful object array for passing into a parameter array.
*/
throws Exception {
// if it's already a complex object, use the value
// else try to instantiate with string constructor
} else {
}
}
return result;
}
/**
* If the exception is wrapped, unwrap it.
*/
if (e instanceof ExecutionException) {
e = e.getCause();
}
if (e instanceof MBeanException ||
e instanceof RuntimeMBeanException ||
e instanceof RuntimeOperationsException ||
e instanceof ReflectionException) {
if (t != null) {
return t;
}
}
return e;
}
@SuppressWarnings("serial")
public static class ReadOnlyTableCellEditor
extends DefaultCellEditor {
super(tf);
}
}
}
}
}
// Accept "copy" key strokes
e.getKeyCode(), e.getModifiers());
for (int i = 0; i < 3; i++) {
return;
}
}
// Accept JTable navigation key strokes
e.consume();
}
}
e.consume();
}
}
}