/** * Create a new MetaBeanBuilder instance. */ public MetaBeanBuilder() { this(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory() }); }
/** * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}. * * @param pd * @return MetaProperty */ @Deprecated protected MetaProperty buildMetaProperty(PropertyDescriptor pd) { return buildMetaProperty(pd, null); }
/** * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}. * * @param pd * @param existing * @return MetaProperty */ protected MetaProperty buildMetaProperty(PropertyDescriptor pd, MetaProperty existing) { 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); } Enumeration<String> enumeration = pd.attributeNames(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); Object value = pd.getValue(key); meta.putFeature(key, value); } return meta; }
public XMLMetaBeanBuilder() { setFactories(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory(), new XMLMetaBeanFactory() }); }
/** * {@inheritDoc} */ @Override public void buildMetaBean(MetaBean meta) throws Exception { if (meta.getBeanClass() == null) { return; // handle only, when local class exists } BeanInfo info = Introspector.getBeanInfo(meta.getBeanClass()); if (meta.getName() == null && info.getBeanDescriptor() != null) { meta.setName(info.getBeanDescriptor().getName()); // (display?)name = simple class name! } for (PropertyDescriptor pd : info.getPropertyDescriptors()) { if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) { MetaProperty metaProp = buildMetaProperty(pd, meta.getProperty(pd.getName())); meta.putProperty(pd.getName(), metaProp); } } }
if (Boolean.parseBoolean(factory.getProperties().get( ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) { builders.add(new IntrospectorMetaBeanFactory());