private static final Optional<?> EMPTY = new Optional<>(); public static<T> Optional<T> empty() { @SuppressWarnings("unchecked") Optional<T> t = (Optional<T>) EMPTY; return t; }
final CellProcessor[] processors = new CellProcessor[] { new Optional(new ParseInt()), // age new ParseBool(), // consent new ParseInt(), // questionNo 1 new Optional(), // answer 1 new ParseInt(), // questionNo 2 new Optional(), // answer 2 new ParseInt(), // questionNo 3 new Optional() // answer 3 };
final CellProcessor[] processors = new CellProcessor[] { new Unique(new StrMinMax(5, 20)), new StrMinMax(8, 35), new ParseDate("dd/MM/yyyy"), new Optional(new ParseInt()), null };
43 private final static Optional<?> EMPTY = new Optional<>(); 63 * There is no guarantee that it is a singleton. 69 @SuppressWarnings("unchecked") 70 public static<T> Optional<T> empty() { 71 return (Optional<T>) EMPTY; 72 }
CellProcessor[] processors=new CellProcessor[properties.size()]; for(int i=0; i< properties.zise(); i++){ processors[i]=new Optional(); } return processors;
public static <T> Optional<T> empty() { if (CACHED_EMPTY == null) CACHED_EMPTY = new Optional<>(null); //noinspection unchecked return (Optional<T>) CACHED_EMPTY; }
/** * Returns an {@code Optional} with the specified present non-null value. * * @param <T> the class of the value * @param value the value to be present, which must be non-null * @return an {@code Optional} with the value present * @throws NullPointerException if value is null */ public static <T> Optional<T> of(T value) { return new Optional<>(value); }
public static <T> Optional<T> of(T value) { return new Optional<>(value); }
public static <T> Optional<T> of(T value) { return new Optional<T>(value); }
private Optional<String> testString= new Optional<>() ;
final CellProcessor[] processors = new CellProcessor[] { new Optional() };
private Optional<String> testString= new Optional<String>() ;
public static Map<String, ArticleModele> readWithCsvDozerBeanReader() throws Exception { final CellProcessor[] processors = new CellProcessor[] { new Optional(), new Optional(), new Optional() }; Map<String, ArticleModele> map = new HashMap<String,ArticleModele>(); ICsvDozerBeanReader beanReader = null; try { beanReader = new CsvDozerBeanReader(new FileReader(CSV_FILENAME), CsvPreference.EXCEL_NORTH_EUROPE_PREFERENCE); beanReader.getHeader(true); // ignore the header beanReader.configureBeanMapping(ArticleModele.class, FIELD_MAPPING); ArticleModele articleModele; while( (articleModele = beanReader.read(ArticleModele.class, processors)) != null ) { System.out.println(String.format(" %s", articleModele));} map.put(articleModele .getTitre(),articleModele); } finally { if( beanReader != null ) { beanReader.close(); } } } }
new Optional(new Token(" ", null, new ParseDate("MM/dd/yyyy",true)));
private static void writePartial() throws IOException { Person person1 = new Person("John", "K", "Smith"); Person person2 = new Person("Sally", "T", "Brown"); CsvPreference csvPrefs = new CsvPreference.Builder('"', ';', "\n").build(); String[] nameMapping = new String[] { "firstName", "middleName", "lastName" }; CellProcessor[] processors = new CellProcessor[] { new Optional(), new Ignore(), new Optional() }; try (ICsvBeanWriter writer = new CsvBeanWriter(new FileWriter("output.csv"), csvPrefs)) { writer.writeHeader(nameMapping); for( Person p : Arrays.asList(person1, person2) ) { writer.write(p, nameMapping, processors); } } }
private static final CellProcessor[] cellProcessor = new CellProcessor[] { null, null, new Optional(new ParseInt()), new ParseDate("yyyyMMdd"), new ParseBigDecimal() };
processors[i] = new Optional(new ParsePersonAttribute(header)); hintTypes[i] = PersonAttribute.class;
new Optional(new ParsePersonAttribute(header));
new CellProcessor[]{new Optional(), new ParseInt()};