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


Java Optional类代码示例

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


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

示例1: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的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: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
private static CellProcessor[] getProcessors() {
    final CellProcessor[] processors = new CellProcessor[]{
            new ParseInt(), // id (must be unique)
            new NotNull(), // address
            new NotNull(), // horario
            new ParseDouble(), //lat
            new ParseDouble(), //long
            new NotNull(), // name
            new Optional(), // phone
            new Optional(), // locality
            new Optional(), // province
            new Optional(), // postal_code

    };
    return processors;
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:17,代码来源:CsvReader.java

示例3: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
public static CellProcessor[] getProcessors(List<String> fields) {

		int fieldsSize = fields.size();
		final CellProcessor[] processors = new CellProcessor[fieldsSize];
		int i = 0;
		for(String field : fields){
			if(Arrays.asList(processorsDateType).contains(field)){
				processors[i] =  new Optional(new FmtDate("dd-MM-yyyy HH:mm"));
			}else{
				processors[i] = new ConvertNullTo("");
			}
			i++;
		}

		return processors;
	}
 
开发者ID:EsupPortail,项目名称:esup-sgc,代码行数:17,代码来源:ImportExportService.java

示例4: create

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<com.github.dmn1k.supercsv.io.declarative.annotation.Optional> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new Optional(next);
        }
    };
}
 
开发者ID:dmn1k,项目名称:super-csv-declarative,代码行数:19,代码来源:OptionalCellProcessorProvider.java

示例5: getDetailedProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
public static CellProcessor[] getDetailedProcessors(String[] header) {
    final CellProcessor[] PROCESSORS;
    if (headerContainsBlendedCost(header)) {
        PROCESSORS = new CellProcessor[] { new Optional(), new Optional(), new Optional(),
                new Optional(),
                new Optional(), new Optional(), new Optional(), new Optional(), new Optional(),
                new Optional(),
                new Optional(), new Optional(), new Optional(), new Optional(),
                new Optional(new ParseLocalDateTimeInDetailedCsv()),
                new Optional(new ParseLocalDateTimeInDetailedCsv()), new Optional(),
                new Optional(), new Optional(),
                new Optional(), new Optional(), new Optional() };
    } else {
        PROCESSORS = new CellProcessor[] { new Optional(), new Optional(), new Optional(),
                new Optional(),
                new Optional(), new Optional(), new Optional(), new Optional(), new Optional(),
                new Optional(),
                new Optional(), new Optional(), new Optional(), new Optional(),
                new Optional(new ParseLocalDateTimeInDetailedCsv()),
                new Optional(new ParseLocalDateTimeInDetailedCsv()), new Optional(),
                new Optional(), new Optional(),
                new Optional() };
    }

    return PROCESSORS;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:27,代码来源:AWSCsvBillParser.java

示例6: getCellProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
private CellProcessor[] getCellProcessors() {
    return new CellProcessor[]{
            //@formatter:off
            null,                                  // airport ID
            new Optional(),                        // name
            new Optional(),                        // city
            new Optional(),                        // country
            new Optional(new ParseAirportCode()),  // iataCode
            new Optional(new ParseAirportCode()),  // icaoCode
            new Optional(new ParseDouble()),       // latitude
            new Optional(new ParseDouble()),       // longitude
            null,                                  // altitude
            null,                                  // Timezone
            null,                                  // DST
            null,                                  // Tz database time zone
            null,                                  // Type
            null,                                  // Source
            //@formatter:on
    };

}
 
开发者ID:Educama,项目名称:Showcase,代码行数:22,代码来源:AirportCsvDeserializer.java

示例7: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的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;
}
 
开发者ID:zerodhatech,项目名称:javakiteconnect,代码行数:21,代码来源:KiteConnect.java

示例8: getMfProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/** This method returns array of cellprocessor for parsing mutual funds csv.
 * @return CellProcessor[] array
 * */
private CellProcessor[] getMfProcessors(){
    CellProcessor[] processors = new CellProcessor[]{
            new Optional(),                  //tradingsymbol
            new Optional(),                  //amc
            new Optional(),                  //name
            new Optional(new ParseInt()),    //purchase_allowed
            new Optional(new ParseInt()),    //redemption_allowed
            new Optional(new ParseDouble()), //minimum_purchase_amount
            new Optional(new ParseDouble()), //purchase_amount_multiplier
            new Optional(new ParseDouble()), //minimum_additional_purchase_amount
            new Optional(new ParseDouble()), //minimum_redemption_quantity
            new Optional(new ParseDouble()), //redemption_quantity_multiplier
            new Optional(),                  //dividend_type
            new Optional(),                  //scheme_type
            new Optional(),                  //plan
            new Optional(),                  //settlement_type
            new Optional(new ParseDouble()), //last_price
            new Optional()                   //last_price_date
    };
    return processors;
}
 
开发者ID:zerodhatech,项目名称:javakiteconnect,代码行数:25,代码来源:KiteConnect.java

