r2308 - trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans
Author: tchemit Date: 2011-09-23 13:49:08 +0200 (Fri, 23 Sep 2011) New Revision: 2308 Url: http://nuiton.org/repositories/revision/jaxx/2308 Log: clean code Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java =================================================================== --- trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java 2011-09-23 11:26:38 UTC (rev 2307) +++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java 2011-09-23 11:49:08 UTC (rev 2308) @@ -31,7 +31,6 @@ import java.beans.BeanDescriptor; import java.beans.BeanInfo; -import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyChangeListener; import java.beans.PropertyDescriptor; @@ -67,9 +66,8 @@ * * @param classDescriptor the class to introspect * @return the <code>JAXXBeanInfo</code> for the bean class - * @throws IntrospectionException if an error occurs */ - public static JAXXBeanInfo getJAXXBeanInfo(ClassDescriptor classDescriptor) throws IntrospectionException { + public static JAXXBeanInfo getJAXXBeanInfo(ClassDescriptor classDescriptor) { JAXXIntrospector introspector = new JAXXIntrospector(classDescriptor); return introspector.createBeanInfo(); } @@ -88,7 +86,7 @@ if (explicitBeanInfo != null) { PropertyDescriptor[] explicitProperties = explicitBeanInfo.getPropertyDescriptors(); for (PropertyDescriptor explicitProperty : explicitProperties) { - Class type = explicitProperty.getPropertyType(); + Class<?> type = explicitProperty.getPropertyType(); Method readMethod = explicitProperty.getReadMethod(); Method writeMethod = explicitProperty.getWriteMethod(); try { @@ -158,9 +156,10 @@ if (explicitBeanInfo != null) { BeanDescriptor explicitBeanDescriptor = explicitBeanInfo.getBeanDescriptor(); if (explicitBeanDescriptor != null) { - Enumeration/*<String>*/ attributeNames = explicitBeanDescriptor.attributeNames(); + Enumeration<String> attributeNames = + explicitBeanDescriptor.attributeNames(); while (attributeNames.hasMoreElements()) { - String name = (String) attributeNames.nextElement(); + String name = attributeNames.nextElement(); beanDescriptor.setValue(name, explicitBeanDescriptor.getValue(name)); } } @@ -173,7 +172,7 @@ private static BeanInfo getExplicitBeanInfo(ClassDescriptor classDescriptor) { try { - Class beanClass = Class.forName(classDescriptor.getName(), true, classDescriptor.getClassLoader()); // see if there is a class by that name in this package + Class<?> beanClass = Class.forName(classDescriptor.getName(), true, classDescriptor.getClassLoader()); // see if there is a class by that name in this package Method findExplicitBeanInfo = Introspector.class.getDeclaredMethod("findExplicitBeanInfo", new Class[]{Class.class}); findExplicitBeanInfo.setAccessible(true); return (BeanInfo) findExplicitBeanInfo.invoke(null, beanClass);
participants (1)
-
tchemit@users.nuiton.org