Java Code Examples for java.beans.FeatureDescriptor#setHidden()

The following examples show how to use java.beans.FeatureDescriptor#setHidden() . 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: ResourceBundleELResolver.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is a ResourceBundle, returns an Iterator containing the set of keys
 * available in the ResourceBundle. Otherwise, returns null. The Iterator returned must contain
 * zero or more instances of java.beans.FeatureDescriptor. Each info object contains information
 * about a key in the ResourceBundle, and is initialized as follows:
 * <ul>
 * <li>displayName - The String key name</li>
 * <li>name - Same as displayName property</li>
 * <li>shortDescription - Empty string</li>
 * <li>expert - false</li>
 * <li>hidden - false</li>
 * <li>preferred - true</li>
 * </ul>
 * In addition, the following named attributes must be set in the returned FeatureDescriptors:
 * <ul>
 * <li>{@link ELResolver#TYPE} - String.class.</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bundle to analyze. Only bases of type ResourceBundle are handled by this
 *            resolver.
 * @return An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor
 *         objects, each representing a key in this bundle, or null if the base object is not a
 *         ResourceBundle.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		final Enumeration<String> keys = ((ResourceBundle) base).getKeys();
		return new Iterator<FeatureDescriptor>() {
               @Override
			public boolean hasNext() {
				return keys.hasMoreElements();
			}
               @Override
			public FeatureDescriptor next() {
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(keys.nextElement());
				feature.setName(feature.getDisplayName());
				feature.setShortDescription("");
				feature.setExpert(true);
				feature.setHidden(false);
				feature.setPreferred(true);
				feature.setValue(TYPE, String.class);
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
			}
               @Override
			public void remove() {
				throw new UnsupportedOperationException("Cannot remove");
				
			}
		};
	}
	return null;
}
 
Example 2
Source File: JsonNodeELResolver.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is not null, returns an Iterator containing the set of JavaBeans
 * properties available on the given object. Otherwise, returns null. The Iterator returned must
 * contain zero or more instances of java.beans.FeatureDescriptor. Each info object contains
 * information about a property in the bean, as obtained by calling the
 * BeanInfo.getPropertyDescriptors method. The FeatureDescriptor is initialized using the same
 * fields as are present in the PropertyDescriptor, with the additional required named
 * attributes "type" and "resolvableAtDesignTime" set as follows:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
 * PropertyDescriptor.getPropertyType().</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bean to analyze.
 * @return An Iterator containing zero or more FeatureDescriptor objects, each representing a
 *         property on this bean, or null if the base object is null.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
  if (isResolvable(base)) {
    JsonNode node = (JsonNode) base;
    final Iterator<String> keys = node.fieldNames();
    return new Iterator<FeatureDescriptor>() {
      public boolean hasNext() {
        return keys.hasNext();
      }
      public FeatureDescriptor next() {
        Object key = keys.next();
        FeatureDescriptor feature = new FeatureDescriptor();
        feature.setDisplayName(key == null ? "null" : key.toString());
        feature.setName(feature.getDisplayName());
        feature.setShortDescription("");
        feature.setExpert(true);
        feature.setHidden(false);
        feature.setPreferred(true);
        feature.setValue(TYPE, key == null ? "null" : key.getClass());
        feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
        return feature;
        
      }
      public void remove() {
        throw new UnsupportedOperationException("cannot remove");
      }
    };
  }
  return null;
}
 
Example 3
Source File: MapELResolver.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is a map, returns an Iterator containing the set of keys available in the
 * Map. Otherwise, returns null. The Iterator returned must contain zero or more instances of
 * java.beans.FeatureDescriptor. Each info object contains information about a key in the Map,
 * and is initialized as follows:
 * <ul>
 * <li>displayName - The return value of calling the toString method on this key, or "null" if
 * the key is null</li>
 * <li>name - Same as displayName property</li>
 * <li>shortDescription - Empty string</li>
 * <li>expert - false</li>
 * <li>hidden - false</li>
 * <li>preferred - true</li>
 * </ul>
 * In addition, the following named attributes must be set in the returned FeatureDescriptors:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The return value of calling the getClass() method on this key,
 * or null if the key is null.</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The map to analyze. Only bases of type Map are handled by this resolver.
 * @return An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor
 *         objects, each representing a key in this map, or null if the base object is not a
 *         map.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		Map<?, ?> map = (Map<?, ?>) base;
		final Iterator<?> keys = map.keySet().iterator();
		return new Iterator<FeatureDescriptor>() {
			public boolean hasNext() {
				return keys.hasNext();
			}
			public FeatureDescriptor next() {
				Object key = keys.next();
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(key == null ? "null" : key.toString());
				feature.setName(feature.getDisplayName());
				feature.setShortDescription("");
				feature.setExpert(true);
				feature.setHidden(false);
				feature.setPreferred(true);
				feature.setValue(TYPE, key == null ? "null" : key.getClass());
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
				
			}
			public void remove() {
				throw new UnsupportedOperationException("cannot remove");
			}
		};
	}
	return null;
}
 