示例9: buildCellProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
private CellProcessor[] buildCellProcessors(final JsonArray fields) {
    CellProcessor[] processors = new CellProcessor[fields.size()];
    for (int i = 0; i < fields.size(); i++) {
        JsonArray def = fields.get(i);
        String fieldName = def.get(0);

        // Any cell processing definitions?
        int len = def.size();
        if (len > 1) {
            CellProcessor nextProcessor = null;
            for (int j = (len - 1); j > 0; j--) {
                String procDef = def.get(j);
                processors[i] = buildCellProcessor(nextProcessor, fieldName, procDef);
                nextProcessor = processors[i];
            }
        } else {

            // Nope, use "Optional" as default
            processors[i] = new Optional();
        }
    }
    return processors;
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:24,代码来源:DsvLineParser.java

示例10: getProcessor

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/**
 * Returns array of cellprocessors, one for each field
 */
private CellProcessor[] getProcessor(List<Field> fields)
{
  CellProcessor[] processor = new CellProcessor[fields.size()];
  int fieldCount = 0;
  for (Field field : fields) {
    if (field.getType() == FieldType.DATE) {
      String format = field.getConstraints().get(DelimitedSchema.DATE_FORMAT) == null ? null
          : (String)field.getConstraints().get(DelimitedSchema.DATE_FORMAT);
      processor[fieldCount++] = new Optional(new FmtDate(format == null ? "dd/MM/yyyy" : format));
    } else {
      processor[fieldCount++] = new Optional();
    }
  }
  return processor;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:19,代码来源:CsvFormatter.java

示例11: genProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/** Generates the cell processors used to parse the CSV file */
	private void genProcessors(){
		// Generate cell processors from class types
		processors = new CellProcessor[header.length];
		for(int i = 0; i < header.length; i++){
/*			if(Constants.DATA_TYPES.get(header[i]) == Data0D.Integer.class)
				processors[i] = new ParseInt();
			else if(Constants.DATA_TYPES.get(header[i]) == Data0D.Double.class)
				processors[i] = new ParseDouble();
			else if(Constants.getType(header[i]) == Data1D.Integer.class)
				processors[i] = new ParseInt();
			else if(Constants.getType(header[i]) == Data1D.Double.class)
				processors[i] = new ParseDouble();
			// All other data types get String processors
			else
*/				processors[i] = new Optional();
		}
	}
 
开发者ID:Cride5,项目名称:jablus,代码行数:19,代码来源:CSVFile.java

示例12: StateDataReader

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
public StateDataReader() {
    super(new CellProcessor[]{ //
                               INT, // id
                               NOT_NULL, // name
                               NOT_NULL, // abbreviation
                               NOT_NULL, // country
                               NOT_NULL, // type
                               INT, // sort
                               NOT_NULL, // status
                               NOT_NULL, // occupied
                               new Optional(), // notes
                               INT, // fips_state
                               NOT_NULL, // assoc_press
                               NOT_NULL, // standard_federal_region
                               INT, // census_region
                               NOT_NULL, // census_region_name
                               INT, // census_division
                               NOT_NULL, // census_devision_name
                               INT // circuit_court
    }, State.class);
}
 
开发者ID:noctarius,项目名称:hazelcast-mapreduce-presentation,代码行数:22,代码来源:StateDataReader.java

示例13: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/**
 * Sets up the processors used for the examples. There are 10 CSV columns, so 10 processors are defined. All values
 * are converted to Strings before writing (there's no need to convert them), and null values will be written as
 * empty columns (no need to convert them to "").
 * 
 * @return the cell processors
 */
private static CellProcessor[] getProcessors() {
	
	final CellProcessor[] processors = new CellProcessor[] { new UniqueHashCode(), // customerNo (must be unique)
		new NotNull(), // firstName
		new NotNull(), // lastName
		new FmtDate("dd/MM/yyyy"), // birthDate
		new NotNull(), // mailingAddress
		new Optional(new FmtBool("Y", "N")), // married
		new Optional(), // numberOfKids
		new NotNull(), // favouriteQuote
		new NotNull(), // email
		new LMinMax(0L, LMinMax.MAX_LONG) // loyaltyPoints
	};
	
	return processors;
}
 
开发者ID:super-csv,项目名称:super-csv,代码行数:24,代码来源:Writing.java

示例14: getProcessors

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
private static CellProcessor[] getProcessors() {

		final CellProcessor[] processors = new CellProcessor[] {
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				new Optional(new FmtDate("dd/MM/yyyy - HH:mm")),
				new Optional(new FmtDate("dd/MM/yyyy - HH:mm")),
				null,
				new Optional(new FmtDate("dd/MM/yyyy - HH:mm"))
		};

		return processors;
	}
 
开发者ID:EsupPortail,项目名称:esup-dematec,代码行数:20,代码来源:CsvService.java

示例15: buildSchema

import org.supercsv.cellprocessor.Optional; //导入依赖的package包/类
/**
 * Create a schema instance with the fields properly typed and ordered
 *
 * @throws ConfigException schema configuration error
 */
protected void buildSchema() throws ConfigException {

    if (!this.includeOffsets) {
        //field_order.add("start");
        //field_order.add("end");
        //} else {
        fieldOrder.remove("start");
        fieldOrder.remove("end");
    }

    outputSchema = new CellProcessor[fieldOrder.size()];
    header = new String[fieldOrder.size()];
    fieldOrder.toArray(header);

    for (int x = 0; x < fieldOrder.size(); ++x) {
        outputSchema[x] = new Optional();
    }

    this.fieldSet.addAll(fieldOrder);
}
 
开发者ID:OpenSextant,项目名称:Xponents,代码行数:26,代码来源:CSVFormatter.java


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