Example usage for java.beans IntrospectionException getMessage

List of usage examples for java.beans IntrospectionException getMessage

Introduction

In this page you can find the example usage for java.beans IntrospectionException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.thecoderscorner.groovychart.chart.BaseChart.java

/**
 * Creates a new instance of BaseChart/*w  w w .j a  v  a2 s.  c o  m*/
 */
protected BaseChart() {
    try {
        setBeanClass(this.getClass());
        bb.setBeanClass(JFreeChart.class);
    } catch (IntrospectionException ex) {
        logger.log(Level.WARNING, ex.getMessage(), ex);
    }
}

From source file:no.sesat.search.datamodel.DataModelFactoryImplTest.java

/**  **/
@Test/*from  w  w  w. j a  v a 2  s .co  m*/
public void testInstantiateDataObjects() throws Exception {

    LOG.info("testInstantiateDataObjects()");
    scan(DataObject.class, DataModel.class, new Command() {
        public void execute(Object... args) {
            try {
                final Class<?> cls = (Class<?>) args[0];
                testInstantiate(cls);
            } catch (IntrospectionException ie) {
                LOG.info(ie.getMessage(), ie);
                throw new RuntimeException(ie.getMessage(), ie);
            }
        }
    });
}

From source file:no.sesat.search.datamodel.DataModelFactoryImplTest.java

/**
 *
 * @throws java.lang.Exception/*  w  w w  .  j  a  v a2s  . c om*/
 */
@Test
public void testInstantiateDataNodes() throws Exception {

    LOG.info("testInstantiateDataNodes()");
    scan(DataNode.class, DataModel.class, new Command() {
        public void execute(Object... args) {
            try {
                final Class<?> cls = (Class<?>) args[0];
                testInstantiate(cls);
            } catch (IntrospectionException ie) {
                LOG.info(ie.getMessage(), ie);
                throw new RuntimeException(ie.getMessage(), ie);
            }
        }
    });
}

From source file:com.manydesigns.elements.reflection.JavaClassAccessor.java

protected List<PropertyAccessor> setupPropertyAccessors() {
    List<PropertyAccessor> accessorList = new ArrayList<PropertyAccessor>();

    // handle properties through introspection
    try {//ww w. ja  v a2  s .  c  om
        BeanInfo beanInfo = Introspector.getBeanInfo(javaClass);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor current : propertyDescriptors) {
            accessorList.add(new JavaPropertyAccessor(current));
        }
    } catch (IntrospectionException e) {
        logger.error(e.getMessage(), e);
    }

    // handle public fields
    for (Field field : javaClass.getFields()) {
        if (isPropertyPresent(accessorList, field.getName())) {
            continue;
        }
        accessorList.add(new JavaFieldAccessor(field));
    }

    return accessorList;
}

From source file:no.sesat.search.datamodel.DataModelFactoryImplTest.java

/**
 *
 * @throws java.lang.Exception/*from w  w  w .j  ava2 s.c  o  m*/
 */
@Test
public void testDataObjectGetters() throws Exception {

    LOG.info("testDataObjectGetters()");
    scan(DataObject.class, DataModel.class, new Command() {
        public void execute(Object... args) {

            try {
                final Class<?> cls = (Class<?>) args[0];
                final Object dataObject = testInstantiate(cls);

                final PropertyDescriptor[] properties = Introspector.getBeanInfo(cls).getPropertyDescriptors();
                for (PropertyDescriptor property : properties) {
                    if (null != property.getReadMethod()) {
                        final Object value = invoke(property.getReadMethod(), dataObject, new Object[0]);
                        LOG.info("        Getter on " + property.getName() + " returned " + value);
                    }
                    if (property instanceof MappedPropertyDescriptor) {
                        final MappedPropertyDescriptor mappedProperty = (MappedPropertyDescriptor) property;
                        if (null != mappedProperty.getReadMethod()) {
                            final Object value = invoke(mappedProperty.getMappedReadMethod(), dataObject, "");
                            LOG.info("        Getter on " + mappedProperty.getName() + " returned " + value);
                        }
                    }
                }
            } catch (IntrospectionException ie) {
                LOG.info(ie.getMessage(), ie);
                throw new RuntimeException(ie.getMessage(), ie);
            }
        }
    });
}

From source file:org.displaytag.tags.CaptionTagBeanInfo.java

/**
 * @see java.beans.BeanInfo#getPropertyDescriptors()
 *///  ww  w  . java  2s .c  o m
