Examples of DefaultObjectFactory


Examples of org.apache.ibatis.reflection.factory.DefaultObjectFactory

    assertEquals(999, author2.getId());
  }

  @Test
  public void shouldSerizalizeADeserlizaliedProxy() throws Exception {
    Object proxy = ((JavassistProxyFactory)proxyFactory).createDeserializationProxy(author, new HashMap<String, ResultLoaderMap.LoadPair> (), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    Author author2 = (Author) deserialize(serialize((Serializable) proxy));
    assertEquals(author, author2);
    assertFalse(author.getClass().equals(author2.getClass()));
  }
View Full Code Here

Examples of org.apache.ibatis.reflection.factory.DefaultObjectFactory

  @Test
  public void shouldCreateAProxyForAPartiallyLoadedBean() throws Exception {
    ResultLoaderMap loader = new ResultLoaderMap();
    loader.addLoader("id", null, null);
    Object proxy = proxyFactory.createProxy(author, loader, new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    Author author2 = (Author) deserialize(serialize((Serializable) proxy));
    assertTrue(author2 instanceof Factory);
  }
View Full Code Here

Examples of org.apache.ibatis.reflection.factory.DefaultObjectFactory

  @Test(expected = ExecutorException.class)
  public void shouldFailCallingAnUnloadedProperty() throws Exception {
    // yes, it must go in uppercase
    HashMap<String, ResultLoaderMap.LoadPair> unloadedProperties = new HashMap<String, ResultLoaderMap.LoadPair>();
    unloadedProperties.put("ID", null);
    Author author2 = (Author) ((CglibProxyFactory)proxyFactory).createDeserializationProxy(author, unloadedProperties, new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    author2.getId();
  }
View Full Code Here

Examples of org.apache.ibatis.reflection.factory.DefaultObjectFactory

    author2.getId();
  }

  @Test
  public void shouldLetCallALoadedProperty() throws Exception {
    Author author2 = (Author) ((CglibProxyFactory)proxyFactory).createDeserializationProxy(author, new HashMap<String, ResultLoaderMap.LoadPair>(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    assertEquals(999, author2.getId());
  }
View Full Code Here

Examples of org.apache.ibatis.reflection.factory.DefaultObjectFactory

    assertEquals(999, author2.getId());
  }

  @Test
  public void shouldSerizalizeADeserlizaliedProxy() throws Exception {
    Object proxy = ((CglibProxyFactory)proxyFactory).createDeserializationProxy(author, new HashMap<String, ResultLoaderMap.LoadPair>(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    Author author2 = (Author) deserialize(serialize((Serializable) proxy));
    assertEquals(author, author2);
    assertFalse(author.getClass().equals(author2.getClass()));
  }
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

                final Class indexFieldType = index.getFieldType();
                final Class indexType = (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

        final ObjectIndex index = (ObjectIndex)m_jispIndexes.get(indexName);
        final Class indexType = (Class)m_jispIndexTypes.get(indexName);

        Object obj = null;
        try {
            ObjectFactory factory = new DefaultObjectFactory(
                    indexType, new Class[]{key.getClass()}, new Object[]{key});

            m_readWriteLock.readLock().acquire();
            try {
                obj = m_database.read(
                        (KeyObject)factory.newInstance(), index, m_loader);
            }
            finally {
                m_readWriteLock.readLock().release();
            }
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

        if (!indexTypeFrom.equals(indexTypeTo)) {
            throw new RuntimeException("from A to index must be of the same index type");
        }

        try {
            ObjectFactory fromFactory = new DefaultObjectFactory(
                    indexTypeFrom,
                    new Class[]{from.getClass()},
                    new Object[]{from});

            m_readWriteLock.readLock().acquire();
            try {
                final BTreeObjectIterator iterator =
                        m_database.createIterator((BTreeIndex)indexFrom);

                if (!iterator.moveTo((KeyObject)fromFactory.newInstance())) {
                    throw new RuntimeException("record " + from + " does not exist");
                }
                do {
                    final Object item = iterator.getObject();
                    if (item != null) {
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

                final Class indexType =
                        (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
                        new Class[]{indexFieldType},
                        new Object[]{indexFieldValue});

                keyArray[i] = (KeyObject)factory.newInstance();
            }
            catch (Exception e) {
                throw new WrappedRuntimeException(e);
            }
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.objectfactory.DefaultObjectFactory

        for (Iterator it = btreeIndexes.iterator(); it.hasNext();) {

            final IndexDefinition indexDef = (IndexDefinition)it.next();
            final String jispIndexType = getJispIndexType(indexDef.getType());

            ObjectFactory factory = new DefaultObjectFactory(jispIndexType);

            final StringBuffer indexFile = new StringBuffer();
            indexFile.append(m_indexDir);
            indexFile.append(File.separator);
            indexFile.append(indexDef.getName());

            File killit = new File(indexFile.toString());
            if (killit.exists()) killit.delete();

            final BTreeIndex index = new BTreeIndex(
                    indexFile.toString(),
                    INDEX_ORDER,
                    (KeyObject)factory.newInstance(),
                    false, m_loader);

            indexes.add(index);

            m_jispIndexes.put(indexDef.getName(), index);
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.