Package com.github.jsr330.spi

Examples of com.github.jsr330.spi.TypeConfig


    public static Test suite() {
        InitialBinder<?> binder;
        ConfigBuilder builder = new ConfigBuilder();
       
        ClassAnalyser<Map<String, Class<?>[]>> analyser = new InheritanceAnalyser();
        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        binder = builder.get();
       
        binder.instance(Car.class).as(Convertible.class);
View Full Code Here


public class JsonConfigTck {
   
    public static Test suite() throws Exception {
        ClassAnalyser<Map<String, Class<?>[]>> analyser = new InheritanceAnalyser();
        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        JsonConfig config = new JsonConfig(new File("./src/test/resources/tck.json"));
       
        instancer = new DefaultClassInjector(config.getConfig(Thread.currentThread().getContextClassLoader()));
       
View Full Code Here

        InitialBinder<?> binder;
        ConfigBuilder builder = new ConfigBuilder();
       
        ClassAnalyser<Map<String, Class<?>[]>> analyser = new InheritanceAnalyser();
        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        binder = builder.get();
       
        binder.instance(Car.class).as(Convertible.class);
        binder.instance(Seat.class).as(DriversSeat.class).when(qualifierIs(Seat.class, Drivers.class));
View Full Code Here

        }
    }
   
    @Test
    public void simpleBinding() {
        TypeConfig config = defaultBinder.instance(TestInterface.class).as(TestImplementation1.class).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestInterface.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
View Full Code Here

        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
   
    @Test
    public void simpleBindingAsSingleton() {
        TypeConfig config = defaultBinder.instance(TestInterface.class).asSingleton(TestImplementation1.class).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestInterface.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
View Full Code Here

        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
   
    @Test
    public void simpleTypeAsSingleton() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton().build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
View Full Code Here

        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
   
    @Test
    public void simpleType() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
View Full Code Here

        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
   
    @Test
    public void simpleTypeInheritance() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).as(TestImplementation2.class).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation2.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
    }
View Full Code Here

        }
    }
   
    @Test
    public void interfaceWithProvider() {
        TypeConfig config = defaultBinder.instance(TestInterface.class).with(new Provider<TestInterface>() {
           
            @Override
            public TestInterface get() {
                return new TestImplementation1();
            }
           
        }).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestInterface.class, null, null, null);
        assertNotNull(container);
        assertNotNull(container.getProvider());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.PROVIDER, container.getInstanceMode());
    }
View Full Code Here

        assertEquals(InstanceMode.PROVIDER, container.getInstanceMode());
    }
   
    @Test
    public void simpleTypeWithProvider() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).with(new Provider<TestImplementation1>() {
           
            @Override
            public TestImplementation1 get() {
                return new TestImplementation1();
            }
           
        }).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertNotNull(container.getProvider());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.PROVIDER, container.getInstanceMode());
    }
View Full Code Here

TOP

Related Classes of com.github.jsr330.spi.TypeConfig

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.