You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2011/02/16 21:06:29 UTC
svn commit: r1071376 -
/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
Author: mbenson
Date: Wed Feb 16 20:06:28 2011
New Revision: 1071376
URL: http://svn.apache.org/viewvc?rev=1071376&view=rev
Log:
formatting
Modified:
incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java?rev=1071376&r1=1071375&r2=1071376&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java Wed Feb 16 20:06:28 2011
@@ -30,9 +30,8 @@ import java.util.Enumeration;
import static org.apache.bval.model.Features.Property.*;
/**
- * Description: use information from java.beans.Introspector in MetaBeans.
- * The PropertyDescriptor can contain info about HIDDEN, PREFERRED, READONLY
- * and other features<br/>
+ * Description: use information from java.beans.Introspector in MetaBeans. The PropertyDescriptor can contain info about
+ * HIDDEN, PREFERRED, READONLY and other features<br/>
* NOTE: THIS IS AN OPTIONAL CLASS, TO ENABLE IT, SET Factory Property apache.bval.enable-introspector="true"
*/
public final class IntrospectorMetaBeanFactory implements MetaBeanFactory {
@@ -41,12 +40,12 @@ public final class IntrospectorMetaBeanF
* {@inheritDoc}
*/
public void buildMetaBean(MetaBean meta) throws Exception {
- if(meta.getBeanClass() == null) return; // handle only, when local class exists
-
+ if (meta.getBeanClass() == null) {
+ return; // handle only, when local class exists
+ }
BeanInfo info = Introspector.getBeanInfo(meta.getBeanClass());
if (info.getBeanDescriptor() != null) {
- meta.setName(
- info.getBeanDescriptor().getName()); // (display?)name = simple class name!
+ meta.setName(info.getBeanDescriptor().getName()); // (display?)name = simple class name!
}
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) {
@@ -58,6 +57,7 @@ public final class IntrospectorMetaBeanF
/**
* Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}.
+ *
* @param pd
* @return MetaProperty
*/
@@ -65,10 +65,15 @@ public final class IntrospectorMetaBeanF
MetaProperty meta = new MetaProperty();
meta.setName(pd.getName());
meta.setType(determineGenericPropertyType(pd));
- if (pd.isHidden()) meta.putFeature(HIDDEN, Boolean.TRUE);
- if (pd.isPreferred()) meta.putFeature(PREFERRED, Boolean.TRUE);
- if (pd.isConstrained()) meta.putFeature(READONLY, Boolean.TRUE);
-
+ if (pd.isHidden()) {
+ meta.putFeature(HIDDEN, Boolean.TRUE);
+ }
+ if (pd.isPreferred()) {
+ meta.putFeature(PREFERRED, Boolean.TRUE);
+ }
+ if (pd.isConstrained()) {
+ meta.putFeature(READONLY, Boolean.TRUE);
+ }
Enumeration<String> enumeration = pd.attributeNames();
while (enumeration.hasMoreElements()) {
String key = enumeration.nextElement();