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


Java NotNull类代码示例

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


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

示例1: getProcessors

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

示例4: loadData

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
public void loadData() {
	System.out.println("Loading the Data");
	// load the current transactions
	String[] nameMapping = new String[] { "customerId", "productId",
			"quantity", "retailPrice", "id", "markUp", "orderStatus" };
	CellProcessor[] processors = new CellProcessor[] { new NotNull(),// customerId
			new NotNull(),// productId
			new ParseInt(),// quantity
			new ParseDouble(),// retailsPrice
			new NotNull(),// transactionId
			new ParseDouble(),// markUp
			new NotNull() // order status
	};
	loadCurrentTransactions("current_transactions.csv", nameMapping,
			processors);
	System.out
			.println("*************************************************************");
	System.out
			.println("********************PLAYING TRANSACTIONS*********************");
	System.out
			.println("*************************************************************");
	start();
}
 
开发者ID:Pivotal-Open-Source-Hub,项目名称:geode-demo-application,代码行数:24,代码来源:CacheLoader.java

示例5: getProcessors

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

示例6: testConvertsToBasicObjects

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
@Test
public void testConvertsToBasicObjects() throws Exception {
	String csv = "Connor|John|16|1999-07-12|6" + decimalFormatSymbols.getDecimalSeparator() + "65\r\n";
	String[] mapping = { "lastName", "firstName", "age", "birthDate", "savings" };
	CellProcessor[] processors = { new NotNull(), new NotNull(), new ParseInt(), new ParseDate("yyyy-MM-dd"),
		new ParseBigDecimal(decimalFormatSymbols) };
	
	CsvPreference customPreference = new Builder('"', '|', "\r\n").build();
	CsvBeanReader beanReader = new CsvBeanReader(new StringReader(csv), customPreference);
	FeatureBean character = beanReader.read(FeatureBean.class, mapping, processors);
	
	Assert.assertNotNull(character);
	Assert.assertEquals("John", character.getFirstName());
	Assert.assertEquals("Connor", character.getLastName());
	Assert.assertEquals(16, character.getAge());
	Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("1999-07-12"), character.getBirthDate());
	Assert.assertEquals(new BigDecimal(6.65, new MathContext(3)), character.getSavings());
}
 
开发者ID:super-csv,项目名称:super-csv,代码行数:19,代码来源:ReadingFeaturesTest.java

示例7: testConverterSupport

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
@Test
public void testConverterSupport() throws Exception {
	String csv = "Connor|John|16|1999-07-12|6" + decimalFormatSymbols.getDecimalSeparator() + "65\r\n";
	String[] mapping = { "lastName", "firstName", "age", "birthDate", "savings" };
	CellProcessor[] processors = { new NotNull(), new NotNull(), new ParseInt(), new ParseDate("yyyy-MM-dd"),
		new ParseBigDecimal(decimalFormatSymbols) };
	
	CsvPreference customPreference = new Builder('"', '|', "\r\n").build();
	CsvBeanReader beanReader = new CsvBeanReader(new StringReader(csv), customPreference);
	FeatureBean character = beanReader.read(FeatureBean.class, mapping, processors);
	
	Assert.assertNotNull(character);
	Assert.assertEquals("John", character.getFirstName());
	Assert.assertEquals("Connor", character.getLastName());
	Assert.assertEquals(16, character.getAge());
	Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("1999-07-12"), character.getBirthDate());
	Assert.assertEquals(new BigDecimal(6.65, new MathContext(3)), character.getSavings());
}
 
开发者ID:super-csv,项目名称:super-csv,代码行数:19,代码来源:ReadingFeaturesTest.java

示例8: getProcessors

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

示例9: createTypes

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
public static void createTypes()
{
	typeHash.put("DECIMAL", new ParseDouble());
	typeHash.put("STRING", new NotNull());
	typeHash.put("DATE", new ParseDate("MM/dd/yyyy"));
	typeHash.put("NUMBER", new ParseInt());
	typeHash.put("BOOLEAN", new ParseBool());
	
	// now the optionals
	typeHash.put("DECIMAL_OPTIONAL", new Optional(new ParseDouble()));
	typeHash.put("STRING_OPTIONAL", new Optional());
	typeHash.put("DATE_OPTIONAL", new Optional(new ParseDate("MM/dd/yyyy")));
	typeHash.put("NUMBER_OPTIONAL", new Optional(new ParseInt()));
	typeHash.put("BOOLEAN_OPTIONAL", new Optional(new ParseBool()));
	
}
 
开发者ID:SEMOSS,项目名称:semoss,代码行数:17,代码来源:CSVReader.java

