Package jfun.yan.factory

Examples of jfun.yan.factory.GlobalScope


        yan.registerComponent(Components.bean(Yin.class).singleton().singleton()
            .withArgument(1, Components.value("bad ying"))
            .withProperties(new String[]{"yin","yang"},
                new Creator[]{Components.useType(IYin.class),
                Components.useType(Yang.class)}).guard());
        yan.registerComponent(Components.bean(Yang.class).singleton(new GlobalScope())
            .withProperties(props)
            .withProperty("nonexistent", Components.value("bad yang"))
            .singleton(new ThreadLocalScope()));

        IYin yin = (IYin) yan.getInstanceOfType(IYin.class);
View Full Code Here


      testSerializable(prepSER_isSerializable(yan), yan);
      testSerializable(Components.value("hello"), yan);
      testSerializable(Components.ctor(ArrayList.class, null), yan);
      testSerializable(Components.ctor(ArrayList.class, null), yan);
      testSerializable(Components.method(this, "greet").withArgument(0, Components.value("Tom")).singleton().proxy(), yan);
      testSerializable(Components.method(this, "greet").withArgument(0, Components.value("Tom")).singleton(new GlobalScope()).proxy(), yan);
      testSerializable(Components.method(this, "greet").withArgument(0, Components.value("Tom")).singleton(new ThreadLocalScope()).proxy(), yan);
    }
View Full Code Here

            params[0] = Components.value(iter.next()).guard().singleton();
            for (int i = 1; i < params.length; i++) {
              Component tmp = Components.value(wrapperDependencies[i - 1]);
              switch(i%3){//to test all singleton methods.
                case 0:
                 tmp = tmp.singleton(new GlobalScope());
                 break;
                case 1:
                  tmp = tmp.singleton(new ThreadLocalScope());
                case 2:
                  tmp = tmp.singleton();
View Full Code Here

      Component b = Components.bean(B.class).singleton(new ThreadLocalScope());
      verifyABMutualRecursionForSingleton(a, b);
    }
    public void testMutualRecursionOnScopedSingletonBean()
    throws IntrospectionException{
      Component a = Components.bean(A.class).singleton(new GlobalScope());
      Component b = Components.bean(B.class).singleton(new ThreadLocalScope());
      verifyABMutualRecursionForSingleton(a, b);
    }
View Full Code Here

      verifyABMutualRecursionForSingleton(a, b);
    }
    public void testManualMutualRecursionOnScopedSingletonBean()
    throws IntrospectionException{
      Component a = Components.bean(A.class)
        .withProperty("b", Components.useKey("b")).singleton(new GlobalScope());
      Component b = Components.bean(B.class)
        .withProperty("a", Components.useKey("a")).singleton(new ThreadLocalScope());
      verifyABMutualRecursionForSingleton(a, b);
    }
View Full Code Here

      verifyABMutualRecursionForSingleton(a, b);
    }
    public void testManualMutualRecursionOnScopedSemiSingletonBean()
    throws IntrospectionException{
      Component a = Components.bean(A.class)
        .singleton(new GlobalScope()).withProperty("b", Components.useKey("b"));
      Component b = Components.bean(B.class)
        .singleton(new ThreadLocalScope()).withProperty("a", Components.useKey("a"));
      verifyABMutualRecursionForSingleton(a, b);
    }  
View Full Code Here

        .singleton(new ThreadLocalScope()).withProperty("a", Components.useKey("a"));
      verifyABMutualRecursionForSingleton(a, b);
    }  
    public void testMutualRecursionOnScopedSingletonSingletonBean()
    throws IntrospectionException{
      Component a = Components.bean(A.class).singleton(new GlobalScope()).singleton();
      Component b = Components.bean(B.class).singleton(new ThreadLocalScope()).singleton();
      verifyABMutualRecursionForSingleton(a, b);
    }
View Full Code Here

      Component b = Components.bean(B.class).singleton(new ThreadLocalScope()).singleton();
      verifyABMutualRecursionForSingleton(a, b);
    }
    public void testMutualRecursionOnSingletonScopedSingletonBean()
    throws IntrospectionException{
      Component a = Components.bean(A.class).singleton().singleton(new GlobalScope());
      Component b = Components.bean(B.class).singleton().singleton(new ThreadLocalScope()).singleton();
      verifyABMutualRecursionForSingleton(a, b);
    }
View Full Code Here

TOP

Related Classes of jfun.yan.factory.GlobalScope

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.