Examples of MetaBean


Examples of org.apache.bval.model.MetaBean

        }
    }

    public MetaBean findForClass(Class<?> clazz) {
        if (clazz == null) return null;
        MetaBean beanInfo = cache.findForClass(clazz);
        if (beanInfo != null) return beanInfo;
        try {
            beanInfo = builder.buildForClass(clazz);
            cache.cache(beanInfo);
            computeRelationships(beanInfo);
View Full Code Here

Examples of org.apache.bval.model.MetaBean

        BusinessObject.class.getResource("test-beanInfos.xml")));
  }

  public void testBeanInfosCustomPatchGenerated()
      throws Exception {
    MetaBean mbean = mbm.findForClass(BusinessObject.class);
    MetaProperty mprop = mbean.getProperty("lastName");
    assertTrue(mprop.isMandatory());

    mbm.getCache().removeFromCache(mbean);
    mbm.getBuilder().addLoader(new XMLMetaBeanURLLoader(
        BusinessObject.class.getResource("test-beanInfos-custom.xml")));
    mbean = mbm.findForClass(BusinessObject.class);
    mprop = mbean.getProperty("lastName");
    assertTrue(!mprop.isMandatory());

    JSONGenerator converter = new JSONGenerator();

    List<MetaBean> metaBeans = new ArrayList(2);
    metaBeans.add(mbean);
    MetaBean mbean2 = mbm.findForId("UnknownObject");
    metaBeans.add(mbean2);
    String json = converter.toJSON(metaBeans);
    assertNotNull(json);
    //System.out.println(json);
  }
View Full Code Here