public PropertyDescriptor[] getPropertyDescriptors() {
    List proplist = new ArrayList();

    try {
        proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
                CaptionTag.class, null, "setClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("dir", //$NON-NLS-1$
                CaptionTag.class, null, "setDir")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("id", //$NON-NLS-1$
                CaptionTag.class, null, "setId")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("lang", //$NON-NLS-1$
                CaptionTag.class, null, "setLang")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("media", //$NON-NLS-1$
                CaptionTag.class, null, "setMedia")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
                CaptionTag.class, null, "setStyle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("title", //$NON-NLS-1$
                CaptionTag.class, null, "setTitle")); //$NON-NLS-1$

        // make ATG Dynamo happy:
        // Attribute "className" of tag "caption" in taglib descriptor file displaytag-11.tld" must have a
        // corresponding property in class "org.displaytag.tags.CaptionTag" with a public setter method
        proplist.add(new PropertyDescriptor("className", //$NON-NLS-1$
                CaptionTag.class, null, "setClass")); //$NON-NLS-1$
    } catch (IntrospectionException ex) {
        throw new UnhandledException(
                "You got an introspection exception - maybe defining a property that is not"
                        + " defined in the CaptionTag?: " + ex.getMessage(),
                ex);
    }

    PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
    return ((PropertyDescriptor[]) proplist.toArray(result));
}

From source file:org.apache.struts2.views.xslt.BeanAdapter.java

/**
 * Caching facade method to Introspector.getBeanInfo(Class, Class).getPropertyDescriptors();
 *///from ww w  .j av a 2 s .c o  m
private synchronized PropertyDescriptor[] getPropertyDescriptors(Object bean) {
    try {
        if (propertyDescriptorCache == null) {
            propertyDescriptorCache = new HashMap<Class, PropertyDescriptor[]>();
        }

        PropertyDescriptor[] props = propertyDescriptorCache.get(bean.getClass());

        if (props == null) {
            log.debug("Caching property descriptor for " + bean.getClass().getName());
            props = Introspector.getBeanInfo(bean.getClass(), Object.class).getPropertyDescriptors();
            propertyDescriptorCache.put(bean.getClass(), props);
        }

        return props;
    } catch (IntrospectionException e) {
        e.printStackTrace();
        throw new StrutsException("Error getting property descriptors for " + bean + " : " + e.getMessage());
    }
}

From source file:org.apache.jcs.config.PropertySetter.java

/**
 * Uses JavaBeans {@link Introspector}to computer setters of object to be
 * configured.//from w  w w. ja  v a  2s.  c  o  m
 */
protected void introspect() {
    try {
        BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
        props = bi.getPropertyDescriptors();
    } catch (IntrospectionException ex) {
        log.error("Failed to introspect " + obj + ": " + ex.getMessage());
        props = new PropertyDescriptor[0];
    }
}

From source file:org.displaytag.tags.el.ELColumnTagBeanInfo.java

/**
 * @see java.beans.BeanInfo#getPropertyDescriptors()
 *//*ww  w. ja va  2 s  . c  o m*/
public PropertyDescriptor[] getPropertyDescriptors() {
    List proplist = new ArrayList();

    try {
        proplist.add(new PropertyDescriptor("autolink", //$NON-NLS-1$
                ELColumnTag.class, null, "setAutolink")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("escapeXml", //$NON-NLS-1$
                ELColumnTag.class, null, "setEscapeXml")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
                ELColumnTag.class, null, "setClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("decorator", //$NON-NLS-1$
                ELColumnTag.class, null, "setDecorator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("group", //$NON-NLS-1$
                ELColumnTag.class, null, "setGroup")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("headerClass", //$NON-NLS-1$
                ELColumnTag.class, null, "setHeaderClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("href", //$NON-NLS-1$
                ELColumnTag.class, null, "setHref")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("maxLength", //$NON-NLS-1$
                ELColumnTag.class, null, "setMaxLength")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("maxWords", //$NON-NLS-1$
                ELColumnTag.class, null, "setMaxWords")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("media", //$NON-NLS-1$
                ELColumnTag.class, null, "setMedia")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("nulls", //$NON-NLS-1$
                ELColumnTag.class, null, "setNulls")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramId", //$NON-NLS-1$
                ELColumnTag.class, null, "setParamId")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramName", //$NON-NLS-1$
                ELColumnTag.class, null, "setParamName")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramProperty", //$NON-NLS-1$
                ELColumnTag.class, null, "setParamProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("paramScope", //$NON-NLS-1$
                ELColumnTag.class, null, "setParamScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("property", //$NON-NLS-1$
                ELColumnTag.class, null, "setProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortable", //$NON-NLS-1$
                ELColumnTag.class, null, "setSortable")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortName", //$NON-NLS-1$
                ELColumnTag.class, null, "setSortName")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
                ELColumnTag.class, null, "setStyle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("total", //$NON-NLS-1$
                ELColumnTag.class, null, "setTotal")); // map //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("title", //$NON-NLS-1$
                ELColumnTag.class, null, "setTitle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("titleKey", //$NON-NLS-1$
                ELColumnTag.class, null, "setTitleKey")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("url", //$NON-NLS-1$
                ELColumnTag.class, null, "setUrl")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sortProperty", //$NON-NLS-1$
                ELColumnTag.class, null, "setSortProperty")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("comparator", //$NON-NLS-1$
                ELColumnTag.class, null, "setComparator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultorder", //$NON-NLS-1$
                ELColumnTag.class, null, "setDefaultorder")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("headerScope", //$NON-NLS-1$
                ELColumnTag.class, null, "setHeaderScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("scope", //$NON-NLS-1$
                ELColumnTag.class, null, "setScope")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("format", //$NON-NLS-1$
                ELColumnTag.class, null, "setFormat")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("value", //$NON-NLS-1$
                ELColumnTag.class, null, "setValue")); //$NON-NLS-1$

    } catch (IntrospectionException ex) {
        throw new UnhandledException(
                "You got an introspection exception - maybe defining a property that is not"
                        + " defined in the bean?: " + ex.getMessage(),
                ex);
    }

    PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
    return ((PropertyDescriptor[]) proplist.toArray(result));
}

