当前位置: 首页>>代码示例>>Java>>正文


Java Ioc类代码示例

本文整理汇总了Java中org.bridje.ioc.Ioc的典型用法代码示例。如果您正苦于以下问题:Java Ioc类的具体用法?Java Ioc怎么用?Java Ioc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Ioc类属于org.bridje.ioc包,在下文中一共展示了Ioc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Override
public void execute(@NotNull Args args, @NotNull Writer writer) throws IOException
{
    Command[] commands = Ioc.context().findAll(Command.class);
    writer.write(String.format("devEnv version %s\n", findVersion()));
    writer.write("Commands:\n");
    for (Command command : commands)
    {
        writer.write(" - " + String.join("|", command.alias()));
        String value = command.value();
        if (value != null)
        {
            writer.write(" " + value.toUpperCase());
        }
        writer.write(String.format(" (%s)\n", command.description()));
    }
}
 
开发者ID:miche-atucha,项目名称:devenv,代码行数:18,代码来源:UsageCommand.java

示例2: getValueForField

import org.bridje.ioc.Ioc; //导入依赖的package包/类
private Object getValueForField(Field field, SQLEnvironment env)
{
    if(field.getType() == EntityContext.class)
    {
        return this;
    }
    else if(field.getType() == SQLEnvironment.class)
    {
        return env;
    }
    else 
    {
        if(config.contains(field.getType()))
        {
            return getModel(field.getType());
        }
        else
        {
            return Ioc.context().findGeneric(field.getGenericType());
        }
    }
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:23,代码来源:ORMEnvironmentImpl.java

示例3: getIncludeModels

import org.bridje.ioc.Ioc; //导入依赖的package包/类
public List<ModelInf> getIncludeModels()
{
    SrcGenService srcGen = Ioc.context().find(SrcGenService.class);
    if(includeModels == null)
    {
        includeModels = new ArrayList<>();
        for (String include : getIncludes())
        {
            try
            {
                ModelInf model = srcGen.readFile(new VFile(SrcGenService.SUPL_PATH.join(include)), ModelInf.class);
                includeModels.add(model);
            }
            catch (IOException e)
            {
                LOG.log(Level.SEVERE, e.getMessage(), e);
            }
        }
    }
    return includeModels;
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:22,代码来源:ModelInf.java

示例4: selectAll

import org.bridje.ioc.Ioc; //导入依赖的package包/类
private void selectAll()
{
    JdbcService jdbcServ = Ioc.context().find(JdbcService.class);
    DataSource dataSource = jdbcServ.getDataSource(DS_NAME);
    try (Connection connection = dataSource.getConnection(); Statement stmt = connection.createStatement())
    {
        String sql = "SELECT * FROM my_table;";
        LOG.log(Level.INFO, "{0}{1}", new Object[]{sql, connection.toString()});
        ResultSet resultSet = stmt.executeQuery(sql);
        while(resultSet.next())
        {
            //Parse Data
        }
    }
    catch (SQLException e)
    {
        LOG.log(Level.SEVERE, e.getMessage(), e);
    }
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:20,代码来源:JdbcServiceTest.java

示例5: runSomeQuerys

import org.bridje.ioc.Ioc; //导入依赖的package包/类
private void runSomeQuerys(int minId, int maxId)
{
    JdbcService jdbcServ = Ioc.context().find(JdbcService.class);
    DataSource dataSource = jdbcServ.getDataSource(DS_NAME);
    try (Connection connection = dataSource.getConnection())
    {
        LOG.log(Level.INFO, "Inserting Data {0}-{1}, Connection: {2}", new Object[]{minId, maxId, connection.toString()});
        for(int i = minId; i <= maxId; i++)
        {
            try (Statement stmt = connection.createStatement())
            {
                String sql = "INSERT INTO my_table (id, name) VALUES (" + i + ", \'" + UUID.randomUUID().toString() + "\');";
                stmt.execute(sql);
            }
        }
    }
    catch (SQLException ex)
    {
        LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:22,代码来源:JdbcServiceTest.java

示例6: findCommand

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Nullable
private static Command findCommand(@NotNull String name)
{
    Command[] commands = Ioc.context().findAll(Command.class);
    for (Command command : commands)
    {
        if (command.alias().contains(name))
        {
            return command;
        }
    }
    return null;
}
 
开发者ID:miche-atucha,项目名称:devenv,代码行数:14,代码来源:Main.java

示例7: execute

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Override
public void execute(@NotNull Args args, @NotNull Writer writer) throws IOException
{
    String tool = args.value();
    if (tool == null)
    {
        writer.write("Tool parameter is required!");
        return;
    }
    ToolProvider[] toolProviders = Ioc.context().findAll(ToolProvider.class);
    ToolProvider toolProvider = null;
    for (ToolProvider toolProv : toolProviders)
    {
        if (toolProv.id().equals(tool))
        {
            toolProvider = toolProv;
            break;
        }
    }
    if (toolProvider == null)
    {
        writer.write(String.format("Tool %s not found!", tool));
    }
    else
    {
        install(toolProvider, writer);
    }
}
 
开发者ID:miche-atucha,项目名称:devenv,代码行数:29,代码来源:InstallCommand.java

示例8: execute

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Override
public void execute(@NotNull Args args, @NotNull Writer writer) throws IOException
{
    ToolProvider[] toolProviders = Ioc.context().findAll(ToolProvider.class);
    writer.write("Tools:\n");
    for (ToolProvider toolProvider : toolProviders)
    {
        writer.write(String.format(" - %s\n", toolProvider.id()));
    }
}
 
开发者ID:miche-atucha,项目名称:devenv,代码行数:11,代码来源:ListToolsCommand.java

示例9: start

import org.bridje.ioc.Ioc; //导入依赖的package包/类
private static void start() throws Exception
{
    System.out.println("Starting Kasije, path context: " + new File(".").getAbsoluteFile().getPath() + "...");

    IocContext context = Ioc.context();
    KasijeServer server = context.find(KasijeServer.class);

    initMBeans(context);
    server.start();
    System.out.println("Server started!");
    server.join();
}
 
开发者ID:touwolf,项目名称:kasije,代码行数:13,代码来源:Main.java

示例10: init

import org.bridje.ioc.Ioc; //导入依赖的package包/类
/**
 * Component Initializer
 */
@PostConstruct
public void init()
{
    themeTools = new HashMap<>();
    context.getClassRepository()
            .forEachClass(ThemeTool.class, (cls, ann) -> themeTools.put(ann.name(), context.find(cls)) );
    ftlCfg = new Configuration(Configuration.VERSION_2_3_23);
    ftlCfg.setTemplateLoader(Ioc.context().find(ThemesTplLoader.class));
    ftlCfg.setDefaultEncoding("UTF-8");
    ftlCfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
    ftlCfg.setLogTemplateExceptions(false);
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:16,代码来源:ThemesManager.java

示例11: WebMethodData

import org.bridje.ioc.Ioc; //导入依赖的package包/类
public WebMethodData(String expression, Class<?> component, Method method)
{
    this.expression = expression;
    this.component = component;
    this.method = method;
    this.regExp = toRegExp(expression);
    this.elServ = Ioc.context().find(ElService.class);
    pattern = Pattern.compile(regExp);
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:10,代码来源:WebMethodData.java

示例12: channelRead0

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, SipRequest msg) throws Exception
{
    RootSipBridlet rootBridlet = Ioc.context().find(RootSipBridlet.class);
    SipResponse resp = rootBridlet.handle(msg);
    resp.setRecipient(msg.getSender());
    msg.getHeaders()
                .entrySet().stream()
                .filter(e -> !resp.getHeaders().containsKey(e.getKey()))
                .forEach(e -> resp.getHeaders().put(e.getKey(), e.getValue()));
    ctx.channel().writeAndFlush(resp);
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:13,代码来源:SipServerChannelHandler.java

示例13: testEval

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Test
public void testEval()
{
    ElService elServ = Ioc.context().find(ElService.class);
    ElEnvironment elEnv = elServ.createElEnvironment(Ioc.context());
    String result = elEnv.get("${myModel.name}", String.class);
    assertNotNull(result);
    assertEquals("Some Name", result);
    List lst = elEnv.get("${myModel.list}", List.class);
    assertNotNull(lst);
    assertEquals(1, lst.size());
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:13,代码来源:ElServiceTest.java

示例14: testVars

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Test
public void testVars()
{
    ElService elServ = Ioc.context().find(ElService.class);
    ElEnvironment elEnv = elServ.createElEnvironment(Ioc.context());

    elEnv.pushVar("myVar", "Hello");
    String result = elEnv.get("${myVar}", String.class);
    assertNotNull(result);
    assertEquals("Hello", result);

    elEnv.pushVar("myVar", "Hello 1");
    result = elEnv.get("${myVar}", String.class);
    assertNotNull(result);
    assertEquals("Hello 1", result);

    elEnv.pushVar("myVar", "Hello 2");
    result = elEnv.get("${myVar}", String.class);
    assertNotNull(result);
    assertEquals("Hello 2", result);

    elEnv.popVar("myVar");
    result = elEnv.get("${myVar}", String.class);
    assertNotNull(result);
    assertEquals("Hello 1", result);

    elEnv.popVar("myVar");
    result = elEnv.get("${myVar}", String.class);
    assertNotNull(result);
    assertEquals("Hello", result);

    elEnv.pushVar("myList", new ArrayList<>());
    List lst = elEnv.get("${myList}", List.class);
    assertNotNull(lst);
    assertEquals(0, lst.size());
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:37,代码来源:ElServiceTest.java

示例15: testI18n

import org.bridje.ioc.Ioc; //导入依赖的package包/类
@Test
public void testI18n()
{
    ElService elServ = Ioc.context().find(ElService.class);
    ElEnvironment elEnv = elServ.createElEnvironment(Ioc.context());
    String result = elEnv.get("${i18n.someRes.name}", String.class);
    assertNotNull(result);
    assertEquals("Hola", result);
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:10,代码来源:ElServiceTest.java


注:本文中的org.bridje.ioc.Ioc类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。