Example usage for java.beans PropertyDescriptor getName

List of usage examples for java.beans PropertyDescriptor getName

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor getName.

Prototype

public String getName() 

Source Link

Document

Gets the programmatic name of this feature.

Usage

From source file:io.spring.initializr.generator.ProjectGenerator.java

/**
 * Resolve the specified {@link ProjectRequest} and return the model to use to
 * generate the project/*  ww  w  . ja va 2  s .  co m*/
 * @param originalRequest the request to handle
 * @return a model for that request
 */
protected Map<String, Object> resolveModel(ProjectRequest originalRequest) {
    Assert.notNull(originalRequest.getBootVersion(), "boot version must not be null");
    Map<String, Object> model = new LinkedHashMap<>();
    InitializrMetadata metadata = metadataProvider.get();

    ProjectRequest request = requestResolver.resolve(originalRequest, metadata);

    // request resolved so we can log what has been requested
    List<Dependency> dependencies = request.getResolvedDependencies();
    List<String> dependencyIds = dependencies.stream().map(Dependency::getId).collect(Collectors.toList());
    log.info("Processing request{type=" + request.getType() + ", dependencies=" + dependencyIds);

    if (isWar(request)) {
        model.put("war", true);
    }

    if (isMavenBuild(request)) {
        model.put("mavenBuild", true);
        ParentPom parentPom = metadata.getConfiguration().getEnv().getMaven()
                .resolveParentPom(request.getBootVersion());
        if (parentPom.isIncludeSpringBootBom() && !request.getBoms().containsKey("spring-boot")) {
            request.getBoms().put("spring-boot",
                    metadata.createSpringBootBom(request.getBootVersion(), "spring-boot.version"));
        }

        model.put("mavenParentGroupId", parentPom.getGroupId());
        model.put("mavenParentArtifactId", parentPom.getArtifactId());
        model.put("mavenParentVersion", parentPom.getVersion());
        model.put("includeSpringBootBom", parentPom.isIncludeSpringBootBom());
    }

    model.put("repositoryValues", request.getRepositories().entrySet());
    if (!request.getRepositories().isEmpty()) {
        model.put("hasRepositories", true);
    }

    List<BillOfMaterials> resolvedBoms = request.getBoms().values().stream()
            .sorted(Comparator.comparing(BillOfMaterials::getOrder)).collect(Collectors.toList());
    model.put("resolvedBoms", resolvedBoms);
    ArrayList<BillOfMaterials> reversedBoms = new ArrayList<>(resolvedBoms);
    Collections.reverse(reversedBoms);
    model.put("reversedBoms", reversedBoms);

    model.put("compileDependencies", filterDependencies(dependencies, Dependency.SCOPE_COMPILE));
    model.put("runtimeDependencies", filterDependencies(dependencies, Dependency.SCOPE_RUNTIME));
    model.put("compileOnlyDependencies", filterDependencies(dependencies, Dependency.SCOPE_COMPILE_ONLY));
    model.put("providedDependencies", filterDependencies(dependencies, Dependency.SCOPE_PROVIDED));
    model.put("testDependencies", filterDependencies(dependencies, Dependency.SCOPE_TEST));

    request.getBoms().forEach((k, v) -> {
        if (v.getVersionProperty() != null) {
            request.getBuildProperties().getVersions().computeIfAbsent(v.getVersionProperty(),
                    key -> v::getVersion);
        }
    });

    Map<String, String> versions = new LinkedHashMap<>();
    model.put("buildPropertiesVersions", versions.entrySet());
    request.getBuildProperties().getVersions().forEach((k, v) -> versions.put(k, v.get()));
    Map<String, String> gradle = new LinkedHashMap<>();
    model.put("buildPropertiesGradle", gradle.entrySet());
    request.getBuildProperties().getGradle().forEach((k, v) -> gradle.put(k, v.get()));
    Map<String, String> maven = new LinkedHashMap<>();
    model.put("buildPropertiesMaven", maven.entrySet());
    request.getBuildProperties().getMaven().forEach((k, v) -> maven.put(k, v.get()));

    // Add various versions
    model.put("dependencyManagementPluginVersion",
            metadata.getConfiguration().getEnv().getGradle().getDependencyManagementPluginVersion());
    model.put("kotlinVersion", metadata.getConfiguration().getEnv().getKotlin().getVersion());
    if ("kotlin".equals(request.getLanguage())) {
        model.put("kotlin", true);
    }
    if ("groovy".equals(request.getLanguage())) {
        model.put("groovy", true);
    }

    model.put("isRelease", request.getBootVersion().contains("RELEASE"));
    // @SpringBootApplication available as from 1.2.0.RC1
    model.put("useSpringBootApplication",
            VERSION_1_2_0_RC1.compareTo(Version.safeParse(request.getBootVersion())) <= 0);

    // Gradle plugin has changed as from 1.3.0
    model.put("bootOneThreeAvailable",
            VERSION_1_3_0_M1.compareTo(Version.safeParse(request.getBootVersion())) <= 0);

    // Gradle plugin has changed again as from 1.4.2
    model.put("springBootPluginName",
            (VERSION_1_4_2_M1.compareTo(Version.safeParse(request.getBootVersion())) <= 0
                    ? "org.springframework.boot"
                    : "spring-boot"));

    // New testing stuff
    model.put("newTestInfrastructure", isNewTestInfrastructureAvailable(request));

    // New Servlet Initializer location
    model.put("newServletInitializer", isNewServletInitializerAvailable(request));

    // Java versions
    model.put("isJava6", isJavaVersion(request, "1.6"));
    model.put("isJava7", isJavaVersion(request, "1.7"));
    model.put("isJava8", isJavaVersion(request, "1.8"));

    // Append the project request to the model
    BeanWrapperImpl bean = new BeanWrapperImpl(request);
    for (PropertyDescriptor descriptor : bean.getPropertyDescriptors()) {
        if (bean.isReadableProperty(descriptor.getName())) {
            model.put(descriptor.getName(), bean.getPropertyValue(descriptor.getName()));
        }
    }
    if (!request.getBoms().isEmpty()) {
        model.put("hasBoms", true);
    }

    return model;
}

