Java Code Examples for java.beans.IntrospectionException#printStackTrace()

The following examples show how to use java.beans.IntrospectionException#printStackTrace() . 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: Test4634390.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 2
Source File: Test4634390.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 3
Source File: Test4634390.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 4
Source File: Test4634390.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 5
Source File: ParameterMapping.java    From heisenberg with Apache License 2.0 6 votes vote down vote up
private static PropertyDescriptor[] getDescriptors(Class<?> clazz) {
    PropertyDescriptor[] pds;
    List<PropertyDescriptor> list;
    PropertyDescriptor[] pds2 = descriptors.get(clazz);
    if (null == pds2) {
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
            pds = beanInfo.getPropertyDescriptors();
            list = new ArrayList<PropertyDescriptor>();
            for (int i = 0; i < pds.length; i++) {
                if (null != pds[i].getPropertyType()) {
                    list.add(pds[i]);
                }
            }
            pds2 = new PropertyDescriptor[list.size()];
            list.toArray(pds2);
        } catch (IntrospectionException ie) {
            ie.printStackTrace();
            pds2 = new PropertyDescriptor[0];
        }
    }
    descriptors.put(clazz, pds2);
    return (pds2);
}
 
Example 6
Source File: Test4634390.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 7
Source File: GridViewerSnippet7.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public Mediator(List<?> domainObjects, String propertyName) {
	this.domainObjects = new ArrayList<Object>(domainObjects);
	this.propertyName = propertyName;

	BeanInfo beanInfo;
	try {
		beanInfo = Introspector.getBeanInfo(domainObjects.get(0)
				.getClass());
		PropertyDescriptor[] propertyDescriptors = beanInfo
				.getPropertyDescriptors();

		for (int i = 0; i < propertyDescriptors.length; i++) {
			PropertyDescriptor descriptor = propertyDescriptors[i];
			if (descriptor.getName().equals(propertyName)) {
				this.descriptor = descriptor;
				break;
			}
		}
	} catch (IntrospectionException e) {
		e.printStackTrace();
	}
}
 
Example 8
Source File: Test4634390.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 9
Source File: Test4634390.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
Example 10
Source File: Bean.java    From tds with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
BeanParser(Class<?> beanClass) {

      // get bean info
      BeanInfo info;
      try {
        info = Introspector.getBeanInfo(beanClass, Object.class);
      } catch (IntrospectionException e) {
        e.printStackTrace();
        return;
      }

      if (debugBean)
        System.out.println("Bean " + beanClass.getName());

      // properties must have read and write method
      PropertyDescriptor[] pds = info.getPropertyDescriptors();
      for (PropertyDescriptor pd : pds) {
        if ((pd.getReadMethod() != null) && (pd.getWriteMethod() != null)) {
          properties.put(pd.getName(), pd);
          if (debugBean) {
            System.out.println(" property " + pd.getName());
          }
        }
      }
    }
 
Example 11
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initializes the PropertySheet from the given object. If any, it cancels
 * pending edit before proceeding with properties.
 * 
 * @param data
 */
public void readFromObject(Object data) {
      try {
          // cancel pending edits
          getTable().cancelEditing();

          setBeanInfo(Introspector.getBeanInfo(data.getClass()));
          Property[] properties = model.getProperties();
          for (int i = 0, c = properties.length; i < c; i++) {
            properties[i].readFromObject(data);
          }
          repaint();
      } catch (IntrospectionException ex) {
          ex.printStackTrace();
      }
}
 
Example 12
Source File: Bean.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
BeanParser(Class<?> beanClass) {

      // get bean info
      BeanInfo info;
      try {
        info = Introspector.getBeanInfo(beanClass, Object.class);
      } catch (IntrospectionException e) {
        e.printStackTrace();
        return;
      }

      if (debugBean)
        System.out.println("Bean " + beanClass.getName());

      // properties must have read and write method
      PropertyDescriptor[] pds = info.getPropertyDescriptors();
      for (PropertyDescriptor pd : pds) {
        if ((pd.getReadMethod() != null) && (pd.getWriteMethod() != null)) {
          properties.put(pd.getName(), pd);
          if (debugBean) {
            System.out.println(" property " + pd.getName());
          }
        }
      }
    }
 
Example 13
Source File: AttributeArbitraryDataTypeTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        return new PropertyDescriptor[] {
            new PropertyDescriptor("name", Match.class, "name", null) };
    } catch (IntrospectionException e ) {
        e.printStackTrace();
        return null;
    }
}
 
Example 14
Source File: AttributeArbitraryDataTypeTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        return new PropertyDescriptor[] {
            new PropertyDescriptor("name", Match.class, "name", null) };
    } catch (IntrospectionException e ) {
        e.printStackTrace();
        return null;
    }
}
 
