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


Java Description类代码示例

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


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

示例1: runAssertionEscapeString

import com.espertech.esper.client.annotation.Description; //导入依赖的package包/类
private void runAssertionEscapeString(EPServiceProvider epService) {
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);

    // The following EPL syntax compiles but fails to match a string "A'B", we are looking into:
    // EPStatement stmt = epService.getEPAdministrator().createEPL("select * from SupportBean(string='A\\\'B')");

    tryEscapeMatch(epService, "A'B", "\"A'B\"");       // opposite quotes
    tryEscapeMatch(epService, "A'B", "'A\\'B'");      // escape '
    tryEscapeMatch(epService, "A'B", "'A\\u0027B'");   // unicode

    tryEscapeMatch(epService, "A\"B", "'A\"B'");       // opposite quotes
    tryEscapeMatch(epService, "A\"B", "'A\\\"B'");      // escape "
    tryEscapeMatch(epService, "A\"B", "'A\\u0022B'");   // unicode

    EPStatement stmt = epService.getEPAdministrator().createEPL("@Name('A\\\'B') @Description(\"A\\\"B\") select * from SupportBean");
    assertEquals("A\'B", stmt.getName());
    Description desc = (Description) stmt.getAnnotations()[1];
    assertEquals("A\"B", desc.value());
    stmt.destroy();

    stmt = epService.getEPAdministrator().createEPL("select 'volume' as field1, \"sleep\" as field2, \"\\u0041\" as unicodeA from SupportBean");
    SupportUpdateListener testListener = new SupportUpdateListener();
    stmt.addListener(testListener);
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertProps(testListener.assertOneGetNewAndReset(), new String[]{"field1", "field2", "unicodeA"}, new Object[]{"volume", "sleep", "A"});
    stmt.destroy();

    tryStatementMatch(epService, "John's", "select * from SupportBean(theString='John\\'s')");
    tryStatementMatch(epService, "John's", "select * from SupportBean(theString='John\\u0027s')");
    tryStatementMatch(epService, "Quote \"Hello\"", "select * from SupportBean(theString like \"Quote \\\"Hello\\\"\")");
    tryStatementMatch(epService, "Quote \"Hello\"", "select * from SupportBean(theString like \"Quote \\u0022Hello\\u0022\")");

    epService.getEPAdministrator().destroyAllStatements();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:35,代码来源:ExecEPLSelectExpr.java

示例2: testEscapeString

import com.espertech.esper.client.annotation.Description; //导入依赖的package包/类
public void testEscapeString()
{
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);

    // The following EPL syntax compiles but fails to match a string "A'B", we are looking into:
    // EPStatement stmt = epService.getEPAdministrator().createEPL("select * from SupportBean(string='A\\\'B')");

    tryEscapeMatch("A'B", "\"A'B\"");       // opposite quotes
    tryEscapeMatch("A'B", "'A\\'B'");      // escape '
    tryEscapeMatch("A'B", "'A\\u0027B'");   // unicode

    tryEscapeMatch("A\"B", "'A\"B'");       // opposite quotes
    tryEscapeMatch("A\"B", "'A\\\"B'");      // escape "
    tryEscapeMatch("A\"B", "'A\\u0022B'");   // unicode

    EPStatement stmt = epService.getEPAdministrator().createEPL("@Name('A\\\'B') @Description(\"A\\\"B\") select * from SupportBean");
    assertEquals("A\'B", stmt.getName());
    Description desc = (Description) stmt.getAnnotations()[1];
    assertEquals("A\"B", desc.value());
    stmt.destroy();

    stmt = epService.getEPAdministrator().createEPL("select 'volume' as field1, \"sleep\" as field2, \"\\u0041\" as unicodeA from SupportBean");
    stmt.addListener(testListener);
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertProps(testListener.assertOneGetNewAndReset(), new String[]{"field1", "field2", "unicodeA"}, new Object[]{"volume", "sleep", "A"});
    stmt.destroy();

    tryStatementMatch("John's", "select * from SupportBean(theString='John\\'s')");
    tryStatementMatch("John's", "select * from SupportBean(theString='John\\u0027s')");
    tryStatementMatch("Quote \"Hello\"", "select * from SupportBean(theString like \"Quote \\\"Hello\\\"\")");
    tryStatementMatch("Quote \"Hello\"", "select * from SupportBean(theString like \"Quote \\u0022Hello\\u0022\")");
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:33,代码来源:TestSelectExpr.java


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