From source file:com.opensymphony.xwork2.ognl.OgnlUtil.java

/**
 * Copies the properties in the object "from" and sets them in the object "to"
 * only setting properties defined in the given "editable" class (or interface)
 * using specified type converter, or {@link com.opensymphony.xwork2.conversion.impl.XWorkConverter} if none
 * is specified./*from w  ww  .j a  v a  2s  . com*/
 *
 * @param from       the source object
 * @param to         the target object
 * @param context    the action context we're running under
 * @param exclusions collection of method names to excluded from copying ( can be null)
 * @param inclusions collection of method names to included copying  (can be null)
 *                   note if exclusions AND inclusions are supplied and not null nothing will get copied.
 * @param editable the class (or interface) to restrict property setting to
 */
public void copy(final Object from, final Object to, final Map<String, Object> context,
        Collection<String> exclusions, Collection<String> inclusions, Class<?> editable) {
    if (from == null || to == null) {
        LOG.warn(
                "Attempting to copy from or to a null source. This is illegal and is bein skipped. This may be due to an error in an OGNL expression, action chaining, or some other event.");
        return;
    }

    TypeConverter converter = getTypeConverterFromContext(context);
    final Map contextFrom = createDefaultContext(from, null);
    Ognl.setTypeConverter(contextFrom, converter);
    final Map contextTo = createDefaultContext(to, null);
    Ognl.setTypeConverter(contextTo, converter);

    PropertyDescriptor[] fromPds;
    PropertyDescriptor[] toPds;

    try {
        fromPds = getPropertyDescriptors(from);
        if (editable != null) {
            toPds = getPropertyDescriptors(editable);
        } else {
            toPds = getPropertyDescriptors(to);
        }
    } catch (IntrospectionException e) {
        LOG.error("An error occurred", e);
        return;
    }

    Map<String, PropertyDescriptor> toPdHash = new HashMap<>();

    for (PropertyDescriptor toPd : toPds) {
        toPdHash.put(toPd.getName(), toPd);
    }

    for (PropertyDescriptor fromPd : fromPds) {
        if (fromPd.getReadMethod() != null) {
            boolean copy = true;
            if (exclusions != null && exclusions.contains(fromPd.getName())) {
                copy = false;
            } else if (inclusions != null && !inclusions.contains(fromPd.getName())) {
                copy = false;
            }

            if (copy) {
                PropertyDescriptor toPd = toPdHash.get(fromPd.getName());
                if ((toPd != null) && (toPd.getWriteMethod() != null)) {
                    try {
                        compileAndExecute(fromPd.getName(), context, new OgnlTask<Object>() {
                            public Void execute(Object expr) throws OgnlException {
                                Object value = Ognl.getValue(expr, contextFrom, from);
                                Ognl.setValue(expr, contextTo, to, value);
                                return null;
                            }
                        });

                    } catch (OgnlException e) {
                        LOG.debug("Got OGNL exception", e);
                    }
                }

            }

        }

    }
}

