本文整理汇总了Java中org.supercsv.cellprocessor.ParseLong类的典型用法代码示例。如果您正苦于以下问题:Java ParseLong类的具体用法?Java ParseLong怎么用?Java ParseLong使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseLong类属于org.supercsv.cellprocessor包,在下文中一共展示了ParseLong类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProcessors
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
/** This method returns array of cellprocessor for parsing csv.
* @return CellProcessor[] array
* */
private CellProcessor[] getProcessors(){
CellProcessor[] processors = new CellProcessor[]{
new NotNull(new ParseLong()), //instrument_token
new NotNull(new ParseLong()), //exchange_token
new NotNull(), //trading_symbol
new Optional(), //company name
new NotNull(new ParseDouble()), //last_price
new Optional(), //expiry
new Optional(), //strike
new NotNull(new ParseDouble()), //tick_size
new NotNull(new ParseInt()), //lot_size
new NotNull(), //instrument_type
new NotNull(), //segment
new NotNull() //exchange
};
return processors;
}
示例2: getCellProcessors
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
/**
* Provide this array to parse the columns of the csv into the right type using the Super CSV framework.
*
* @return
*/
public static CellProcessor[] getCellProcessors(){
return new CellProcessor[] {
new ParseInt(){
@Override
public Object execute(Object value, CsvContext context) {
String content = value.toString();
String[] split = content.split("\\$");
return super.execute(split[1], context);
}
},
new ParseLong(),
null,
null,
new ParseLong(),
new ParseLong(),
new ParseLong(),
null,
new ParseInt(),
new ParseInt()
};
}
示例3: getProcessors
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
private static CellProcessor[] getProcessors() {
final CellProcessor[] processors = new CellProcessor[] {new NotNull(new ParseLong()), // EventId
new NotNull(new ParseLong()), // CaseId
new NotNull(), // Timestamp
new NotNull(), // Activity
new NotNull(), // Resource
new NotNull(), // State
new Optional(), // MessageType
new Optional(), // Recipient
new Optional() // Sender
};
return processors;
}
示例4: initialise
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
public void initialise(String[] properties, CellProcessor[] processors)
{
for (int i = 0; i < getFields().size(); i++) {
FIELD_TYPE type = getFields().get(i).type;
properties[i] = getFields().get(i).name;
if (type == FIELD_TYPE.DOUBLE) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.INTEGER) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.FLOAT) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.LONG) {
processors[i] = new Optional(new ParseLong());
} else if (type == FIELD_TYPE.SHORT) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.STRING) {
processors[i] = new Optional();
} else if (type == FIELD_TYPE.CHARACTER) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.BOOLEAN) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.DATE) {
processors[i] = new Optional(new ParseDate("dd/MM/yyyy"));
}
}
}
示例5: addParseLong
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
/**
* Get cellprocessor to parse String as Long.
*
* @param cellProcessor
* next processor in the chain.
* @return CellProcessor
*/
private static CellProcessor addParseLong(CellProcessor cellProcessor)
{
if (cellProcessor == null) {
return new ParseLong();
}
return new ParseLong((LongCellProcessor)cellProcessor);
}
示例6: test4
import org.supercsv.cellprocessor.ParseLong; //导入依赖的package包/类
public static void test4(RandomLineAccessFile file) throws Exception{
CsvMapReader reader = new CsvMapReader(file.getReader(), CsvPreference.STANDARD_PREFERENCE);
String[] header = reader.getCSVHeader(false);
for(String s : header) System.out.print(s + "|");
System.out.println();
CellProcessor[] processor = new CellProcessor[]{new Optional(), new ParseDouble(), new ParseLong(), new Optional(), new Optional(), new Optional()};
Map<String, ? super Object> row = reader.read(header, processor);
while(row != null && row.size() != 0){
for(Object data : row.values()) System.out.print(data + "|");
row = reader.read(header, processor);
System.out.println();
}
reader.close();
}