本文整理汇总了Java中org.supercsv.cellprocessor.constraint.StrRegEx类的典型用法代码示例。如果您正苦于以下问题:Java StrRegEx类的具体用法?Java StrRegEx怎么用?Java StrRegEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StrRegEx类属于org.supercsv.cellprocessor.constraint包,在下文中一共展示了StrRegEx类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getProcessors
import org.supercsv.cellprocessor.constraint.StrRegEx; //导入依赖的package包/类
/**
* Sets up the processors used for the examples. There are 10 CSV columns, so 10 processors are defined. Empty
* columns are read as null (hence the NotNull() for mandatory columns).
*
* @return the cell processors
*/
private static CellProcessor[] getProcessors() {
final String emailRegex = "[a-z0-9\\._][email protected][a-z0-9\\.]+"; // just an example, not very robust!
StrRegEx.registerMessage(emailRegex, "must be a valid email address");
final CellProcessor[] processors = new CellProcessor[] { new UniqueHashCode(), // customerNo (must be unique)
new NotNull(), // firstName
new NotNull(), // lastName
new ParseDate("dd/MM/yyyy"), // birthDate
new NotNull(), // mailingAddress
new Optional(new ParseBool()), // married
new Optional(new ParseInt()), // numberOfKids
new NotNull(), // favouriteQuote
new StrRegEx(emailRegex), // email
new LMinMax(0L, LMinMax.MAX_LONG) // loyaltyPoints
};
return processors;
}
开发者ID:super-csv,项目名称:super-csv,代码行数:26,代码来源:Reading.java
示例2: getNewProcessors
import org.supercsv.cellprocessor.constraint.StrRegEx; //导入依赖的package包/类
/**
* used for reading new cvs files
*/
public CellProcessor[] getNewProcessors() {
final String emailRegex = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
StrRegEx.registerMessage(emailRegex, "must be a valid email address");
final CellProcessor[] processors = new CellProcessor[] { new Unique(), // email
null, // lastname no conditions apply
null, // firstname no conditions apply
new Unique(), // memberNumber
new Unique() // accreditation
};
return processors;
}
开发者ID:SMVBE,项目名称:ldadmin,代码行数:19,代码来源:LFMemberServiceImpl.java
示例3: getProcessors
import org.supercsv.cellprocessor.constraint.StrRegEx; //导入依赖的package包/类
/**
* Sets up the CSV processors for loading and saving data
*
* @return the cell processors
*/
private static CellProcessor[] getProcessors() {
final String emailRegex = "[a-z0-9\\._][email protected][a-z0-9\\.]+"; // just an example, not very robust!
StrRegEx.registerMessage(emailRegex, "must be a valid email address");
final CellProcessor[] processors = new CellProcessor[] {
new UniqueHashCode(), // score id (must be unique)
new NotNull(), // initials
new NotNull(), // emails
new ParseInt(), // completeTime
new ParseInt() // regionId
};
return processors;
}
开发者ID:cacheflowe,项目名称:haxademic,代码行数:21,代码来源:CsvTest.java
示例4: getProcessors
import org.supercsv.cellprocessor.constraint.StrRegEx; //导入依赖的package包/类
private static CellProcessor[] getProcessors() {
final String emailRegex = "[a-z0-9\\._][email protected][a-z0-9\\.]+"; // just an example, not very robust!
StrRegEx.registerMessage(emailRegex, "must be a valid email address");
final CellProcessor[] processors = new CellProcessor[] {
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(), //10
new Optional(),//11
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(), //20
new Optional(), //21
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(new ParseDouble()),// 26 // Direct Labor Rate
new Optional(new ParseDouble()), //27 // hours
new Optional(),
new Optional(),
new Optional(new ParseDouble()), //30 - Fringe Rate
new Optional(), //31
new Optional(new ParseDouble()), // OH Rate
new Optional(),
new Optional(new ParseDouble()), // GAA Rate
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new ParseDate("MM/dd/yyyy"), // date
new Optional(), //40
new Optional(), //41
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),
new Optional(),//50
new Optional()
/*new ParseDate("dd/MM/yyyy"), // birthDate
new Optional(), // mailingAddress
new Optional(new ParseBool()), // married
new Optional(new ParseInt()), // numberOfKids
new Optional(), // favouriteQuote*/
};
return processors;
}
开发者ID:SEMOSS,项目名称:semoss,代码行数:68,代码来源:JCRReader.java
注:本文中的org.supercsv.cellprocessor.constraint.StrRegEx类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论