Examples of registerValue()


Examples of jfun.yan.Container.registerValue()

        Object bo = new Object();
        Object co = new Object();

        a.registerValue("a", ao);
        b.registerValue("b", bo);
        c.registerValue("c", co);

        assertEquals(1, a.getInstances().size());
        assertEquals(2, b.getInstances().size());
        assertEquals(3, c.getInstances().size());
    }
View Full Code Here

Examples of jfun.yan.Container.registerValue()

      return new DefaultContainer();
    }
    public void testSize(){
      final Container yan = createYanContainer();
      String s1 = "hello world";
      yan.registerValue(s1);
      yan.registerValue(s1);
      yan.registerComponent(String.class, Components.value(s1).singleton());
      yan.registerConstructor(java.util.ArrayList.class, (Class[])null);
      assertEquals(2, yan.keys().size());
      assertEquals(2, yan.getInstances().size());
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    }
    public void testSize(){
      final Container yan = createYanContainer();
      String s1 = "hello world";
      yan.registerValue(s1);
      yan.registerValue(s1);
      yan.registerComponent(String.class, Components.value(s1).singleton());
      yan.registerConstructor(java.util.ArrayList.class, (Class[])null);
      assertEquals(2, yan.keys().size());
      assertEquals(2, yan.getInstances().size());
    }
View Full Code Here

Examples of jfun.yan.Container.registerValue()

      yan.registerComponent(int[].class,
          Components.static_method(java.lang.reflect.Array.class,
              "newInstance", new Class[]{Class.class, int.class})
          .cast(int[].class)
          .withArgument(0, Components.useKey("array_dimension")));
      yan.registerValue(new Integer(5));
      yan.registerValue("array_dimension", int.class);
      assertTrue(yan.getInstance(int[].class) instanceof int[]);
      assertEquals(5, ((int[])yan.getInstanceOfType(int[].class)).length);
    }
    public static Object returnNull(){return null;}
View Full Code Here

Examples of jfun.yan.Container.registerValue()

          Components.static_method(java.lang.reflect.Array.class,
              "newInstance", new Class[]{Class.class, int.class})
          .cast(int[].class)
          .withArgument(0, Components.useKey("array_dimension")));
      yan.registerValue(new Integer(5));
      yan.registerValue("array_dimension", int.class);
      assertTrue(yan.getInstance(int[].class) instanceof int[]);
      assertEquals(5, ((int[])yan.getInstanceOfType(int[].class)).length);
    }
    public static Object returnNull(){return null;}
    public Object id(Object obj){return obj;}
View Full Code Here

Examples of jfun.yan.Container.registerValue()

         Components.useKey("superman").bean()
         .withProperty("name", Components.useKey("personName"))
         .withProperty("age", Components.useType(Integer.class))
         .withProperty("nickname", Components.useContainer(yan2))
     );
     yan2.registerValue("Gandolf");
     try{
       yan.verify();
     }
     catch(UnresolvedComponentException e){
       assertTraceSize(e, 3);
View Full Code Here

Examples of jfun.yan.Container.registerValue()

      assertEquals(1, person.getId());
    }
    public int expectArray(int[][] arr){return 1;}
    public void testBasics(){
      final Container yan = createYanContainer();
      yan.registerValue("abc");
      try{
        yan.getInstance("x");
        fail("should have failed with UnresolvedComponentException");
      }
      catch(UnresolvedComponentException e){
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    msgsrc.setBasename("org/springframework/context/support/messages");
    final ApplicationEventPublisher aep = new ApplicationEventPublisher(){
     
    }*/
    final Container base = new ManualContainer();
    base.registerValue("modulename", module_name);
    base.registerValue("timestamp", new Long(System.currentTimeMillis()));
    base.registerValue("classloader", loader);
    base.registerValue("container", yan);
    final NutsProcessor cinterpreter = new NutsProcessor();
    //cinterpreter.setParameterWiring(Modes.params_bytype);
View Full Code Here

Examples of jfun.yan.Container.registerValue()

    final ApplicationEventPublisher aep = new ApplicationEventPublisher(){
     
    }*/
    final Container base = new ManualContainer();
    base.registerValue("modulename", module_name);
    base.registerValue("timestamp", new Long(System.currentTimeMillis()));
    base.registerValue("classloader", loader);
    base.registerValue("container", yan);
    final NutsProcessor cinterpreter = new NutsProcessor();
    //cinterpreter.setParameterWiring(Modes.params_bytype);
    try{
View Full Code Here

Examples of jfun.yan.Container.registerValue()

     
    }*/
    final Container base = new ManualContainer();
    base.registerValue("modulename", module_name);
    base.registerValue("timestamp", new Long(System.currentTimeMillis()));
    base.registerValue("classloader", loader);
    base.registerValue("container", yan);
    final NutsProcessor cinterpreter = new NutsProcessor();
    //cinterpreter.setParameterWiring(Modes.params_bytype);
    try{
      cinterpreter.processResource(appcontext_resource);
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.