Java Code Examples for java.beans.PropertyDescriptor#setValue()

The following examples show how to use java.beans.PropertyDescriptor#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyDescriptorUtils.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * See {@link java.beans.FeatureDescriptor}.
 */
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) {
	target.setExpert(source.isExpert());
	target.setHidden(source.isHidden());
	target.setPreferred(source.isPreferred());
	target.setName(source.getName());
	target.setShortDescription(source.getShortDescription());
	target.setDisplayName(source.getDisplayName());

	// Copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
	Enumeration<String> keys = source.attributeNames();
	while (keys.hasMoreElements()) {
		String key = keys.nextElement();
		target.setValue(key, source.getValue(key));
	}

	// See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor)
	target.setPropertyEditorClass(source.getPropertyEditorClass());
	target.setBound(source.isBound());
	target.setConstrained(source.isConstrained());
}
 
Example 2
Source File: ExtendedBeanInfo.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
		throws IntrospectionException {

	target.setExpert(source.isExpert());
	target.setHidden(source.isHidden());
	target.setPreferred(source.isPreferred());
	target.setName(source.getName());
	target.setShortDescription(source.getShortDescription());
	target.setDisplayName(source.getDisplayName());

	// Copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
	Enumeration<String> keys = source.attributeNames();
	while (keys.hasMoreElements()) {
		String key = keys.nextElement();
		target.setValue(key, source.getValue(key));
	}

	// See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor)
	target.setPropertyEditorClass(source.getPropertyEditorClass());
	target.setBound(source.isBound());
	target.setConstrained(source.isConstrained());
}
 
Example 3
Source File: PlainTextConfigElementBeanInfo.java    From pepper-box with Apache License 2.0 6 votes vote down vote up
/**
* Constructor which creates property group and creates UI for PlainTextConfigElement.
*/
public PlainTextConfigElementBeanInfo() {

    super(PlainTextConfigElement.class);

    //Create property group
    createPropertyGroup("plain_text_load_generator", new String[] {
            PLACE_HOLDER, JSON_SCHEMA
    });

    PropertyDescriptor placeHolderProps = property(PLACE_HOLDER);
    placeHolderProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    placeHolderProps.setValue(DEFAULT, PropsKeys.MSG_PLACEHOLDER);
    placeHolderProps.setValue(NOT_EXPRESSION, Boolean.TRUE);

    //Create inout Text Area
    PropertyDescriptor p = property(JSON_SCHEMA);
    p.setPropertyEditorClass(TextAreaEditor.class);
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
}
 
Example 4
Source File: PropertyDescriptorUtils.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * See {@link java.beans.FeatureDescriptor}.
 */
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
		throws IntrospectionException {

	target.setExpert(source.isExpert());
	target.setHidden(source.isHidden());
	target.setPreferred(source.isPreferred());
	target.setName(source.getName());
	target.setShortDescription(source.getShortDescription());
	target.setDisplayName(source.getDisplayName());

	// Copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
	Enumeration<String> keys = source.attributeNames();
	while (keys.hasMoreElements()) {
		String key = keys.nextElement();
		target.setValue(key, source.getValue(key));
	}

	// See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor)
	target.setPropertyEditorClass(source.getPropertyEditorClass());
	target.setBound(source.isBound());
	target.setConstrained(source.isConstrained());
}
 
Example 5
Source File: Test4984912.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 6
Source File: Test4984912.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 7
Source File: Test4984912.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 8
Source File: Test4984912.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 9
Source File: SerializedConfigElementBeanInfo.java    From pepper-box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor which creates property group and creates UI for SerializedConfigElement.
 */
public SerializedConfigElementBeanInfo() {

    super(SerializedConfigElement.class);

    //Create Property group
    createPropertyGroup("serialized_load_generator", new String[] {
            PLACE_HOLDER, CLASS_NAME, OBJ_PROPERTIES
    });

    PropertyDescriptor placeHolderProps = property(PLACE_HOLDER);
    placeHolderProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    placeHolderProps.setValue(DEFAULT, PropsKeys.MSG_PLACEHOLDER);
    placeHolderProps.setValue(NOT_EXPRESSION, Boolean.TRUE);

    //Create table editor component of jmeter for class field and expression mapping
    TypeEditor tableEditor = TypeEditor.TableEditor;
    PropertyDescriptor tableProperties = property(OBJ_PROPERTIES, tableEditor);
    tableProperties.setValue(TableEditor.CLASSNAME, FieldExpressionMapping.class.getName());
    tableProperties.setValue(TableEditor.HEADERS, new String[]{ "Field Name", "Field Expression" } );
    tableProperties.setValue(TableEditor.OBJECT_PROPERTIES, new String[]{ FieldExpressionMapping.FIELD_NAME, FieldExpressionMapping.FIELD_EXPRESSION } );
    tableProperties.setValue(DEFAULT, new ArrayList<>());
    tableProperties.setValue(NOT_UNDEFINED, Boolean.TRUE);

    //Create class name input textfield
    PropertyDescriptor classNameProps = property(CLASS_NAME);
    classNameProps.setPropertyEditorClass(ClassPropertyEditor.class);
    classNameProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    classNameProps.setValue(DEFAULT, "<POJO class name>");

}
 