From source file:org.grails.datastore.mapping.model.config.GormMappingConfigurationStrategy.java

/**
 * Finds a property type is an array of descriptors for the given property name
 *
 * @param descriptors The descriptors/*from ww w  .j  av  a 2s  .  c o  m*/
 * @param propertyName The property name
 * @return The Class or null
 */
private PropertyDescriptor findProperty(List<PropertyDescriptor> descriptors, String propertyName) {
    for (PropertyDescriptor descriptor : descriptors) {
        if (descriptor.getName().equals(propertyName)) {
            return descriptor;
        }
    }
    return null;
}

From source file:ca.sqlpower.matchmaker.MatchMakerTestCase.java

public void testDuplicate() throws Exception {
    MatchMakerObject mmo = getTarget();//from w w  w.  j  a v a  2s .  com

    List<PropertyDescriptor> settableProperties;
    settableProperties = Arrays.asList(PropertyUtils.getPropertyDescriptors(mmo.getClass()));
    propertiesToIgnoreForDuplication.add("defaultInputClass");
    propertiesToIgnoreForDuplication.add("parameters");
    propertiesToIgnoreForDuplication.add("MSOInputs");
    propertiesToIgnoreForDuplication.add("UUID");
    propertiesToIgnoreForDuplication.add("oid");
    propertiesToIgnoreForDuplication.add("parent");
    propertiesToIgnoreForDuplication.add("parentProject");
    propertiesToIgnoreForDuplication.add("session");
    propertiesToIgnoreForDuplication.add("allowedChildTypes");
    propertiesToIgnoreForDuplication.add("cachableTable");
    propertiesToIgnoreForDuplication.add("cachableColumn");
    propertiesToIgnoreForDuplication.add("importedCachableColumn");
    propertiesToIgnoreForDuplication.add("class");
    propertiesToIgnoreForDuplication.add("createDate");
    propertiesToIgnoreForDuplication.add("createAppUser");
    propertiesToIgnoreForDuplication.add("createOsUser");
    propertiesToIgnoreForDuplication.add("dependencies");
    propertiesToIgnoreForDuplication.add("children");
    propertiesToIgnoreForDuplication.add("lastUpdateDate");
    propertiesToIgnoreForDuplication.add("lastUpdateAppUser");
    propertiesToIgnoreForDuplication.add("lastUpdateOSUser");
    propertiesToIgnoreForDuplication.add("magicEnabled");
    propertiesToIgnoreForDuplication.add("mergingEngine");
    propertiesToIgnoreForDuplication.add("matchingEngine");
    propertiesToIgnoreForDuplication.add("cleansingEngine");
    propertiesToIgnoreForDuplication.add("addressCorrectionEngine");
    propertiesToIgnoreForDuplication.add("addressCommittingEngine");
    propertiesToIgnoreForDuplication.add("undoing");
    propertiesToIgnoreForDuplication.add("results");
    propertiesToIgnoreForDuplication.add("runningEngine");
    propertiesToIgnoreForDuplication.add("runnableDispatcher");
    propertiesToIgnoreForDuplication.add("workspaceContainer");
    propertiesToIgnoreForDuplication.add("tableMergeRules");
    propertiesToIgnoreForDuplication.add("resultStep");
    propertiesToIgnoreForDuplication.add("inputSteps");
    propertiesToIgnoreForDuplication.add("mungeSteps");
    propertiesToIgnoreForDuplication.add("projects");
    propertiesToIgnoreForDuplication.add("JDBCDataSource");
    propertiesToIgnoreForDuplication.add("table");
    propertiesToIgnoreForDuplication.add("tableIndex");
    propertiesToIgnoreForDuplication.add("columnMergeRules");
    propertiesToIgnoreForDuplication.add("inputs");
    propertiesToIgnoreForDuplication.add("mungeStepOutputs");
    propertiesToIgnoreForDuplication.add("parameterNames");
    propertiesToIgnoreForDuplication.add("project");
    propertiesToIgnoreForDuplication.add("addressStatus");
    propertiesToIgnoreForDuplication.add("addressDB");
    propertiesToIgnoreForDuplication.add("open");
    propertiesToIgnoreForDuplication.add("expanded");
    propertiesToIgnoreForDuplication.add("position");
    propertiesToIgnoreForDuplication.add("inputCount");
    propertiesToIgnoreForDuplication.add("matchPool");
    propertiesToIgnoreForDuplication.add("resultTableCatalog");
    propertiesToIgnoreForDuplication.add("resultTableName");
    propertiesToIgnoreForDuplication.add("resultTableSchema");
    propertiesToIgnoreForDuplication.add("resultTableSPDataSource");
    propertiesToIgnoreForDuplication.add("sourceTableCatalog");
    propertiesToIgnoreForDuplication.add("sourceTableName");
    propertiesToIgnoreForDuplication.add("sourceTableSchema");
    propertiesToIgnoreForDuplication.add("sourceTableSPDataSource");
    propertiesToIgnoreForDuplication.add("xrefTableCatalog");
    propertiesToIgnoreForDuplication.add("xrefTableName");
    propertiesToIgnoreForDuplication.add("xrefTableSchema");
    propertiesToIgnoreForDuplication.add("xrefTableSPDataSource");

    //this throws an exception if the DS does not exist
    propertiesToIgnoreForDuplication.add("spDataSource");

    // First pass: set all settable properties, because testing the duplication of
    //             an object with all its properties at their defaults is not a
    //             very convincing test of duplication!
    for (PropertyDescriptor property : settableProperties) {
        if (propertiesToIgnoreForDuplication.contains(property.getName()))
            continue;
        Object oldVal;
        try {
            oldVal = PropertyUtils.getSimpleProperty(mmo, property.getName());
            // check for a setter
            if (property.getWriteMethod() != null && !property.getName().equals("children")) {
                Object newVal = getNewDifferentValue(mmo, property, oldVal);
                BeanUtils.copyProperty(mmo, property.getName(), newVal);
            }
        } catch (NoSuchMethodException e) {
            System.out.println(
                    "Skipping non-settable property " + property.getName() + " on " + mmo.getClass().getName());
        }
    }
    // Second pass get a copy make sure all of 
    // the original mutable objects returned from getters are different
    // between the two objects, but have the same values. 
    MatchMakerObject duplicate = mmo.duplicate((MatchMakerObject) mmo.getParent());
    for (PropertyDescriptor property : settableProperties) {
        if (propertiesToIgnoreForDuplication.contains(property.getName()))
            continue;
        Object oldVal;
        try {
            oldVal = PropertyUtils.getSimpleProperty(mmo, property.getName());
            /*
             * If this value is an unmodifiable list, it is then going to be a property
             * we do not wish to test duplication for, like the children lists. This
             * is a way to catch them all at once.
             */
            boolean listIsModifiable = true;
            if (oldVal instanceof List) {
                List l = (List) oldVal;
                try {
                    l.add("test");
                    l.remove("test");
                } catch (UnsupportedOperationException e) {
                    listIsModifiable = false;
                }
            }
            if (listIsModifiable) {
                Object copyVal = PropertyUtils.getSimpleProperty(duplicate, property.getName());
                if (oldVal == null) {
                    throw new NullPointerException("We forgot to set " + property.getName());
                } else {
                    if (oldVal instanceof MungeStep) {
                        MungeStep oldStep = (MungeStep) oldVal;
                        MungeStep copyStep = (MungeStep) copyVal;
                        assertNotSame("The two MungeStep's share the same instance.", oldVal, copyVal);

                        assertEquals("The two names are different.", oldStep.getName(), copyStep.getName());
                        assertEquals("The two visible properties are different.", oldStep.isVisible(),
                                copyStep.isVisible());

                    } else {
                        assertEquals("The two values for property " + property.getDisplayName() + " in "
                                + mmo.getClass().getName() + " should be equal", oldVal, copyVal);

                        if (propertiesShareInstanceForDuplication.contains(property.getName()))
                            return;

                        /*
                         * Ok, the duplicate object's property value compared equal.
                         * Now we want to make sure if we modify that property on the original,
                         * it won't affect the copy.
                         */
                        Object newCopyVal = modifyObject(mmo, property, copyVal);

                        assertFalse(
                                "The two values are the same mutable object for property "
                                        + property.getDisplayName() + " was " + oldVal + " and " + copyVal,
                                oldVal.equals(newCopyVal));
                    }
                }
            }
        } catch (NoSuchMethodException e) {
            System.out.println(
                    "Skipping non-settable property " + property.getName() + " on " + mmo.getClass().getName());
        }
    }
}