Example 4
Source File: ResourceBundleELResolver.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is a ResourceBundle, returns an Iterator containing the set of keys
 * available in the ResourceBundle. Otherwise, returns null. The Iterator returned must contain
 * zero or more instances of java.beans.FeatureDescriptor. Each info object contains information
 * about a key in the ResourceBundle, and is initialized as follows:
 * <ul>
 * <li>displayName - The String key name</li>
 * <li>name - Same as displayName property</li>
 * <li>shortDescription - Empty string</li>
 * <li>expert - false</li>
 * <li>hidden - false</li>
 * <li>preferred - true</li>
 * </ul>
 * In addition, the following named attributes must be set in the returned FeatureDescriptors:
 * <ul>
 * <li>{@link ELResolver#TYPE} - String.class.</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bundle to analyze. Only bases of type ResourceBundle are handled by this
 *            resolver.
 * @return An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor
 *         objects, each representing a key in this bundle, or null if the base object is not a
 *         ResourceBundle.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		final Enumeration<String> keys = ((ResourceBundle) base).getKeys();
		return new Iterator<FeatureDescriptor>() {
			public boolean hasNext() {
				return keys.hasMoreElements();
			}
			public FeatureDescriptor next() {
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(keys.nextElement());
				feature.setName(feature.getDisplayName());
				feature.setShortDescription("");
				feature.setExpert(true);
				feature.setHidden(false);
				feature.setPreferred(true);
				feature.setValue(TYPE, String.class);
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
			}
			public void remove() {
				throw new UnsupportedOperationException("Cannot remove");
				
			}
		};
	}
	return null;
}
 
Example 5
Source File: MapELResolver.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is a map, returns an Iterator containing the set of keys available in the
 * Map. Otherwise, returns null. The Iterator returned must contain zero or more instances of
 * java.beans.FeatureDescriptor. Each info object contains information about a key in the Map,
 * and is initialized as follows:
 * <ul>
 * <li>displayName - The return value of calling the toString method on this key, or "null" if
 * the key is null</li>
 * <li>name - Same as displayName property</li>
 * <li>shortDescription - Empty string</li>
 * <li>expert - false</li>
 * <li>hidden - false</li>
 * <li>preferred - true</li>
 * </ul>
 * In addition, the following named attributes must be set in the returned FeatureDescriptors:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The return value of calling the getClass() method on this key,
 * or null if the key is null.</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The map to analyze. Only bases of type Map are handled by this resolver.
 * @return An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor
 *         objects, each representing a key in this map, or null if the base object is not a
 *         map.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		Map<?, ?> map = (Map<?, ?>) base;
		final Iterator<?> keys = map.keySet().iterator();
		return new Iterator<FeatureDescriptor>() {
			public boolean hasNext() {
				return keys.hasNext();
			}
			public FeatureDescriptor next() {
				Object key = keys.next();
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(key == null ? "null" : key.toString());
				feature.setName(feature.getDisplayName());
				feature.setShortDescription("");
				feature.setExpert(true);
				feature.setHidden(false);
				feature.setPreferred(true);
				feature.setValue(TYPE, key == null ? null : key.getClass());
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
				
			}
			public void remove() {
				throw new UnsupportedOperationException("cannot remove");
			}
		};
	}
	return null;
}
 
Example 6
Source File: JsonNodeELResolver.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is not null, returns an Iterator containing the set of JavaBeans
 * properties available on the given object. Otherwise, returns null. The Iterator returned must
 * contain zero or more instances of java.beans.FeatureDescriptor. Each info object contains
 * information about a property in the bean, as obtained by calling the
 * BeanInfo.getPropertyDescriptors method. The FeatureDescriptor is initialized using the same
 * fields as are present in the PropertyDescriptor, with the additional required named
 * attributes "type" and "resolvableAtDesignTime" set as follows:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
 * PropertyDescriptor.getPropertyType().</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bean to analyze.
 * @return An Iterator containing zero or more FeatureDescriptor objects, each representing a
 *         property on this bean, or null if the base object is null.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
  if (isResolvable(base)) {
    JsonNode node = (JsonNode) base;
    final Iterator<String> keys = node.fieldNames();
    return new Iterator<FeatureDescriptor>() {
      public boolean hasNext() {
        return keys.hasNext();
      }
      public FeatureDescriptor next() {
        Object key = keys.next();
        FeatureDescriptor feature = new FeatureDescriptor();
        feature.setDisplayName(key == null ? "null" : key.toString());
        feature.setName(feature.getDisplayName());
        feature.setShortDescription("");
        feature.setExpert(true);
        feature.setHidden(false);
        feature.setPreferred(true);
        feature.setValue(TYPE, key == null ? "null" : key.getClass());
        feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
        return feature;
        
      }
      public void remove() {
        throw new UnsupportedOperationException("cannot remove");
      }
    };
  }
  return null;
}
 