From source file:org.displaytag.tags.el.ELTableTagBeanInfo.java

/**
 * @see java.beans.BeanInfo#getPropertyDescriptors()
 *//*from  ww  w  .  ja va 2s .c o  m*/
public PropertyDescriptor[] getPropertyDescriptors() {
    List proplist = new ArrayList();

    try {
        proplist.add(new PropertyDescriptor("cellpadding", //$NON-NLS-1$
                ELTableTag.class, null, "setCellpadding")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("cellspacing", //$NON-NLS-1$
                ELTableTag.class, null, "setCellspacing")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
                ELTableTag.class, null, "setClass")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("decorator", //$NON-NLS-1$
                ELTableTag.class, null, "setDecorator")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultorder", //$NON-NLS-1$
                ELTableTag.class, null, "setDefaultorder")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("defaultsort", //$NON-NLS-1$
                ELTableTag.class, null, "setDefaultsort")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("export", //$NON-NLS-1$
                ELTableTag.class, null, "setExport")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("frame", //$NON-NLS-1$
                ELTableTag.class, null, "setFrame")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("length", //$NON-NLS-1$
                ELTableTag.class, null, "setLength")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("name", //$NON-NLS-1$
                ELTableTag.class, null, "setName")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("offset", //$NON-NLS-1$
                ELTableTag.class, null, "setOffset")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("pagesize", //$NON-NLS-1$
                ELTableTag.class, null, "setPagesize")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("partialList", //$NON-NLS-1$
                ELTableTag.class, null, "setPartialList")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("requestURI", //$NON-NLS-1$
                ELTableTag.class, null, "setRequestURI")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("requestURIcontext", //$NON-NLS-1$
                ELTableTag.class, null, "setRequestURIcontext")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("rules", //$NON-NLS-1$
                ELTableTag.class, null, "setRules")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("size", //$NON-NLS-1$
                ELTableTag.class, null, "setSize")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("sort", //$NON-NLS-1$
                ELTableTag.class, null, "setSort")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
                ELTableTag.class, null, "setStyle")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("summary", //$NON-NLS-1$
                ELTableTag.class, null, "setSummary")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("excludedParams", //$NON-NLS-1$
                ELTableTag.class, null, "setExcludedParams")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("id", //$NON-NLS-1$
                ELTableTag.class, null, "setUid")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("keepStatus", //$NON-NLS-1$
                ELTableTag.class, null, "setKeepStatus")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("clearStatus", //$NON-NLS-1$
                ELTableTag.class, null, "setClearStatus")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("form", //$NON-NLS-1$
                ELTableTag.class, null, "setForm")); //$NON-NLS-1$

        proplist.add(new PropertyDescriptor("uid", //$NON-NLS-1$
                ELTableTag.class, null, "setUid")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("htmlId", //$NON-NLS-1$
                ELTableTag.class, null, "setHtmlId")); //$NON-NLS-1$
        proplist.add(new PropertyDescriptor("varTotals", //$NON-NLS-1$
                TableTag.class, null, "setVarTotals")); //$NON-NLS-1$

    } catch (IntrospectionException ex) {
        throw new UnhandledException(
                "You got an introspection exception - maybe defining a property that is not"
                        + " defined in the ElTableTag?: " + ex.getMessage(),
                ex);
    }

    PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
    return ((PropertyDescriptor[]) proplist.toArray(result));
}