From source file:org.grails.datastore.mapping.model.config.GormMappingConfigurationStrategy.java

/**
 * check if mappedBy is set explicitly to null for the given property.
 * @param property/* w w w .jav  a 2  s.c o  m*/
 * @param mappedBy
 * @return
 */
private boolean forceUnidirectional(PropertyDescriptor property, Map mappedBy) {
    return mappedBy.containsKey(property.getName()) && (mappedBy.get(property.getName()) == null);
}

From source file:org.paxml.control.IterateTag.java

private ChildrenResultList visitBean(Context context, Object bean, boolean readValue) {
    if (bean == null) {
        return null;
    }//w w w .  j a  v a 2  s  .c o m
    ChildrenResultList list = null;
    int i = 0;
    for (PropertyDescriptor d : ReflectUtils.getPropertyDescriptors(bean.getClass(),
            PropertyDescriptorType.GETTER)) {
        Method method = d.getReadMethod();
        Object value = null;
        if (readValue) {
            try {
                value = method.invoke(bean);
            } catch (Exception e) {
                throw new PaxmlRuntimeException(
                        "Cannot read property '" + d.getName() + "' from class: " + bean.getClass().getName(),
                        e);
            }
        }

        list = addAll(list, visit(context, bean, d.getName(), i++, value));
    }
    return list;
}