Example 7
Source File: BeanELResolver.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * If the base object is not null, returns an Iterator containing the set of JavaBeans
 * properties available on the given object. Otherwise, returns null. The Iterator returned must
 * contain zero or more instances of java.beans.FeatureDescriptor. Each info object contains
 * information about a property in the bean, as obtained by calling the
 * BeanInfo.getPropertyDescriptors method. The FeatureDescriptor is initialized using the same
 * fields as are present in the PropertyDescriptor, with the additional required named
 * attributes "type" and "resolvableAtDesignTime" set as follows:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
 * PropertyDescriptor.getPropertyType().</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bean to analyze.
 * @return An Iterator containing zero or more FeatureDescriptor objects, each representing a
 *         property on this bean, or null if the base object is null.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		final PropertyDescriptor[] properties;
		try {
			properties = Introspector.getBeanInfo(base.getClass()).getPropertyDescriptors();
		} catch (IntrospectionException e) {
			return Collections.<FeatureDescriptor> emptyList().iterator();
		}
		return new Iterator<FeatureDescriptor>() {
			int next = 0;

			public boolean hasNext() {
				return properties != null && next < properties.length;
			}

			public FeatureDescriptor next() {
				PropertyDescriptor property = properties[next++];
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(property.getDisplayName());
				feature.setName(property.getName());
				feature.setShortDescription(property.getShortDescription());
				feature.setExpert(property.isExpert());
				feature.setHidden(property.isHidden());
				feature.setPreferred(property.isPreferred());
				feature.setValue(TYPE, property.getPropertyType());
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
			}

			public void remove() {
				throw new UnsupportedOperationException("cannot remove");
			}
		};
	}
	return null;
}
 
Example 8
Source File: Test4498236.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 9
Source File: BeanELResolver.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
/**
 * If the base object is not null, returns an Iterator containing the set of JavaBeans
 * properties available on the given object. Otherwise, returns null. The Iterator returned must
 * contain zero or more instances of java.beans.FeatureDescriptor. Each info object contains
 * information about a property in the bean, as obtained by calling the
 * BeanInfo.getPropertyDescriptors method. The FeatureDescriptor is initialized using the same
 * fields as are present in the PropertyDescriptor, with the additional required named
 * attributes "type" and "resolvableAtDesignTime" set as follows:
 * <ul>
 * <li>{@link ELResolver#TYPE} - The runtime type of the property, from
 * PropertyDescriptor.getPropertyType().</li>
 * <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.</li>
 * </ul>
 * 
 * @param context
 *            The context of this evaluation.
 * @param base
 *            The bean to analyze.
 * @return An Iterator containing zero or more FeatureDescriptor objects, each representing a
 *         property on this bean, or null if the base object is null.
 */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (isResolvable(base)) {
		final PropertyDescriptor[] properties;
		try {
			properties = Introspector.getBeanInfo(base.getClass()).getPropertyDescriptors();
		} catch (IntrospectionException e) {
			return Collections.<FeatureDescriptor> emptyList().iterator();
		}
		return new Iterator<FeatureDescriptor>() {
			int next = 0;

               @Override
			public boolean hasNext() {
				return properties != null && next < properties.length;
			}

               @Override
			public FeatureDescriptor next() {
				PropertyDescriptor property = properties[next++];
				FeatureDescriptor feature = new FeatureDescriptor();
				feature.setDisplayName(property.getDisplayName());
				feature.setName(property.getName());
				feature.setShortDescription(property.getShortDescription());
				feature.setExpert(property.isExpert());
				feature.setHidden(property.isHidden());
				feature.setPreferred(property.isPreferred());
				feature.setValue(TYPE, property.getPropertyType());
				feature.setValue(RESOLVABLE_AT_DESIGN_TIME, true);
				return feature;
			}

               @Override
			public void remove() {
				throw new UnsupportedOperationException("cannot remove");
			}
		};
	}
	return null;
}
 
Example 10
Source File: Test4498236.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 11
Source File: Test4498236.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 12
Source File: Test4498236.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 13
Source File: Test4498236.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 14
Source File: Test4498236.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 15
Source File: Test4498236.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 16
Source File: Test4498236.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 17
Source File: GrammarQueryManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public FeatureDescriptor getDescriptor() {
    FeatureDescriptor desc = new FeatureDescriptor();
    desc.setHidden(true);
    desc.setName(getClass().getName());
    return desc;            
}
 
Example 18
Source File: Test4498236.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 19
Source File: Test4498236.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}
 
Example 20
Source File: Test4498236.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
         new PropertyChangeEvent("source", "name", "old", "new")
    );
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
         new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
    );
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]",
         new BeanDescriptor(String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
         new BeanDescriptor(Object.class, String.class)
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class))
    );
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
         new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
                 new ParameterDescriptor()
         })
    );
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "key", type, names[0])
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
    );
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
         new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
    );
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("value", Test4498236.class)
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", Test4498236.class, null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
    );
    test("[name=$$$]",
         new PropertyDescriptor("$$$", null, null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
    );
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
         new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
    );
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("index", Test4498236.class)
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
    );
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
         new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
    );
}