Java Code Examples for org.osgl.inject.Genie#get()
The following examples show how to use
org.osgl.inject.Genie#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GH54.java From java-di with Apache License 2.0 | 6 votes |
@Test public void test() { Genie genie = Genie.create(new Module() { @Override protected void configure() { bind(TypedElementLoader.class).to(new TypedElementLoader() { @Override protected List<Class> load(Class type, boolean loadNonPublic, boolean loadAbstract, boolean loadRoot) { List<Class> list = new ArrayList<>(); list.add(Color.class); return list; } }); } }); GH54 gh54 = genie.get(GH54.class); eq(Color.DarkBlue, gh54.colors.get(Keyword.of("dark-blue"))); }
Example 2
Source File: GH34.java From java-di with Apache License 2.0 | 6 votes |
@Test public void test() { Genie genie = Genie.create(); genie.registerGenericTypedBeanLoader(BaseMapper.class, new GenericTypedBeanLoader<BaseMapper>() { @Override public BaseMapper load(BeanSpec spec) { List<Type> typeParams = spec.typeParams(); if (typeParams.size() > 0) { Type type = typeParams.get(0); if (type.equals(PackItem.class)) { return new ItemMapper(); } } return null; } }); ItemService itemService = genie.get(ItemService.class); notNull(itemService); notNull(itemService.mapper); }
Example 3
Source File: GH56.java From java-di with Apache License 2.0 | 6 votes |
@Test public void test() { Genie genie = Genie.create(new Module() { @Override protected void configure() { bind(TypedElementLoader.class).to(new TypedElementLoader() { @Override protected List<Class> load(Class type, boolean loadNonPublic, boolean loadAbstract, boolean loadRoot) { List<Class> list = new ArrayList<>(); list.add(Color.class); return list; } }); } }); GH56 gh56 = genie.get(GH56.class); eq(3, gh56.colorList.size()); eq(Color.B, gh56.colorLookup.get("B")); }
Example 4
Source File: GH55.java From java-di with Apache License 2.0 | 6 votes |
@Test public void test() { Genie genie = Genie.create(new Module() { @Override protected void configure() { bind(TypedElementLoader.class).to(new TypedElementLoader() { @Override protected List<Class> load(Class type, boolean loadNonPublic, boolean loadAbstract, boolean loadRoot) { List<Class> list = new ArrayList<>(); list.add(Size.class); return list; } }); } }); GH55 gh55 = genie.get(GH55.class); eq(3, gh55.sizes.size()); }
Example 5
Source File: Gh58.java From java-di with Apache License 2.0 | 5 votes |
@Test public void test() { Genie genie = Genie.create(); Integer i = genie.get(Integer.class); BeanSpec fooSpec = BeanSpec.of(Foo.class, genie); no(genie.subjectToInject(fooSpec)); genie.get(Foo.class); no(genie.subjectToInject(fooSpec)); }
Example 6
Source File: GH25.java From java-di with Apache License 2.0 | 5 votes |
@Test public void test() { Genie genie = Genie.create(); genie.registerNamedProvider(Foo.class, new FooProvider()); FooHolder fooHolder = genie.get(FooHolder.class); eq("bar", fooHolder.foo.name); }
Example 7
Source File: GH38.java From java-di with Apache License 2.0 | 5 votes |
@Test public void test() { Genie genie = Genie.create(); LinkedHashMap<String, Integer> map = genie.get(LinkedHashMap.class); notNull(map); yes(map.isEmpty()); }
Example 8
Source File: GH42.java From java-di with Apache License 2.0 | 4 votes |
@Test public void test() { Genie genie = Genie.create(); Order.Dao orderDao = genie.get(Order.Dao.class); notNull(orderDao.accDao); }
Example 9
Source File: GH50.java From java-di with Apache License 2.0 | 4 votes |
@Test public void test() { Genie genie = Genie.create(); genie.get(Me.class); }
Example 10
Source File: GH10.java From java-di with Apache License 2.0 | 4 votes |
@Test public void test() { Genie genie = Genie.create(Binder.class); A a = genie.get(A.class); eq("foo", a.a()); }
Example 11
Source File: GH181.java From java-tool with Apache License 2.0 | 4 votes |
@Test public void test() { Genie genie = Genie.create(); Order.Dao orderDao = genie.get(Order.Dao.class); notNull(orderDao.accDao); }