From source file:org.jdal.ui.ViewSupport.java

/**
 * Bind controls following the same name convention or annotated with Property annotation.
 *//*from w  ww  .j av  a2  s  . c om*/
public void autobind() {
    BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(getModel());
    PropertyAccessor viewPropertyAccessor = new DirectFieldAccessor(this);

    // Parse Property annotations
    List<AnnotatedElement> elements = AnnotatedElementAccessor.findAnnotatedElements(Property.class,
            getClass());

    for (AnnotatedElement ae : elements) {
        Property p = ae.getAnnotation(Property.class);
        InitializationConfig config = getInitializationConfig(ae.getAnnotation(Initializer.class));
        bindAndInitializeControl(p.value(), viewPropertyAccessor.getPropertyValue(((Field) ae).getName()),
                config);
        this.ignoredProperties.add(p.value());
    }

    // Iterate on model properties
    for (PropertyDescriptor pd : bw.getPropertyDescriptors()) {
        String propertyName = pd.getName();
        if (!ignoredProperties.contains(propertyName)
                && viewPropertyAccessor.isReadableProperty(propertyName)) {
            Object control = viewPropertyAccessor.getPropertyValue(propertyName);

            if (control != null) {
                if (log.isDebugEnabled())
                    log.debug("Found control: " + control.getClass().getSimpleName() + " for property: "
                            + propertyName);
                TypeDescriptor descriptor = viewPropertyAccessor.getPropertyTypeDescriptor(propertyName);
                InitializationConfig config = getInitializationConfig(
                        descriptor.getAnnotation(Initializer.class));
                // do bind
                bindAndInitializeControl(propertyName, control, config);
            }
        }
    }
}

From source file:org.tylproject.vaadin.addon.MongoContainer.java

