@Override public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception { enrichMetaBean(metaBean, new XMLResult(xmlMeta, xmlInfos)); }
public void addLoader(XMLMetaBeanLoader loader) { assertXmlFactory(); xmlFactory.addLoader(loader); }
private MetaBean createMetaBean(XMLMetaBean xmlMeta) throws Exception { return buildForClass(findLocalClass(xmlMeta.getImpl())); }
@Override public void mergeInto(MetaProperty prop) throws ClassNotFoundException { super.mergeInto(prop); // call super! if (getMaxValue() != null) { prop.putFeature(MAX_VALUE, getMaxValue()); } if (getMinValue() != null) { prop.putFeature(MIN_VALUE, getMinValue()); } if (getRegexp() != null) { prop.putFeature(REG_EXP, getRegexp()); } if (getTimeLag() != null) { prop.putFeature(TIME_LAG, getTimeLag()); } } }
@Override public void visit(XMLMetaBean empty, XMLMetaBeanInfos xmlInfos) throws Exception { if (xmlInfos.getBeans() == null) return; // empty file, ignore XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult(null, xmlInfos); for (XMLMetaBean xmlMeta : xmlInfos.getBeans()) { MetaBean meta = all.get(xmlMeta.getId()); if (meta == null) { meta = createMetaBean(xmlMeta); all.put(xmlMeta.getId(), meta); } carrier.xmlMeta = xmlMeta; xmlFactory.enrichMetaBean(meta, carrier); } }
public void putBeanRef(XMLMetaBeanReference beanRelation) { if (beanRelation.getName() != null) { XMLMetaBeanReference relation = findBeanRef(beanRelation.getName()); if (relation != null) { beanRelations.remove(relation); } } addBeanRef(beanRelation); }
public void putProperty(XMLMetaProperty property) { if (property.getName() != null) { XMLMetaProperty prop = findProperty(property.getName()); if (prop != null) { properties.remove(prop); } } addProperty(property); }
public void mergeFeaturesInto(FeaturesCapable fc) { if (getFeatures() != null) { for (XMLMetaFeature each : getFeatures()) { fc.putFeature(each.getKey(), each.getValue()); } } } }
public void putFeature(String key, Object value) { XMLMetaFeature anno = findFeature(key); if (features == null) features = new ArrayList<XMLMetaFeature>(); if (anno == null) { features.add(new XMLMetaFeature(key, value)); } else { anno.setValue(value); } }
/** * Create the {@link MetaBeanManager} to process JSR303 XML. Requires * bval-xstream at RT. * * @param builders * @return {@link MetaBeanManager} */ // NOTE - We return MetaBeanManager instead of XMLMetaBeanManager to // keep // bval-xstream an optional module. protected static MetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory> builders) { return new XMLMetaBeanManager( new XMLMetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()]))); } }
public XMLMetaBeanBuilder() { setFactories(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory(), new XMLMetaBeanFactory() }); }
protected MetaProperty enrichElement(MetaBean meta, XMLMetaElement xmlProp, XMLResult result) throws Exception { MetaProperty prop = meta.getProperty(xmlProp.getName()); if (prop == null) { prop = new MetaProperty(); prop.setName(xmlProp.getName()); meta.putProperty(xmlProp.getName(), prop); } xmlProp.mergeInto(prop); enrichValidations(prop, xmlProp, result, true); return prop; }
public Object getFeature(String key) { XMLMetaFeature anno = findFeature(key); return anno == null ? null : anno.getValue(); }
public XMLMetaBeanManager() { this(new XMLMetaBeanBuilder()); }
private void updateXmlFactory() { for (MetaBeanFactory each : getFactories()) { if (each instanceof XMLMetaBeanFactory) { // use the first one! xmlFactory = (XMLMetaBeanFactory) each; return; } } xmlFactory = null; // none }
public XMLMetaProperty getProperty(String name) { return findProperty(name); }
public XMLMetaBeanReference getBeanRef(String name) { return findBeanRef(name); }
public XMLMetaBeanBuilder(MetaBeanFactory[] factories) { setFactories(factories); }
@Override public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception { if (meta == null) { meta = createMetaBean(xmlMeta); } xmlFactory.enrichMetaBean(meta, new XMLMetaBeanFactory.XMLResult(xmlMeta, xmlInfos)); }