Examples of InstanceFactory


Examples of net.sf.beanrunner.factory.InstanceFactory

   *            the property type
   * @param value
   *            the value to pass
   */
  public void addTestValue(Class type, Object value) {
    InstanceFactory factory = (InstanceFactory) factoryMap.get(type);
    if (factory == null) {
      factoryMap.put(type, new SingleValueInstanceFactory(value));

    } else {
      factoryMap.put(type, new ChainedInstanceFactory(factory, new SingleValueInstanceFactory(value)));
View Full Code Here

Examples of net.sf.beanrunner.factory.InstanceFactory

  }

  private void simplePropertyTest(Object bean, PropertyDescriptor descriptor, Method readMethod, Method writeMethod)
      throws Exception {
    Class propertyType = descriptor.getPropertyType();
    InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
    if (instances == null) {
      instances = new NestedBeanInstanceFactory(propertyType);
    }
    Object obj;
    Object invoke;
    for (Iterator it = instances.iterator(); it.hasNext(); Assert.assertEquals("Property:" + descriptor.getDisplayName(), obj,
        invoke)) {
      obj = it.next();
      writeMethod.invoke(bean, new Object[] { obj });
      invoke = readMethod.invoke(bean, new Object[0]);
    }
View Full Code Here

Examples of net.sf.beanrunner.factory.InstanceFactory

     *            the property type
     * @param value
     *            the value to pass
     */
    public void addTestValue(Class type, Object value) {
        InstanceFactory factory = (InstanceFactory) factoryMap.get(type);
        if (factory == null) {
            factoryMap.put(type, new SingleValueInstanceFactory(value));

        } else {
            factoryMap.put(type, new ChainedInstanceFactory(factory, new SingleValueInstanceFactory(value)));
View Full Code Here

Examples of net.sf.beanrunner.factory.InstanceFactory

    }

    private void testToStringInternal(Object bean, PropertyDescriptor descriptor, Method writeMethod) throws Exception {
        Class propertyType = descriptor.getPropertyType();
        InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
        if (instances == null) {
            instances = new NestedBeanInstanceFactory(propertyType);
        }
        Object obj = null;
        String invoke;
        try {
            for (Iterator it = instances.iterator(); it.hasNext();) {
                obj = it.next();
                writeMethod.invoke(bean, new Object[] { obj });
                invoke = bean.toString();
                String expected = (obj == null) ? "null" : obj.toString();
                String message = "Property not in toString[:" + invoke + "] \nExpected{{"  + expected + " }} "+ descriptor.getDisplayName();
View Full Code Here

Examples of net.sf.beanrunner.factory.InstanceFactory

    }

    private void simplePropertyTest(Object bean, PropertyDescriptor descriptor, Method readMethod, Method writeMethod)
            throws Exception {
        Class propertyType = descriptor.getPropertyType();
        InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
        if (instances == null) {
            instances = new NestedBeanInstanceFactory(propertyType);
        }
        Object obj;
        Object invoke;
        for (Iterator it = instances.iterator(); it.hasNext(); Assert.assertEquals("Property:" + descriptor.getDisplayName(), obj,
                invoke)) {
            obj = it.next();
            try {
                writeMethod.invoke(bean, new Object[] { obj });
                invoke = readMethod.invoke(bean, new Object[0]);
View Full Code Here

Examples of nexj.core.rpc.InstanceFactory

      };

      try
      {
         List list = (List)new SOAPUnmarshaller(m_context).deserialize(reader);
         InstanceFactory factory = new InstanceFactory(InstanceFactory.STATE, m_context);

         for (int i = 0; i != list.size(); ++i)
         {
            factory.instantiate((TransferObject)list.get(i));
         }

         factory.complete();

         for (Iterator itr = factory.getIdentityMap().valueIterator(); itr.hasNext();)
         {
            Object obj = itr.next();

            if (obj instanceof Instance)
            {
View Full Code Here

Examples of nexj.core.rpc.InstanceFactory

            throw new UncheckedException("err.rpc.valueDeserialization", e);
         }

         m_map = new PropertyHashTab(tobj.getValueCount());

         InstanceFactory factory = null;

         for (PropertyIterator itr = tobj.getIterator(); itr.hasNext();)
         {
            String sName = (String)itr.next();
            Object value = itr.getValue();

            if ((value instanceof List || value instanceof TransferObject) && m_nSafeMode != RAW)
            {
               if (factory == null)
               {
                  factory = new InstanceFactory(context);
               }

               if (m_nSafeMode != FAIL)
               {
                  try
                  {
                     value = factory.instantiate(value);
                  }
                  catch (RuntimeException e)
                  {
                     if (m_nSafeMode == SKIP)
                     {
                        continue;
                     }
                  }
               }
               else
               {
                  value = factory.instantiate(value);
               }
            }

            m_map.put(sName, value);
         }
View Full Code Here

Examples of nexj.core.rpc.InstanceFactory

      Instance inst = null;

      try
      {
         context.setSecure(false);
         InstanceFactory instanceFactory = new InstanceFactory(new HashTab(), new ArrayList(), InstanceFactory.STATE, context);

         inst = instanceFactory.instantiate(tobj);

         instanceFactory.complete();
      }
      finally
      {
         context.setSecure(bSecured);
      }
View Full Code Here

Examples of nexj.core.rpc.InstanceFactory

    */
   public void importData(Iterator tobjItr, Set dataSourceSet, boolean bEmpty)
   {
      m_context.getUnitOfWork().setMaxChangeCount(-1);

      InstanceFactory factory = new InstanceFactory(m_context);

      while (tobjItr.hasNext())
      {
         factory.instantiate((TransferObject)tobjItr.next());
      }

      for (Iterator itr = factory.getIdentityMap().valueIterator(); itr.hasNext();)
      {
         Object obj = itr.next();

         if (obj instanceof Instance)
         {
View Full Code Here

Examples of nexj.core.rpc.InstanceFactory

         }

         int nOffset = 0;
         int nCount = tobjList.size();
         InstanceList instanceList = new InstanceArrayList(nCount);
         InstanceFactory factory = new InstanceFactory(identityMap, null, InstanceFactory.STATE, context);

         for (int i = 0; i < nCount && (m_nMaxCount < 0 || instanceList.size() < m_nMaxCount); ++i)
         {
            TransferObject tobj = (TransferObject)tobjList.get(i);

            m_instance = tobj;

            if (bFiltered || m_where == null || !Boolean.FALSE.equals(m_where.getValue()))
            {
               Instance instance = factory.instantiate(tobj);

               identityMap.clear();

               if (isJoin())
               {
                  join(instance, getAdapter().getOID(instance, m_childItem));
               }

               if (nOffset++ >= m_nOffset)
               {
                  instanceList.add(instance);
               }
            }
         }

         if (bCached && !bMissed && factory.isLockMismatch())
         {
            bCached = false;

            continue;
         }
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.