MongoContainer(Builder<Bean> bldr) {
    this.criteria = bldr.mongoCriteria;
    this.baseSort = bldr.sort;
    this.filterConverter = bldr.filterConverter;
    this.baseQuery = Query.query(criteria).with(baseSort);
    resetQuery();/* w  ww .  j av a 2s.  c  om*/

    this.mongoOps = bldr.mongoOps;

    this.beanClass = bldr.beanClass;
    this.beanFactory = bldr.beanFactory;

    if (bldr.hasCustomPropertyList) {
        this.simpleProperties = Collections.unmodifiableMap(bldr.simpleProperties);
    } else {
        // otherwise, get them via reflection
        this.simpleProperties = new LinkedHashMap<String, Class<?>>();
        PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(beanClass);
        for (PropertyDescriptor d : descriptors) {
            this.simpleProperties.put(d.getName(), d.getPropertyType());
        }
    }

    if (bldr.hasNestedPropertyList) {
        this.nestedProperties = Collections.unmodifiableMap(bldr.nestedProperties);
    } else {
        nestedProperties = Collections.emptyMap();
    }

    List<Object> allProps = new ArrayList<Object>(simpleProperties.keySet());

    // remove "class" pseudo-property for compliance with BeanItem
    allProps.remove("class");

    this.allProperties = Collections.unmodifiableList(allProps);
    allProps.addAll(nestedProperties.keySet());

    this.pageSize = bldr.pageSize;

}

From source file:ca.sqlpower.architect.swingui.TestPlayPen.java

/**
 * Checks that the properties of an instance from the copy constructor are equal to the original.
 * In the case of a mutable property, it also checks that they don't share the same instance.
 * //from ww  w.  ja  v a2 s. c om
 * @throws Exception
 */
