本文整理汇总了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();
}
示例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\")");
}