List of usage examples for java.lang Boolean TYPE
Class TYPE
To view the source code for java.lang Boolean TYPE.
Click Source Link
From source file:org.evosuite.testcarver.testcase.EvoTestCaseCodeGenerator.java
private final Class<?> getClassFromType(final org.objectweb.asm.Type type) { if (type.equals(org.objectweb.asm.Type.BOOLEAN_TYPE)) { return Boolean.TYPE; } else if (type.equals(org.objectweb.asm.Type.BYTE_TYPE)) { return Byte.TYPE; } else if (type.equals(org.objectweb.asm.Type.CHAR_TYPE)) { return Character.TYPE; } else if (type.equals(org.objectweb.asm.Type.DOUBLE_TYPE)) { return Double.TYPE; } else if (type.equals(org.objectweb.asm.Type.FLOAT_TYPE)) { return Float.TYPE; } else if (type.equals(org.objectweb.asm.Type.INT_TYPE)) { return Integer.TYPE; } else if (type.equals(org.objectweb.asm.Type.LONG_TYPE)) { return Long.TYPE; } else if (type.equals(org.objectweb.asm.Type.SHORT_TYPE)) { return Short.TYPE; } else if (type.getSort() == org.objectweb.asm.Type.ARRAY) { final org.objectweb.asm.Type elementType = type.getElementType(); int[] dimensions = new int[type.getDimensions()]; if (elementType.equals(org.objectweb.asm.Type.BOOLEAN_TYPE)) { return Array.newInstance(boolean.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.BYTE_TYPE)) { return Array.newInstance(byte.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.CHAR_TYPE)) { return Array.newInstance(char.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.DOUBLE_TYPE)) { return Array.newInstance(double.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.FLOAT_TYPE)) { return Array.newInstance(float.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.INT_TYPE)) { return Array.newInstance(int.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.LONG_TYPE)) { return Array.newInstance(long.class, dimensions).getClass(); } else if (elementType.equals(org.objectweb.asm.Type.SHORT_TYPE)) { return Array.newInstance(short.class, dimensions).getClass(); }/* www. j av a 2 s .c o m*/ } // try // { return getClassForName(type.getClassName()); // return Class.forName(type.getClassName(), true, StaticTestCluster.classLoader); // } // catch (final ClassNotFoundException e) // { // throw new RuntimeException(e); // } }
From source file:org.gitana.platform.client.support.ObjectFactoryImpl.java
@Override public BaseNode produce(Branch branch, ObjectNode object, boolean isSaved) { BaseNode node = null;//from w w w .j a va 2 s .c om if (!object.has(Node.FIELD_ID)) { throw new RuntimeException("Object is missing field: " + Node.FIELD_ID); } // type qname QName typeQName = QName.create(JsonUtil.objectGetString(object, Node.FIELD_TYPE_QNAME)); // find implementation class Class c = registry.get(typeQName); if (c != null) { try { Class[] signature = new Class[] { Branch.class, ObjectNode.class, Boolean.TYPE }; Constructor constructor = c.getConstructor(signature); if (constructor != null) { Object[] args = new Object[] { branch, object, isSaved }; node = (BaseNode) constructor.newInstance(args); } else { throw new RuntimeException("No constructor found for signature: " + signature); } } catch (Exception ex) { throw new RuntimeException(ex); } } // if we didn't produce a node for a registered type, we can build a default kind of node // either a node impl or an association impl if (node == null) { boolean isAssociation = false; if (object.has("_is_association")) { isAssociation = object.get("_is_association").booleanValue(); } if (isAssociation) { node = new AssociationImpl(branch, object, isSaved); } else { node = new NodeImpl(branch, object, isSaved); } } return node; }
From source file:com.nway.spring.jdbc.bean.AsmBeanProcessor.java
private Object processColumn(ResultSet rs, int index, Class<?> propType, String writer, String processorName, String beanName, MethodVisitor mv) throws SQLException { if (propType.equals(String.class)) { visitMethod(mv, index, beanName, "Ljava/lang/String;", "getString", writer); return rs.getString(index); } else if (propType.equals(Integer.TYPE)) { visitMethod(mv, index, beanName, "I", "getInt", writer); return rs.getInt(index); } else if (propType.equals(Integer.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_INTEGER, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Integer.class); } else if (propType.equals(Long.TYPE)) { visitMethod(mv, index, beanName, "J", "getLong", writer); return rs.getLong(index); } else if (propType.equals(Long.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_LONG, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Long.class); } else if (propType.equals(java.sql.Date.class)) { visitMethod(mv, index, beanName, "Ljava/sql/Date;", "getDate", writer); return rs.getDate(index); } else if (propType.equals(java.util.Date.class)) { visitMethodCast(mv, index, beanName, PROPERTY_TYPE_DATE, "java/util/Date", writer); return rs.getTimestamp(index); } else if (propType.equals(Timestamp.class)) { visitMethod(mv, index, beanName, "Ljava/sql/Timestamp;", "getTimestamp", writer); return rs.getTimestamp(index); } else if (propType.equals(Time.class)) { visitMethod(mv, index, beanName, "Ljava/sql/Time;", "getTime", writer); return rs.getTime(index); } else if (propType.equals(Double.TYPE)) { visitMethod(mv, index, beanName, "D", "getDouble", writer); return rs.getDouble(index); } else if (propType.equals(Double.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_DOUBLE, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Double.class); } else if (propType.equals(Float.TYPE)) { visitMethod(mv, index, beanName, "F", "getFloat", writer); return rs.getFloat(index); } else if (propType.equals(Float.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_FLOAT, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Float.class); } else if (propType.equals(Boolean.TYPE)) { visitMethod(mv, index, beanName, "Z", "getBoolean", writer); return rs.getBoolean(index); } else if (propType.equals(Boolean.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_BOOLEAN, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Boolean.class); } else if (propType.equals(Clob.class)) { visitMethod(mv, index, beanName, "Ljava/sql/Clob;", "getClob", writer); return rs.getClob(index); } else if (propType.equals(Blob.class)) { visitMethod(mv, index, beanName, "Ljava/sql/Blob;", "getBlob", writer); return rs.getBlob(index); } else if (propType.equals(byte[].class)) { visitMethod(mv, index, beanName, "[B", "getBytes", writer); return rs.getBytes(index); } else if (propType.equals(Short.TYPE)) { visitMethod(mv, index, beanName, "S", "getShort", writer); return rs.getShort(index); } else if (propType.equals(Short.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_SHORT, writer, processorName); return JdbcUtils.getResultSetValue(rs, index, Short.class); } else if (propType.equals(Byte.TYPE)) { visitMethod(mv, index, beanName, "B", "getByte", writer); return rs.getByte(index); } else if (propType.equals(Byte.class)) { visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_BYTE, writer, processorName); return rs.getByte(index); } else {//w w w. j a va2 s .c o m visitMethodCast(mv, index, beanName, PROPERTY_TYPE_OTHER, propType.getName().replace('.', '/'), writer); return rs.getObject(index); } }
From source file:org.kuali.rice.krad.uif.util.ObjectPropertyUtils.java
/** * Convert to a primitive type if available. * //w w w.java 2 s . c o m * @param type The type to convert. * @return A primitive type, if available, that corresponds to the type. */ public static Class<?> getPrimitiveType(Class<?> type) { if (Byte.class.equals(type)) { return Byte.TYPE; } else if (Short.class.equals(type)) { return Short.TYPE; } else if (Integer.class.equals(type)) { return Integer.TYPE; } else if (Long.class.equals(type)) { return Long.TYPE; } else if (Boolean.class.equals(type)) { return Boolean.TYPE; } else if (Float.class.equals(type)) { return Float.TYPE; } else if (Double.class.equals(type)) { return Double.TYPE; } return type; }
From source file:iing.uabc.edu.mx.persistencia.util.JSON.java
public static void stringifyArray(JsonGenerator generator, CollectionManager manager) { //Get size of the array to start stringifying elements //Note that the elements of this array has to be of the same class Collection collection = manager.getCollection(); Class elementType = manager.getElementClass(); System.out.println("Coleccion de tamanio " + collection.size()); int i = 0;//from w ww. j ava 2 s . c o m //Read every element and transform it to a json array element string for (Iterator it = collection.iterator(); it.hasNext();) { Object element = it.next(); System.out.println("Elemento: [" + i + "], Valor: " + element); if (element == null) { //Set to null the property generator.writeNull(); continue; } //Is a String if (elementType == String.class) { generator.write(String.valueOf(element)); } //Is a Date else if (elementType == Date.class) { String date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(element); generator.write(date); } //Is a integer else if (elementType == Integer.class || elementType == Integer.TYPE) { generator.write((int) element); } //Is a double else if (elementType == Double.class || elementType == Double.TYPE) { generator.write((double) element); } //Is boolean else if (elementType == Boolean.class || elementType == Boolean.TYPE) { generator.write((boolean) element); } //Is a collection (Not implemented) else if (element instanceof Collection) { // Class elementClass = manager.getCollectionElementType(keyName); // // System.out.println("Nueva Colleccion [] de clase: " // + elementClass.getSimpleName()); // // generator.writeStartArray(keyName); // // //Create new collection manager with the given class // CollectionManager collectionManager // = new CollectionManager((Collection) value, elementClass); // // generator.writeEnd(); } else { //Is a object... probably BeanManager objectManager = new BeanManager(element); System.out.println("Nuevo Objecto {}: " + element.getClass().getSimpleName()); generator.writeStartObject(); stringifyObject(generator, objectManager); generator.writeEnd(); } } }
From source file:org.unitils.util.ReflectionUtils.java
/** * From the given class, returns the getter for the given property name. If * isStatic == true, a static getter is searched. If no such getter exists * in the given class, null is returned. * // w ww. j a va 2s.com * When the given field is a boolean the getGetter will also try the * isXxxxx. * * @param clazz * The class to get the setter from, not null * @param propertyName * The name of the property, not null * @param isStatic * True if a static getter is to be returned, false for * non-static * @return The getter method that matches the given parameters, or null if * no such method exists */ public static Method getGetter(Class<?> clazz, String propertyName, boolean isStatic) { Method result = null; String getterName = "get" + capitalize(propertyName); result = getMethod(clazz, getterName, isStatic); try { if (result == null && (Boolean.TYPE.equals(clazz.getDeclaredField(propertyName).getType()) || Boolean.class.equals(clazz.getDeclaredField(propertyName).getType()))) { String isName = "is" + capitalize(propertyName); result = getMethod(clazz, isName, isStatic); } } catch (Exception e) { result = null; } return result; }
From source file:com.icsshs.datatransfer.database.impl.QueryBeanProcessor.java
/** * Convert a <code>ResultSet</code> column into an object. Simple * implementations could just call <code>rs.getObject(index)</code> while * more complex implementations could perform type manipulation to match * the column's type to the bean property type. * * <p>/*w w w .j av a 2 s . c o m*/ * This implementation calls the appropriate <code>ResultSet</code> getter * method for the given property type to perform the type conversion. If * the property type doesn't match one of the supported * <code>ResultSet</code> types, <code>getObject</code> is called. * </p> * * @param rs The <code>ResultSet</code> currently being processed. It is * positioned on a valid row before being passed into this method. * * @param index The current column index being processed. * * @param propType The bean property type that this column needs to be * converted into. * * @throws SQLException if a database access error occurs * * @return The object from the <code>ResultSet</code> at the given column * index after optional type processing or <code>null</code> if the column * value was SQL NULL. */ protected Object processColumn(ResultSet rs, int index, Class<?> propType) throws SQLException { if (!propType.isPrimitive() && rs.getObject(index) == null) { return null; } if (propType.equals(String.class)) { return rs.getString(index); } else if (propType.equals(Integer.TYPE) || propType.equals(Integer.class)) { return Integer.valueOf(rs.getInt(index)); } else if (propType.equals(Boolean.TYPE) || propType.equals(Boolean.class)) { return Boolean.valueOf(rs.getBoolean(index)); } else if (propType.equals(Long.TYPE) || propType.equals(Long.class)) { return Long.valueOf(rs.getLong(index)); } else if (propType.equals(Double.TYPE) || propType.equals(Double.class)) { return Double.valueOf(rs.getDouble(index)); } else if (propType.equals(Float.TYPE) || propType.equals(Float.class)) { return Float.valueOf(rs.getFloat(index)); } else if (propType.equals(Short.TYPE) || propType.equals(Short.class)) { return Short.valueOf(rs.getShort(index)); } else if (propType.equals(Byte.TYPE) || propType.equals(Byte.class)) { return Byte.valueOf(rs.getByte(index)); } else if (propType.equals(Timestamp.class)) { return rs.getTimestamp(index); } else if (propType.equals(byte[].class)) { return rs.getBytes(index); } else { return rs.getObject(index); } }
From source file:com.qmetry.qaf.automation.data.BaseDataBean.java
protected void setField(Field field, String val) { try {/* ww w . ja v a 2 s. c om*/ // deal with IllegalAccessException field.setAccessible(true); if (field.getType() == String.class) { field.set(this, val); } else { Method setter = null; try { setter = this.getClass().getMethod("set" + StringUtil.getTitleCase(field.getName()), String.class); } catch (Exception e) { } if (null != setter) { setter.setAccessible(true); setter.invoke(this, val); } else if (field.getType() == Integer.TYPE) { field.setInt(this, Integer.parseInt(val)); } else if (field.getType() == Float.TYPE) { field.setFloat(this, Float.parseFloat(val)); } else if (field.getType() == Double.TYPE) { field.setDouble(this, Double.parseDouble(val)); } else if (field.getType() == Long.TYPE) { field.setLong(this, Long.parseLong(val)); } else if (field.getType() == Boolean.TYPE) { Boolean bval = StringUtils.isBlank(val) ? null : NumberUtils.isNumber(val) ? (Integer.parseInt(val) != 0) : Boolean.parseBoolean(val) || val.equalsIgnoreCase("T") || val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("YES"); field.setBoolean(this, bval); } else if (field.getType() == Short.TYPE) { field.setShort(this, Short.parseShort(val)); } else if (field.getType() == Date.class) { Date dVal = null; try { dVal = StringUtils.isBlank(val) ? null : NumberUtils.isNumber(val) ? DateUtil.getDate(Integer.parseInt(val)) : DateUtil.parseDate(val, "MM/dd/yyyy"); } catch (ParseException e) { logger.error("Expected date in MM/dd/yyyy format.", e); } field.set(this, dVal); } } } catch (IllegalArgumentException e) { logger.error("Unable to fill random data in field " + field.getName(), e); } catch (IllegalAccessException e) { logger.error("Unable to Access " + field.getName(), e); } catch (InvocationTargetException e) { logger.error("Unable to invoke setter for " + field.getName(), e); } }
From source file:org.jfree.chart.demo.SymbolicXYPlotDemo.java
/** * Transform an primitive array to an object array. * //from w w w . j a v a2 s.c o m * @param arr * the array. * @return an array. */ private static Object toArray(final Object arr) { if (arr == null) { return arr; } final Class cls = arr.getClass(); if (!cls.isArray()) { return arr; } Class compType = cls.getComponentType(); int dim = 1; while (!compType.isPrimitive()) { if (!compType.isArray()) { return arr; } else { dim++; compType = compType.getComponentType(); } } final int[] length = new int[dim]; length[0] = Array.getLength(arr); Object[] newarr = null; try { if (compType.equals(Integer.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Integer"), length); } else if (compType.equals(Double.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Double"), length); } else if (compType.equals(Long.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Long"), length); } else if (compType.equals(Float.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Float"), length); } else if (compType.equals(Short.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Short"), length); } else if (compType.equals(Byte.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Byte"), length); } else if (compType.equals(Character.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Character"), length); } else if (compType.equals(Boolean.TYPE)) { newarr = (Object[]) Array.newInstance(Class.forName("java.lang.Boolean"), length); } } catch (ClassNotFoundException ex) { System.out.println(ex); } for (int i = 0; i < length[0]; i++) { if (dim != 1) { newarr[i] = toArray(Array.get(arr, i)); } else { newarr[i] = Array.get(arr, i); } } return newarr; }
From source file:ca.sqlpower.sqlobject.BaseSQLObjectTestCase.java
/** * @throws IllegalArgumentException//from www. ja v a2 s . c o m * @throws IllegalAccessException * @throws InvocationTargetException * @throws NoSuchMethodException * @throws SQLObjectException */ public void testAllSettersAreUndoable() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, SQLObjectException { SQLObject so = getSQLObjectUnderTest(); propertiesToIgnoreForUndo.add("referenceCount"); propertiesToIgnoreForUndo.add("populated"); propertiesToIgnoreForUndo.add("exportedKeysPopulated"); propertiesToIgnoreForUndo.add("importedKeysPopulated"); propertiesToIgnoreForUndo.add("columnsPopulated"); propertiesToIgnoreForUndo.add("indicesPopulated"); propertiesToIgnoreForUndo.add("SQLObjectListeners"); propertiesToIgnoreForUndo.add("children"); propertiesToIgnoreForUndo.add("parent"); propertiesToIgnoreForUndo.add("parentDatabase"); propertiesToIgnoreForUndo.add("class"); propertiesToIgnoreForUndo.add("childCount"); propertiesToIgnoreForUndo.add("undoEventListeners"); propertiesToIgnoreForUndo.add("connection"); propertiesToIgnoreForUndo.add("typeMap"); propertiesToIgnoreForUndo.add("secondaryChangeMode"); propertiesToIgnoreForUndo.add("zoomInAction"); propertiesToIgnoreForUndo.add("zoomOutAction"); propertiesToIgnoreForUndo.add("magicEnabled"); propertiesToIgnoreForUndo.add("deleteRule"); propertiesToIgnoreForUndo.add("updateRule"); propertiesToIgnoreForUndo.add("tableContainer"); propertiesToIgnoreForUndo.add("session"); propertiesToIgnoreForUndo.add("workspaceContainer"); propertiesToIgnoreForUndo.add("runnableDispatcher"); propertiesToIgnoreForUndo.add("foregroundThread"); if (so instanceof SQLDatabase) { // should be handled in the Datasource propertiesToIgnoreForUndo.add("name"); } SPObjectUndoManager undoManager = new SPObjectUndoManager(so); List<PropertyDescriptor> settableProperties; settableProperties = Arrays.asList(PropertyUtils.getPropertyDescriptors(so.getClass())); if (so instanceof SQLDatabase) { // should be handled in the Datasource settableProperties.remove("name"); } for (PropertyDescriptor property : settableProperties) { Object oldVal; if (propertiesToIgnoreForUndo.contains(property.getName())) continue; try { oldVal = PropertyUtils.getSimpleProperty(so, property.getName()); if (property.getWriteMethod() == null) { continue; } } catch (NoSuchMethodException e) { System.out.println( "Skipping non-settable property " + property.getName() + " on " + so.getClass().getName()); continue; } Object newVal; // don't init here so compiler can warn if the following code doesn't always give it a value if (property.getPropertyType() == Integer.TYPE || property.getPropertyType() == Integer.class) { if (oldVal != null) { newVal = ((Integer) oldVal) + 1; } else { newVal = 1; } } else if (property.getPropertyType() == String.class) { // make sure it's unique newVal = "new " + oldVal; } else if (property.getPropertyType() == Boolean.TYPE || property.getPropertyType() == Boolean.class) { if (oldVal == null) { newVal = Boolean.TRUE; } else { newVal = new Boolean(!((Boolean) oldVal).booleanValue()); } } else if (property.getPropertyType() == SQLCatalog.class) { newVal = new SQLCatalog(new SQLDatabase(), "This is a new catalog"); } else if (property.getPropertyType() == SPDataSource.class) { newVal = new JDBCDataSource(getPLIni()); ((SPDataSource) newVal).setName("test"); ((SPDataSource) newVal).setDisplayName("test"); ((JDBCDataSource) newVal).setUser("a"); ((JDBCDataSource) newVal).setPass("b"); ((JDBCDataSource) newVal).getParentType().setJdbcDriver(MockJDBCDriver.class.getName()); ((JDBCDataSource) newVal).setUrl("jdbc:mock:tables=tab1,tab2"); } else if (property.getPropertyType() == JDBCDataSource.class) { newVal = new JDBCDataSource(getPLIni()); ((SPDataSource) newVal).setName("test"); ((SPDataSource) newVal).setDisplayName("test"); ((JDBCDataSource) newVal).setUser("a"); ((JDBCDataSource) newVal).setPass("b"); ((JDBCDataSource) newVal).getParentType().setJdbcDriver(MockJDBCDriver.class.getName()); ((JDBCDataSource) newVal).setUrl("jdbc:mock:tables=tab1,tab2"); } else if (property.getPropertyType() == SQLTable.class) { newVal = new SQLTable(); } else if (property.getPropertyType() == SQLColumn.class) { newVal = new SQLColumn(); } else if (property.getPropertyType() == SQLIndex.class) { newVal = new SQLIndex(); } else if (property.getPropertyType() == SQLRelationship.SQLImportedKey.class) { SQLRelationship rel = new SQLRelationship(); newVal = rel.getForeignKey(); } else if (property.getPropertyType() == SQLRelationship.Deferrability.class) { if (oldVal == SQLRelationship.Deferrability.INITIALLY_DEFERRED) { newVal = SQLRelationship.Deferrability.NOT_DEFERRABLE; } else { newVal = SQLRelationship.Deferrability.INITIALLY_DEFERRED; } } else if (property.getPropertyType() == SQLIndex.AscendDescend.class) { if (oldVal == SQLIndex.AscendDescend.ASCENDING) { newVal = SQLIndex.AscendDescend.DESCENDING; } else { newVal = SQLIndex.AscendDescend.ASCENDING; } } else if (property.getPropertyType() == Throwable.class) { newVal = new Throwable(); } else if (property.getPropertyType() == BasicSQLType.class) { if (oldVal != BasicSQLType.OTHER) { newVal = BasicSQLType.OTHER; } else { newVal = BasicSQLType.TEXT; } } else if (property.getPropertyType() == UserDefinedSQLType.class) { newVal = new UserDefinedSQLType(); } else if (property.getPropertyType() == SQLTypeConstraint.class) { if (oldVal != SQLTypeConstraint.NONE) { newVal = SQLTypeConstraint.NONE; } else { newVal = SQLTypeConstraint.CHECK; } } else if (property.getPropertyType() == SQLCheckConstraint.class) { newVal = new SQLCheckConstraint("check constraint name", "check constraint condition"); } else if (property.getPropertyType() == SQLEnumeration.class) { newVal = new SQLEnumeration("some enumeration"); } else if (property.getPropertyType() == String[].class) { newVal = new String[3]; } else if (property.getPropertyType() == PropertyType.class) { if (oldVal != PropertyType.NOT_APPLICABLE) { newVal = PropertyType.NOT_APPLICABLE; } else { newVal = PropertyType.VARIABLE; } } else { throw new RuntimeException("This test case lacks a value for " + property.getName() + " (type " + property.getPropertyType().getName() + ") from " + so.getClass()); } int oldChangeCount = undoManager.getUndoableEditCount(); try { BeanUtils.copyProperty(so, property.getName(), newVal); // some setters fire multiple events (they change more than one property) but only register one as an undo assertEquals( "Event for set " + property.getName() + " on " + so.getClass().getName() + " added multiple (" + undoManager.printUndoVector() + ") undos!", oldChangeCount + 1, undoManager.getUndoableEditCount()); } catch (InvocationTargetException e) { System.out.println("(non-fatal) Failed to write property '" + property.getName() + " to type " + so.getClass().getName()); } } }