Example 10
Source File: Test7193977.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 11
Source File: Test4984912.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 12
Source File: Test7193977.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 13
Source File: Test7193977.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 14
Source File: Test4984912.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 15
Source File: Test7193977.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 16
Source File: Test4984912.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 17
Source File: Test7193977.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 18
Source File: CassandraConnectionBeanInfo.java    From jmeter-cassandra with Apache License 2.0 4 votes vote down vote up
public CassandraConnectionBeanInfo() {
    super(CassandraConnection.class);

    createPropertyGroup("varName", new String[] { "sessionName" });

    createPropertyGroup("cluster", new String[] { "contactPoints", "keyspace", "username", "password" });

    createPropertyGroup("loadbalancergroup", new String[] { "loadBalancer", "localDataCenter" });

    PropertyDescriptor p = property("contactPoints");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("sessionName");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("keyspace");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("username");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("password", TypeEditor.PasswordEditor);
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");

    p = property("loadBalancer"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, CassandraConnection.DEFAULTLOADBALANCER);
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
             CassandraConnection.ROUND_ROBIN,
             CassandraConnection.DC_AWARE_ROUND_ROBIN,
             CassandraConnection.DC_TOKEN_AWARE,
             CassandraConnection.WHITELIST,
             CassandraConnection.DEFAULTLOADBALANCER
    });

    p = property("localDataCenter");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
}
 
Example 19
Source File: CassandraTestElementBeanInfoSupport.java    From jmeter-cassandra with Apache License 2.0 4 votes vote down vote up
/**
 *
 */
public CassandraTestElementBeanInfoSupport(Class<? extends TestBean> beanClass) {
    super(beanClass);

    createPropertyGroup("varName", // $NON-NLS-1$
            new String[]{"sessionName" }); // $NON-NLS-1$

    createPropertyGroup("cql", // $NON-NLS-1$
            new String[] {
            "queryType", // $NON-NLS-1$
            "query", // $NON-NLS-1$
            "queryArguments", // $NON-NLS-1$
            "variableNames", // $NON-NLS-1$
            "resultVariable", // $NON-NLS-1$
            "consistencyLevel", // $NON-NLS-1$
            "batchSize" // $NON-NLS-1$
            });

    PropertyDescriptor p = property("sessionName"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("queryArguments"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("variableNames"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("resultVariable"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("batchSize"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");

    p = property("queryType"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, AbstractCassandaTestElement.SIMPLE);
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
            AbstractCassandaTestElement.SIMPLE,
            AbstractCassandaTestElement.PREPARED,
            AbstractCassandaTestElement.DYNAMIC_BATCH
            });

    p = property("consistencyLevel"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "ONE");
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
            AbstractCassandaTestElement.ANY,
            AbstractCassandaTestElement.ONE,
            AbstractCassandaTestElement.QUORUM,
            AbstractCassandaTestElement.TWO,
            AbstractCassandaTestElement.THREE,
            AbstractCassandaTestElement.ALL,
            AbstractCassandaTestElement.LOCAL_ONE,
            AbstractCassandaTestElement.LOCAL_QUORUM,
            AbstractCassandaTestElement.EACH_QUORUM
    });

    p = property("query", TypeEditor.TextAreaEditor); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$
    p.setValue(TEXT_LANGUAGE, "sql");  // $NON-NLS-1$

}
 
Example 20
Source File: TestBeanInfoPriority.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public PropertyDescriptor[] getPropertyDescriptors() {

    PropertyDescriptor[] p = new PropertyDescriptor[2];

    try {

        // value
        PropertyDescriptor pdValue = new PropertyDescriptor(
            "value", TestClass.class, "getValue", "setValue");
        pdValue.setBound(true);
        pdValue.setConstrained(true);
        pdValue.setExpert(true);
        pdValue.setHidden(true);
        pdValue.setPreferred(true);
        pdValue.setValue("required", true);
        pdValue.setValue("visualUpdate", true);
        pdValue.setShortDescription("user-defined-value");
        pdValue.setValue("enumerationValues", new Object[]{
                "EAST", 3, "javax.swing.SwingConstants.EAST",
                "WEST", 7, "javax.swing.SwingConstants.WEST"});
        p[iValue] = pdValue;

        // other
        PropertyDescriptor pdOther = new PropertyDescriptor(
                "other", TestClass.class, "getOther", "setOther");
        pdOther.setBound(false);
        pdOther.setConstrained(false);
        pdOther.setExpert(false);
        pdOther.setHidden(false);
        pdOther.setPreferred(false);
        pdOther.setValue("required", false);
        pdOther.setValue("visualUpdate", false);
        pdOther.setShortDescription("user-defined-other");
        pdOther.setValue("enumerationValues", new Object[]{
                "TOP", 1, "javax.swing.SwingConstants.TOP"});
        p[iOther] = pdOther;

    } catch(IntrospectionException e) {
        e.printStackTrace();
    }

    return p;
}