本文整理汇总了Java中javax.mail.search.FromStringTerm类的典型用法代码示例。如果您正苦于以下问题:Java FromStringTerm类的具体用法?Java FromStringTerm怎么用?Java FromStringTerm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FromStringTerm类属于javax.mail.search包,在下文中一共展示了FromStringTerm类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFieldSearchTerm
import javax.mail.search.FromStringTerm; //导入依赖的package包/类
private SearchTerm createFieldSearchTerm(String f) {
switch (f.toLowerCase()) {
case "from":
return new FromStringTerm(matchingText);
case "cc":
return new RecipientStringTerm(Message.RecipientType.CC, matchingText);
case "to":
return new RecipientStringTerm(Message.RecipientType.TO, matchingText);
case "body":
return new BodyTerm(matchingText);
case "subject":
return new SubjectTerm(matchingText);
default:
return null;
}
}
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:17,代码来源:Rule.java
示例2: multipleFieldsShouldReturnOrTerm
import javax.mail.search.FromStringTerm; //导入依赖的package包/类
@Test
public void multipleFieldsShouldReturnOrTerm() {
final Set fields = new HashSet();
fields.add("to");
fields.add("from");
fields.add("cc");
Rule rule = Rule.create()
.sourceFolder("INBOX")
.matchingText("testText")
.fields(fields);
SearchTerm term = rule.getSearchTerm();
Assert.assertTrue(term instanceof OrTerm);
SearchTerm[] terms = ((OrTerm) term).getTerms();
for (SearchTerm t : terms) {
Assert.assertTrue(t instanceof FromStringTerm
|| (t instanceof RecipientStringTerm && ((RecipientStringTerm) t).getRecipientType() == Message.RecipientType.CC)
|| (t instanceof RecipientStringTerm && ((RecipientStringTerm) t).getRecipientType() == Message.RecipientType.TO));
}
}
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:21,代码来源:RuleTest.java
示例3: setSenderTerm
import javax.mail.search.FromStringTerm; //导入依赖的package包/类
/**
* Set filter on message sender.
* @param sender messages will be filtered on sender
* @param notTerm negate condition
*/
public void setSenderTerm(String sender, boolean notTerm) {
if (!Const.isEmpty(sender)) {
if(notTerm)
addSearchTerm(new NotTerm(new FromStringTerm(sender)));
else
addSearchTerm(new FromStringTerm(sender));
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:14,代码来源:MailConnection.java
示例4: setSenderTerm
import javax.mail.search.FromStringTerm; //导入依赖的package包/类
/**
* Set filter on message sender.
*
* @param sender
* messages will be filtered on sender
* @param notTerm
* negate condition
*/
public void setSenderTerm( String sender, boolean notTerm ) {
if ( !Utils.isEmpty( sender ) ) {
if ( notTerm ) {
addSearchTerm( new NotTerm( new FromStringTerm( sender ) ) );
} else {
addSearchTerm( new FromStringTerm( sender ) );
}
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:18,代码来源:MailConnection.java
示例5: from
import javax.mail.search.FromStringTerm; //导入依赖的package包/类
public SearchTermBuilder from(Op op, String pattern) {
SearchTerm st = new FromStringTerm(pattern);
addTerm(op, st);
return this;
}
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:SearchTermBuilder.java
注:本文中的javax.mail.search.FromStringTerm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论