Package net.sf.cglib.proxy

Examples of net.sf.cglib.proxy.Factory


    /**
     * Marks the SearchBuilder as completed in building the search conditions.
     */
    public synchronized void done() {
        if (_entity != null) {
            Factory factory = (Factory)_entity;
            factory.setCallback(0, null);
            _entity = null;
        }
       
        if (_joins != null) {
          for (JoinBuilder<GenericSearchBuilder<?, ?>> join : _joins.values()) {
View Full Code Here


    @Override
    @SuppressWarnings("unchecked") @DB(txn=false)
    public <J> GenericSearchBuilder<T, J> createSearchBuilder(Class<J> resultType) {
        final T entity = (T)_searchEnhancer.create();
        final Factory factory = (Factory)entity;
        GenericSearchBuilder<T, J> builder = new GenericSearchBuilder<T, J>(entity, resultType, _allAttributes);
        factory.setCallback(0, builder);
        return builder;
    }
View Full Code Here

        return true;
    }

    @DB(txn=false)
    public static <T> UpdateBuilder getUpdateBuilder(final T entityObject) {
        final Factory factory = (Factory)entityObject;
        assert(factory != null);
        return (UpdateBuilder)factory.getCallback(1);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override @DB(txn=false)
    public SearchBuilder<T> createSearchBuilder() {
        final T entity = (T)_searchEnhancer.create();
        final Factory factory = (Factory)entity;
        SearchBuilder<T> builder = new SearchBuilder<T>(entity, _allAttributes);
        factory.setCallback(0, builder);
        return builder;
    }
View Full Code Here

    }

    @Override @DB(txn=false)
    public <K> SearchCriteria2 createSearchCriteria2(Class<K> resultType) {
        final T entity = (T)_searchEnhancer.create();
        final Factory factory = (Factory)entity;
        SearchCriteria2 sc = new SearchCriteria2(entity, resultType, _allAttributes, this);
        factory.setCallback(0, sc);
        return sc;
    }
View Full Code Here

    }

    @Override @DB(txn=false)
    public SearchCriteria2 createSearchCriteria2() {
        final T entity = (T)_searchEnhancer.create();
        final Factory factory = (Factory)entity;
        SearchCriteria2 sc = new SearchCriteria2(entity, entity.getClass(), _allAttributes, this);
        factory.setCallback(0, sc);
        return sc;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public <T> T getRealObject(T proxy) {
        log.debug("Get real entity from proxy {} ", proxy);

        if (isProxy(proxy)) {
            Factory factory = (Factory) proxy;
            ProxyInterceptor<T> interceptor = (ProxyInterceptor<T>) factory.getCallback(0);
            return (T) interceptor.getTarget();
        } else {
            return proxy;
        }
View Full Code Here

    }

    public <T> ProxyInterceptor<T> getInterceptor(T proxy) {
        log.debug("Get interceptor from proxy {} ", proxy);

        Factory factory = (Factory) proxy;

        @SuppressWarnings("unchecked")
        ProxyInterceptor<T> interceptor = (ProxyInterceptor<T>) factory.getCallback(0);
        return interceptor;
    }
View Full Code Here

        manager.insert(entity);

        RegularStatement statement = select("id","name","friends").from("CompleteBean").limit(3);
        CompleteBean actual = manager.typedQuery(CompleteBean.class, statement).getFirst();

        Factory factory1 = (Factory) actual;
        @SuppressWarnings("unchecked")
        ProxyInterceptor<CompleteBean> interceptor1 = (ProxyInterceptor<CompleteBean>) factory1.getCallback(0);

        CompleteBean target1 = (CompleteBean) interceptor1.getTarget();

        assertThat(target1.getAge()).isNull();
        assertThat(target1.getFollowers()).isNull();
View Full Code Here

        assertThat(actual).hasSize(2);

        CompleteBean found1 = actual.get(0);
        CompleteBean found2 = actual.get(1);

        Factory factory1 = (Factory) found1;
        @SuppressWarnings("unchecked")
        ProxyInterceptor<CompleteBean> interceptor1 = (ProxyInterceptor<CompleteBean>) factory1.getCallback(0);

        CompleteBean target1 = (CompleteBean) interceptor1.getTarget();

        assertThat(target1.getLabel()).isNull();
        assertThat(target1.getWelcomeTweet()).isNull();

        Factory factory2 = (Factory) found1;
        @SuppressWarnings("unchecked")
        ProxyInterceptor<CompleteBean> interceptor2 = (ProxyInterceptor<CompleteBean>) factory2.getCallback(0);

        CompleteBean target2 = (CompleteBean) interceptor2.getTarget();

        assertThat(target2.getLabel()).isNull();
        assertThat(target2.getWelcomeTweet()).isNull();
View Full Code Here

TOP

Related Classes of net.sf.cglib.proxy.Factory

Copyright © 2018 www.massapicom. 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.