示例10: getCellProcessors

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
private CellProcessor[] getCellProcessors() {
	CellProcessor notNull = new NotNull();
	CellProcessor optional = new Optional();
	CellProcessor number = new ParseDouble();
	return new CellProcessor[] { notNull, // 0: sp name
			notNull, // 1: sp compartment
			optional, // 2: sp sub-compartment
			notNull, // 3: sp unit
			notNull, // 4: olca flow id
			optional, // 5: olcd flow name
			notNull, // 6: olca property id
			optional, // 7: olca property name
			notNull, // 8: olca unit id
			optional, // 9: olca unit name
			number // 10: conversion factor
	};
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:18,代码来源:ImportMap.java

示例11: getProcessors4ClassifiedCCSV

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

		final CellProcessor[] processors = new CellProcessor[]{
				//new UniqueHashCode(), // tweetID (must be unique)
				//new NotNull(),	// tweetID (must be unique)
				new Optional(),	// tweetID - data shows that sometimes tweetID CAN be null!
				new Optional(), // message
				new Optional(), // userID
				new Optional(), // userName
				new Optional(), // userURL
				new Optional(), // createdAt
				new NotNull(),	// crisis name
				new Optional(),	// attribute name
				new Optional(),	// attribute code
				new Optional(), // label name
				new Optional(), // label description
				new Optional(), // label code
				new Optional(), // confidence
				new Optional() // humanLabeled
		};
		return processors;
	}
 
开发者ID:qcri-social,项目名称:AIDR,代码行数:23,代码来源:ReadWriteCSV.java

示例12: getProcessors4ClassifiedTweetIDSCCSV

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

		final CellProcessor[] processors = new CellProcessor[]{
				//new UniqueHashCode(), // tweetID (must be unique)
				new NotNull(),	// tweetID (must be unique): sometimes CAN be null!
				new NotNull(), 	// crisis name
				new Optional(),	// attribute name
				new Optional(), // attribute code
				new Optional(), // label name
				new Optional(), // label description
				new Optional(),	// label code
				new Optional(), // confidence
				new Optional(), // humanLabeled
		};
		return processors;
	}
 
开发者ID:qcri-social,项目名称:AIDR,代码行数:17,代码来源:ReadWriteCSV.java

示例13: getProcessors

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的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;
}
 
开发者ID:stefanstaniAIM,项目名称:IPPR2016,代码行数:15,代码来源:ManipulatePNMLServiceImpl.java

示例14: readWithCsvMapReader

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
private Map<String, String> readWithCsvMapReader(Path mappingFile) throws IOException {
    Map<String, String> retMap = new HashMap<>();
    try (ICsvMapReader mapReader = new CsvMapReader(Files.newBufferedReader(mappingFile, StandardCharsets.UTF_8), CsvPreference.STANDARD_PREFERENCE)) {
        final String[] header = mapReader.getHeader(true);
        log.info(" cvsheader length: " + header.length);
        final CellProcessor[] rowProcessors = new CellProcessor[header.length];
        for (int i = 0; i < rowProcessors.length; i++) {
            if (i == 0) {
                rowProcessors[i] = new NotNull();
            } else {
                rowProcessors[i] = new NotNull();
            }
        }

        Map<String, Object> componentMap;
        while ((componentMap = mapReader.read(header, rowProcessors)) != null) {
            String psseId = (String) componentMap.get(header[0]);
            String rdfId = (String) componentMap.get(header[1]);
            if (psseId == null) {
                log.warn("psseId=" + psseId + ", rdfId=" + rdfId);
            } else {
                if (retMap.containsKey(psseId)) {
                    log.warn("psseId=" + psseId + " already in the map");
                }
                retMap.put(psseId, rdfId);
            }
        }
    }

    if (log.isTraceEnabled()) {
        log.trace("ids map: " + retMap);
    }
    log.info("ids map: " + retMap);
    return retMap;
}
 
开发者ID:itesla,项目名称:ipst,代码行数:36,代码来源:DdbDyrLoader.java

示例15: readWithCsvMapReader

import org.supercsv.cellprocessor.constraint.NotNull; //导入依赖的package包/类
public static Map<String, String> readWithCsvMapReader(Path dicoFile) throws Exception {

        Map<String, String> retMap = new HashMap<>();
        try (ICsvMapReader mapReader = new CsvMapReader(Files.newBufferedReader(dicoFile, StandardCharsets.UTF_8), CsvPreference.EXCEL_NORTH_EUROPE_PREFERENCE)) {
            final String[] header = mapReader.getHeader(true);
            LOGGER.debug(" cvsheader length: " + header.length);
            final CellProcessor[] rowProcessors = new CellProcessor[header.length];
            for (int i = 0; i < rowProcessors.length; i++) {
                if (i == 0) {
                    rowProcessors[i] = new NotNull();
                } else {
                    rowProcessors[i] = null;
                }
            }

            Map<String, Object> componentMap;
            while ((componentMap = mapReader.read(header, rowProcessors)) != null) {
                //System.out.println(String.format("lineNo=%s, rowNo=%s, mapping=%s", mapReader.getLineNumber(), mapReader.getRowNumber(), customerMap));
                String eurostagId = (String) componentMap.get(header[1]);
                String cimId = (String) componentMap.get(header[0]);
                if (eurostagId == null) {
                    LOGGER.warn("eurostagId=" + eurostagId + ", cimId=" + cimId);
                } else {
                    if (retMap.containsKey(eurostagId)) {
                        LOGGER.warn("eurostagId=" + eurostagId + " already in the map");
                    }
                    retMap.put(eurostagId, cimId);
                }
            }
        }

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("ids map: " + retMap);
        }
        return retMap;

    }
 
开发者ID:itesla,项目名称:ipst,代码行数:38,代码来源:DtaParser.java


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