public void testCopyConstructor() throws Exception {
    List<PropertyDescriptor> settableProperties = Arrays
            .asList(PropertyUtils.getPropertyDescriptors(pp.getClass()));
    Set<String> copyIgnoreProperties = new HashSet<String>();

    copyIgnoreProperties.add("UI");
    copyIgnoreProperties.add("UIClassID");
    copyIgnoreProperties.add("accessibleContext");
    copyIgnoreProperties.add("actionMap");
    copyIgnoreProperties.add("alignmentX");
    copyIgnoreProperties.add("alignmentY");
    copyIgnoreProperties.add("ancestorListeners");
    copyIgnoreProperties.add("autoscrolls");
    copyIgnoreProperties.add("border");
    copyIgnoreProperties.add("class");
    copyIgnoreProperties.add("component");
    copyIgnoreProperties.add("componentPopupMenu");
    copyIgnoreProperties.add("containerListeners");
    copyIgnoreProperties.add("contentPane");
    copyIgnoreProperties.add("cursorManager");
    copyIgnoreProperties.add("debugGraphicsOptions");
    copyIgnoreProperties.add("doubleBuffered");
    copyIgnoreProperties.add("enabled");
    copyIgnoreProperties.add("focusCycleRoot");
    copyIgnoreProperties.add("focusTraversalKeys");
    copyIgnoreProperties.add("focusTraversalPolicy");
    copyIgnoreProperties.add("focusTraversalPolicyProvider");
    copyIgnoreProperties.add("focusTraversalPolicySet");
    copyIgnoreProperties.add("focusable");
    copyIgnoreProperties.add("fontRenderContext");
    copyIgnoreProperties.add("graphics");
    copyIgnoreProperties.add("height");
    copyIgnoreProperties.add("ignoreTreeSelection");
    copyIgnoreProperties.add("inheritsPopupMenu");
    copyIgnoreProperties.add("inputMap");
    copyIgnoreProperties.add("inputVerifier");
    copyIgnoreProperties.add("insets");
    copyIgnoreProperties.add("layout");
    copyIgnoreProperties.add("managingFocus");
    copyIgnoreProperties.add("maximumSize");
    copyIgnoreProperties.add("minimumSize");
    copyIgnoreProperties.add("mouseMode");
    copyIgnoreProperties.add("name");
    copyIgnoreProperties.add("nextFocusableComponent");
    copyIgnoreProperties.add("opaque");
    copyIgnoreProperties.add("optimizedDrawingEnabled");
    copyIgnoreProperties.add("paintingEnabled");
    copyIgnoreProperties.add("paintingTile");
    copyIgnoreProperties.add("panel");
    copyIgnoreProperties.add("playPenContentPane");
    copyIgnoreProperties.add("preferredScrollableViewportSize");
    copyIgnoreProperties.add("preferredSize");
    copyIgnoreProperties.add("registeredKeyStrokes");
    copyIgnoreProperties.add("requestFocusEnabled");
    copyIgnoreProperties.add("rootPane");
    copyIgnoreProperties.add("scrollableTracksViewportHeight");
    copyIgnoreProperties.add("scrollableTracksViewportWidth");
    copyIgnoreProperties.add("selectedItems");
    copyIgnoreProperties.add("selectedRelationShips");
    copyIgnoreProperties.add("selectedTables");
    copyIgnoreProperties.add("session");
    copyIgnoreProperties.add("topLevelAncestor");
    copyIgnoreProperties.add("toolTipText");
    copyIgnoreProperties.add("transferHandler");
    copyIgnoreProperties.add("usedArea");
    copyIgnoreProperties.add("validateRoot");
    copyIgnoreProperties.add("verifyInputWhenFocusTarget");
    copyIgnoreProperties.add("vetoableChangeListeners");
    copyIgnoreProperties.add("viewPosition");
    copyIgnoreProperties.add("viewportSize");
    copyIgnoreProperties.add("visible");
    copyIgnoreProperties.add("visibleRect");
    copyIgnoreProperties.add("width");
    copyIgnoreProperties.add("x");
    copyIgnoreProperties.add("y");

    copyIgnoreProperties.add("draggingTablePanes");
    copyIgnoreProperties.add("rubberBand");

    // These should not be copied because any new PlayPen needs
    // different values or else it will not work on the new
    // PlayPen.
    copyIgnoreProperties.add("mouseZoomInAction");
    copyIgnoreProperties.add("mouseZoomOutAction");
    copyIgnoreProperties.add("scrollPane");

    // we're not sure if zoom should be duplicated...
    // it might mess up printing?!?!?
    copyIgnoreProperties.add("zoom");

    // individual lists (e.g. tables) checked instead
    copyIgnoreProperties.add("components");

    // The copy of the play pen is for things like print preview, so we don't want to
    // duplicate menus and other interactive features. (?)
    copyIgnoreProperties.add("popupFactory");

    //This property is specific to each play pen and it's settings will be re-calculated
    //regularly so it does not need to be copied.
    copyIgnoreProperties.add("criticismBucket");

    // First pass: set all settable properties, because testing the duplication of
    //             an object with all its properties at their defaults is not a
    //             very convincing test of duplication!
    for (PropertyDescriptor property : settableProperties) {
        if (copyIgnoreProperties.contains(property.getName()))
            continue;
        Object oldVal;
        try {
            oldVal = PropertyUtils.getSimpleProperty(pp, property.getName());
            // check for a setter
            if (property.getWriteMethod() != null) {
                Object newVal = getNewDifferentValue(property, oldVal);
                BeanUtils.copyProperty(pp, property.getName(), newVal);
            }
        } catch (NoSuchMethodException e) {
            logger.warn(
                    "Skipping non-settable property " + property.getName() + " on " + pp.getClass().getName());
        }
    }
    // Second pass get a copy make sure all of 
    // the original mutable objects returned from getters are different
    // between the two objects, but have the same values. 
    PlayPen duplicate = new PlayPen(pp.getSession(), pp);
    for (PropertyDescriptor property : settableProperties) {
        logger.info(property.getName() + property.getDisplayName() + property.getShortDescription());
        if (copyIgnoreProperties.contains(property.getName()))
            continue;
        Object oldVal;
        try {
            oldVal = PropertyUtils.getSimpleProperty(pp, property.getName());
            Object copyVal = PropertyUtils.getSimpleProperty(duplicate, property.getName());
            if (oldVal == null) {
                throw new NullPointerException("We forgot to set " + property.getName());
            } else {
                assertEquals("The two values for property " + property.getDisplayName() + " in "
                        + pp.getClass().getName() + " should be equal", oldVal, copyVal);

                if (isPropertyInstanceMutable(property)) {
                    assertNotSame("Copy shares mutable property with original, property name: "
                            + property.getDisplayName(), copyVal, oldVal);
                }
            }
        } catch (NoSuchMethodException e) {
            logger.warn(
                    "Skipping non-settable property " + property.getName() + " on " + pp.getClass().getName());
        }
    }
}