Examples of org.apache.bval.model.MetaBean

    assertNotNull(json);
    //System.out.println(json);
  }

  public void testJSON() throws Exception {
    MetaBean info = mbm.findForClass(BusinessObject.class);
    MetaBean info2 = info.getProperty("address").getMetaBean();

    // empty default bean without xml backup
    MetaBean info3 = mbm.findForClass(BusinessObjectAddress.class);
    JSONGenerator converter = new JSONGenerator();

    List<MetaBean> metaBeans = new ArrayList(2);
    metaBeans.add(info);
    metaBeans.add(info2);
View Full Code Here

Examples of org.apache.bval.model.MetaBean

    assertNotNull(json);
    //System.out.println(json);
  }

  public void testJSON_dynaTypeEnum() throws Exception {
    MetaBean info = mbm.findForClass(BusinessObject.class);
    MetaProperty choice = info.getProperty("choice");
    choice.setType(new DynaTypeEnum(BusinessEnum.class, "CUSTOM_1", "CUSTOM_2"));

    JSONGenerator converter = new JSONGenerator();

    List<MetaBean> metaBeans = new ArrayList(1);
View Full Code Here

Examples of org.joda.beans.MetaBean

    return permuteTestObjects(clazz, getBiggestConstructor(clazz));
  }

  private static <T extends ManageableSecurity> Collection<T> permuteTestSecurities(final Class<T> clazz) {
    intializeClass(clazz);
    MetaBean mb = JodaBeanUtils.metaBean(clazz);
    List<MetaProperty<?>> mps = new ArrayList<MetaProperty<?>>(mb.metaPropertyMap().values());
   
    // find the longest set of available data
    final List<?>[] parameterValues = new List<?>[mps.size()];
    int longest = 0;
    for (int i = 0; i < mps.size(); i++) {
      parameterValues[i] = getTestObjects(mps.get(i).propertyType(), clazz);
      if (parameterValues[i].size() > longest) {
        longest = parameterValues[i].size();
      }
    }
   
    // prepare
    final List<Throwable> exceptions = new ArrayList<Throwable>();
    final Collection<T> objects = new ArrayList<T>();
    final int[] parameterIndex = new int[mps.size()];
    for (int i = 0; i < longest; i++) {
      try {
        BeanBuilder<?> builder = mb.builder();
        for (int j = 0; j < mps.size(); j++) {
          Object value = parameterValues[j].get(parameterIndex[j]);
          parameterIndex[j] = (parameterIndex[j] + 1) % parameterValues[j].size();
          MetaProperty<?> metaProperty = mps.get(j);
          if (metaProperty.readWrite() != PropertyReadWrite.READ_ONLY) {
View Full Code Here

Examples of weka.gui.beans.MetaBean

   * @param metabeans         the list of MetaBeans in the user toolbar
   */
  protected void removeUserToolBarBeans(Vector metabeans) {
    int           i;
    int           n;
    MetaBean      meta;
    Vector        subflow;
    BeanInstance  beaninst;
   
    for (i = 0; i < metabeans.size(); i++) {
      meta    = (MetaBean) metabeans.get(i);
      subflow = meta.getSubFlow();
     
      for (n = 0; n < subflow.size(); n++) {
        beaninst = (BeanInstance) subflow.get(n);
        beaninst.removeBean(m_BeanLayout);
      }
View Full Code Here

Examples of weka.gui.beans.MetaBean

   */
  public Element writeMetaBean(Element parent, Object o, String name)
      throws Exception {
   
    Element         node;
    MetaBean        meta;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), name);
   
    m_CurrentNode = parent;
   
    meta = (MetaBean) o;
    node = writeToXML(parent, o, name);

    invokeWriteToXML(node, getIDsForBeanInstances(meta.getBeansInInputs()), VAL_INPUTSID);
    invokeWriteToXML(node, getIDsForBeanInstances(meta.getBeansInOutputs()), VAL_OUTPUTSID);
   
    return node;
  }
View Full Code Here

Examples of weka.gui.beans.MetaBean

    int             i;
    String          name;
    Vector          inputs;
    Vector          outputs;
    Vector          coords;
    MetaBean        bean;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), node.getAttribute(ATT_NAME));

    m_CurrentNode = node;
   
    result   = new MetaBean();
    children = XMLDocument.getChildTags(node);
    inputs   = new Vector();
    outputs  = new Vector();
    coords   = new Vector();
   
    // the current MetaBean
    m_CurrentMetaBean = (MetaBean) result;

    for (i = 0; i < children.size(); i++) {
      child = (Element) children.get(i);
      name  = child.getAttribute(ATT_NAME);

      if (name.equals(VAL_ASSOCIATEDCONNECTIONS))
        ((MetaBean) result).setAssociatedConnections((Vector) invokeReadFromXML(child));
      else if (name.equals(VAL_INPUTSID))
        inputs = (Vector) invokeReadFromXML(child);
      else if (name.equals(VAL_OUTPUTSID))
        outputs = (Vector) invokeReadFromXML(child);
      else if (name.equals(VAL_SUBFLOW))
        ((MetaBean) result).setSubFlow((Vector) invokeReadFromXML(child));
      else if (name.equals(VAL_ORIGINALCOORDS))
        coords = (Vector) invokeReadFromXML(child);
      else if (name.equals(VAL_INPUTS))
        System.out.println("INFO: '" + name + "' will be restored later.");
      else if (name.equals(VAL_OUTPUTS))
        System.out.println("INFO: '" + name + "' will be restored later.");
      else
        readFromXML(result, name, child);
    }

    bean = (MetaBean) result;
   
    // set inputs and outputs, after the beans have been instantiated
    bean.setInputs(getBeanInstancesForIDs(inputs));
    bean.setOutputs(getBeanInstancesForIDs(outputs));
    bean.setOriginalCoords(coords);
   
    return result;
  }
View Full Code Here

Examples of weka.gui.beans.MetaBean

   * @param metabeans         the list of MetaBeans in the user toolbar
   */
  protected void removeUserToolBarBeans(Vector metabeans) {
    int           i;
    int           n;
    MetaBean      meta;
    Vector        subflow;
    BeanInstance  beaninst;
   
    for (i = 0; i < metabeans.size(); i++) {
      meta    = (MetaBean) metabeans.get(i);
      subflow = meta.getSubFlow();
     
      for (n = 0; n < subflow.size(); n++) {
        beaninst = (BeanInstance) subflow.get(n);
        beaninst.removeBean(m_BeanLayout);
      }
View Full Code Here

Examples of weka.gui.beans.MetaBean

   */
  public Element writeMetaBean(Element parent, Object o, String name)
      throws Exception {
   
    Element         node;
    MetaBean        meta;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), name);
   
    m_CurrentNode = parent;
   
    meta = (MetaBean) o;
    node = writeToXML(parent, o, name);

    invokeWriteToXML(node, getIDsForBeanInstances(meta.getBeansInInputs()), VAL_INPUTSID);
    invokeWriteToXML(node, getIDsForBeanInstances(meta.getBeansInOutputs()), VAL_OUTPUTSID);
   
    return node;
  }
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.