Examples of MetaBean


Examples of org.apache.bval.model.MetaBean

    public void testEnrichCopies() throws Exception {
        Map<String, MetaBean> copies = mbm.enrichCopies(new XMLMetaBeanURLLoader(
              BusinessObject.class.getResource("test-beanInfos-custom.xml")).load());
        assertNotNull(copies);
        MetaBean mb = copies.get(BusinessObject.class.getName());
        assertFalse(mb.getProperty("lastName").isMandatory());
        MetaBean mb2 = mbm.findForClass(BusinessObject.class);
        assertTrue(mb2.getProperty("lastName").isMandatory());
    }
View Full Code Here

Examples of org.apache.bval.model.MetaBean

        MetaBean mb2 = mbm.findForClass(BusinessObject.class);
        assertTrue(mb2.getProperty("lastName").isMandatory());
    }

    public void testCopy() {
        MetaBean mb = mbm.findForClass(BusinessObject.class);
        MetaBean mb2 = mb.copy();
        assertTrue(mb2 != mb);
        assertTrue(mb2.getProperty("dateBirth") != mb.getProperty("dateBirth"));
    }
View Full Code Here

Examples of org.apache.bval.model.MetaBean

        assertTrue(mb2.getProperty("dateBirth") != mb.getProperty("dateBirth"));
    }

    public void testFindForClass() throws Exception {
        MetaBeanFinder finder = mbm;
        MetaBean info = finder.findForClass(BusinessObject.class);
        assertNotNull(info);
        assertTrue(info == info.getProperty("address").getMetaBean().getProperty("owner")
              .getMetaBean());
        assertTrue(info == info.getProperty("addresses").getMetaBean()
              .getProperty("owner").getMetaBean());
        assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0);
    }
View Full Code Here

Examples of org.apache.bval.model.MetaBean

        Map<String, MetaBean> all2 = mbm.findAll();
        assertEquals(all.size(), all2.size());
        assertTrue(all.get(BusinessObject.class.getName()) ==
              all2.get(BusinessObject.class.getName()));
        assertTrue(all.get(BusinessObject.class.getName()) != null);
        MetaBean bean = all.get(BusinessObject.class.getName());
        assertTrue(bean == bean.getProperty("address").getMetaBean().getProperty("owner")
              .getMetaBean());
        assertTrue(bean == bean.getProperty("addresses").getMetaBean()
              .getProperty("owner").getMetaBean());
    }
View Full Code Here

Examples of org.apache.bval.model.MetaBean

          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;
View Full Code Here

Examples of org.apache.bval.model.MetaBean

      carrier.xmlInfos = xmlMetaBeanInfos;
      if (xmlMetaBeanInfos == null) continue;
      try {
        for (XMLMetaBean xmlMeta : xmlMetaBeanInfos.getBeans()) {
          nothing = false;
          MetaBean copy = copies.get(xmlMeta.getId());
          if (copy == null) { // ist noch nicht kopiert
            MetaBean meta = all.get(xmlMeta.getId());
            if (meta == null) { // gibt es nicht
              copy = createMetaBean(xmlMeta);
            } else { // gibt es, jetzt kopieren
              copy = meta.copy();
            }
            copies.put(xmlMeta.getId(), copy);
          }
          carrier.xmlMeta = xmlMeta;
          xmlFactory.enrichMetaBean(copy, carrier);
View Full Code Here

Examples of org.apache.bval.model.MetaBean

    }
    return null;
  }

  public MetaBean buildForClass(Class<?> clazz) throws Exception {
    MetaBean meta = new MetaBean();
    if (clazz != null) { // local class here?
      meta.setBeanClass(clazz);
      meta.setId(clazz.getName()); // default id = full class name!
    }
    for (MetaBeanFactory factory : factories) {
      factory.buildMetaBean(meta);
    }
    return meta;
View Full Code Here

Examples of org.apache.bval.model.MetaBean

    public Map<String, MetaBean> findAll() {
        if (!complete) {
            try {
                Map<String, MetaBean> allBuilt = builder.buildAll();
                for (MetaBean meta : allBuilt.values()) {
                    MetaBean cached = cache.findForId(meta.getId());
                    if (cached == null) {
                        cache.cache(meta);
                    }
                }
                Map<String, MetaBean> map = cache.findAll();
                for (Object oentry : map.values()) {
                    MetaBean meta = (MetaBean) oentry;
                    computeRelationships(meta, map);
                }
                complete = true;
                return map;
            } catch (RuntimeException e) {
View Full Code Here

Examples of org.apache.bval.model.MetaBean

    public Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos) {
        Map<String, MetaBean> cached = findAll();
        try {
            Map<String, MetaBean> patched = builder.enrichCopies(cached, infos);
            for (Object oentry : patched.values()) {
                MetaBean meta = (MetaBean) oentry;
                computeRelationships(meta, patched);
            }
            return patched;
        } catch (RuntimeException e) {
            throw e; // do not wrap runtime exceptions
View Full Code Here

Examples of org.apache.bval.model.MetaBean

            throw new IllegalArgumentException("error enriching beanInfos", e);
        }
    }

    public MetaBean findForId(String beanInfoId) {
        MetaBean beanInfo = cache.findForId(beanInfoId);
        if (beanInfo != null) return beanInfo;
        try {
            beanInfo = builder.buildForId(beanInfoId);
            cache.cache(beanInfo);
            computeRelationships(beanInfo);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.