Example 15
Source File: AttributeArbitraryDataTypeTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        return new PropertyDescriptor[] {
            new PropertyDescriptor("name", Match.class, "name", null) };
    } catch (IntrospectionException e ) {
        e.printStackTrace();
        return null;
    }
}
 
Example 16
Source File: AttributeArbitraryDataTypeTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        return new PropertyDescriptor[] {
            new PropertyDescriptor("name", Match.class, "name", null) };
    } catch (IntrospectionException e ) {
        e.printStackTrace();
        return null;
    }
}
 
Example 17
Source File: LanguagesDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    System.out.println("LanguagesDataLoaderBeanInfo.getPropertyDescriptors");
    try {
        PropertyDescriptor[] pds = new PropertyDescriptor[] {
            new PropertyDescriptor ("NBSFiles", LanguagesDataLoader.class, "getNBSFiles", null),
        };
        pds [0].setDisplayName ("GLF Files");
        pds [0].setBound (true);
        pds [0].setPropertyEditorClass (ActionsEditor.class);
        return pds;
    } catch (IntrospectionException ie) {
        ie.printStackTrace();
        return new PropertyDescriptor[0];
    }
}
 
Example 18
Source File: ExtendedPropertyDescriptor.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Force this property to be readonly
 * 
 * @return this property for chaining calls.
 */
public ExtendedPropertyDescriptor setReadOnly() {
  try {
    setWriteMethod(null);
  } catch (IntrospectionException e) {
    e.printStackTrace();
  }
  return this;
}
 
Example 19
Source File: AttributeArbitraryDataTypeTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        return new PropertyDescriptor[] {
            new PropertyDescriptor("name", Match.class, "name", null) };
    } catch (IntrospectionException e ) {
        e.printStackTrace();
        return null;
    }
}
 
Example 20
Source File: Grib2CollectionPanel.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
PdsBeanInfo(Grib2Pds pds) {
  ArrayList<PropertyDescriptor> props = new ArrayList<>(40);

  Class cl = Grib2RecordBean.class;
  try {
    props.add(new PropertyDescriptor("startPos", cl, "getStartPos", null));
    props.add(new PropertyDescriptor("file", cl, "getFile", null));
    props.add(new PropertyDescriptor("forecastDate", cl, "getForecastDate", null));
    props.add(new PropertyDescriptor("forecastTime", cl, "getForecastTime", null));
    props.add(new PropertyDescriptor("processType", cl, "getGenProcessType", null));
    props.add(new PropertyDescriptor("header", cl, "getHeader", null));
    props.add(new PropertyDescriptor("level", cl, "getLevel", null));
    props.add(new PropertyDescriptor("refDate", cl, "getRefDate", null));
    props.add(new PropertyDescriptor("timeUnit", cl, "getTimeUnit", null));

    if (pds instanceof Grib2Pds.PdsAerosol) {
      props.add(new PropertyDescriptor("aerIntSizeType", cl, "getAerIntSizeType", null));
      props.add(new PropertyDescriptor("aerIntWavelType", cl, "getAerIntWavelType", null));
      props.add(new PropertyDescriptor("aerSize1", cl, "getAerSize1", null));
      props.add(new PropertyDescriptor("aerSize2", cl, "getAerSize2", null));
      props.add(new PropertyDescriptor("aerType", cl, "getAerType", null));
      props.add(new PropertyDescriptor("aerWavel1", cl, "getAerWavel1", null));
      props.add(new PropertyDescriptor("aerWavel2", cl, "getAerWavel2", null));
    }

    if (pds instanceof Grib2Pds.PdsEnsemble) {
      props.add(new PropertyDescriptor("pertN", cl, "getPertN", null));
      props.add(new PropertyDescriptor("pertType", cl, "getPertType", null));
      props.add(new PropertyDescriptor("nForecastsInEns", cl, "getNForecastsInEns", null));
    }

    if (pds instanceof Grib2Pds.PdsInterval) {
      props.add(new PropertyDescriptor("intv", cl, "getIntv", null));
      props.add(new PropertyDescriptor("intv2", cl, "getIntv2", null));
      props.add(new PropertyDescriptor("intvHash", cl, "getIntvHash", null));
    }

    if (pds instanceof Grib2Pds.PdsProbability) {
      props.add(new PropertyDescriptor("probLimits", cl, "getProbLimits", null));
    }

    if (pds instanceof Grib2Pds.PdsSatellite) {
      props.add(new PropertyDescriptor("numSatBands", cl, "getNumSatelliteBands", null));
      props.add(new PropertyDescriptor("satBands", cl, "getSatelliteBands", null));
    }

  } catch (IntrospectionException e) {
    e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
  }

  properties = new PropertyDescriptor[props.size()];
  props.toArray(properties);
}