Examples of registerValue()


Examples of jfun.yan.Container.registerValue()

    public void testBeanByQualifiedName()
    throws Exception{
      try{
        final Container yan = createYanContainer();
        yan.registerValue("tests.jfun.yan.tck.BaseContainerTestCase$Civilian.dog", "Bach");
        yan.registerValue("tests.jfun.yan.tck.BaseContainerTestCase$Civilian.cat", "Chopin");
        yan.registerComponent("civilian", Beans.byQualifiedName(
            Components.ctor(Civilian.class)         
            .withDefaultArgument(0, Components.value(new Integer(-1)))
            .optionalParameters()
            .bean()
View Full Code Here

Examples of jfun.yan.Container.registerValue()

        Components.fun(Functions.instance_method(type, "getGreeting"));
        fail("should have failed with IllegalArgumentException");
      }
      catch(IllegalArgumentException e){}
      yan.registerComponent(Components.static_method(type, "instance"));
      yan.registerValue("Tom");
      yan.registerComponent("target",
          Components.fun(Functions.instance_method(type, "greet"))
          .withArgument(1, Components.value("Jerry")));
      assertEquals("hello Jerry, I am Tom", ""+yan.getInstance("target"));
      yan.registerComponent(Components.static_method(type, "instance"));
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    public static String tag(String prefix, int i){
      return prefix+i;
    }
    public void testComponentArgumentsShouldNotPropogateToParts(){
      final Container yan = createYanContainer();
      yan.registerValue("default prefix");
      yan.registerComponent(Components.value(1));
      final Component tag = Components.method(this, "tag");
      final Component target = tag
        .withArgument(0, Components.method(this, "tag"))
        .withArgument(1, Components.value(0));
View Full Code Here

Examples of jfun.yan.Container.registerValue()

      assertFalse(a.isRunning2());
    }
    public void testParameterCustomizationShouldNotPropogateToTheNextLevel()
    throws Exception{
      Container yan = this.createYanContainer();
      yan.registerValue("autowired");
      final Component manual = Components.value("manualwired");
      final Component cc1 = Components.ctor(Echo.class).method("newInstance")
        .withArgument(0, manual);
      final Component cc2 = Components.ctor(Echo.class).method("add")
        .withArgument(0, manual);
View Full Code Here

Examples of jfun.yan.Container.registerValue()

          public Creator bind(Object l){
            return Components.value(l).method("add", new Class[]{Object.class})
              .withArgument(0, Components.useKey("elem1"));
          }
        }).method("size", null);
        yan.registerValue("elem1", "val1");
        yan.registerComponent("size", sz1);
        assertEquals(new Integer(1), yan.getInstance("size"));
       
        final Component sz2 = c.followedBy(new Binder(){
          public Creator bind(Object l){
View Full Code Here

Examples of jfun.yan.Container.registerValue()

            return adder
              .withArgument(0, Components.useKey("elem1"))
              .seq(adder.withArgument(0, Components.useKey("elem2")));
          }
        }).method(java.util.List.class.getMethod("size", new Class[0]));
        yan.registerValue("elem2", "val2");
        yan.registerComponent("size", sz2);
        assertEquals(new Integer(2), yan.getInstance("size"));
        assertFalse(sz0.equals(sz1));
        assertFalse(sz1.equals(sz0));
        assertFalse(sz0.equals(sz2));
View Full Code Here

Examples of jfun.yan.Container.registerValue()

      map.put(obj, obj);
      assertEquals(obj, map.get(obj));
    }
    private Container getGbeanContainer(Component gb){
      Container yan = createYanContainer();
      yan.registerValue("firstname", "Jack");
      //yan.registerValue("lastname", "Nicolson");
      yan.registerValue("middle", new Character('M'));
      yan.registerValue("age", new Integer(10));

      yan.registerComponent("target", gb);
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    }
    private Container getGbeanContainer(Component gb){
      Container yan = createYanContainer();
      yan.registerValue("firstname", "Jack");
      //yan.registerValue("lastname", "Nicolson");
      yan.registerValue("middle", new Character('M'));
      yan.registerValue("age", new Integer(10));

      yan.registerComponent("target", gb);
      return yan;
    }
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    private Container getGbeanContainer(Component gb){
      Container yan = createYanContainer();
      yan.registerValue("firstname", "Jack");
      //yan.registerValue("lastname", "Nicolson");
      yan.registerValue("middle", new Character('M'));
      yan.registerValue("age", new Integer(10));

      yan.registerComponent("target", gb);
      return yan;
    }
    private void runTestGiveBean(Component gb){
View Full Code Here

Examples of jfun.yan.Container.registerValue()

        final B b = (B) yan.getInstance("b");
        A a = (A) yan.getInstance("a");
        assertEquals("default", a.getString());
        assertEquals(new java.util.ArrayList(), a.getList());
        assertSame(b, a.getB());
        yan.registerValue("hello");
        a = (A) yan.getInstance("a");
        assertEquals("hello", a.getString());
        assertEquals(new java.util.ArrayList(), a.getList());
        assertSame(b, a.getB());
        final java.util.List list1 = new java.util.LinkedList();
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.