/** * Checks whether a given columns is mapped and has a value. * * @param name * the name of the column to be retrieved. * @return whether a given columns is mapped and has a value */ public boolean isSet(final String name) { return isMapped(name) && mapping.get(name).intValue() < values.length; }
/** * Checks whether a given columns is mapped and has a value. * * @param name * the name of the column to be retrieved. * @return whether a given columns is mapped and has a value */ public boolean isSet(final String name) { return isMapped(name) && mapping.get(name).intValue() < values.length; }
/** * Checks whether a given columns is mapped and has a value. * * @param name * the name of the column to be retrieved. * @return whether a given columns is mapped and has a value */ public boolean isSet(final String name) { return isMapped(name) && mapping.get(name).intValue() < values.length; }
/** * Checks whether a given columns is mapped and has a value. * * @param name * the name of the column to be retrieved. * @return whether a given columns is mapped and has a value */ public boolean isSet(final String name) { return isMapped(name) && mapping.get(name).intValue() < values.length; }
/** * Extract a string from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, defaultValue is returned * if it is not null. Otherwise, a FormatException is thrown. */ private String extractString(String key, CSVRecord record, String defaultValue) throws FormatException { String toReturn = defaultValue; if(record.isMapped(key)) { toReturn = record.get(key); } else { if(defaultValue == null) { throw new FormatException("Field not used but expected: " + key); } } return toReturn; }
/** * Extract a string from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, defaultValue is returned * if it is not null. Otherwise, a FormatException is thrown. */ private String extractString(String key, CSVRecord record, String defaultValue) throws FormatException { String toReturn = defaultValue; if(record.isMapped(key)) { toReturn = record.get(key); } else { if(defaultValue == null) { throw new FormatException("Field not used but expected: " + key); } } return toReturn; }
/** * Extract an long from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, or the data is not a valid * long, a FormatException is thrown. */ private long extractLong(String key, CSVRecord record) throws FormatException { if(record.isMapped(key) == false) { throw new FormatException("Field not used but expected: " + key); } try { return Long.parseLong(record.get(key)); } catch(NumberFormatException e) { throw new FormatException("Failed to parse field: " + key, e); } }
/** * Extract an integer from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, or the data is not a valid * int, a FormatException is thrown. */ private int extractInt(String key, CSVRecord record) throws FormatException { if(record.isMapped(key) == false) { throw new FormatException("Field not used but expected: " + key); } try { return Integer.parseInt(record.get(key)); } catch(NumberFormatException e) { throw new FormatException("Failed to parse field: " + key, e); } }
/** * Extract an double from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, or the data is not a valid * double, a FormatException is thrown. */ private double extractDouble(String key, CSVRecord record) throws FormatException { if(record.isMapped(key) == false) { throw new FormatException("Field not used but expected: " + key); } try { return Double.parseDouble(record.get(key)); } catch(NumberFormatException e) { throw new FormatException("Failed to parse field: " + key, e); } }
/** * Extract an integer from the items array. The index into the array * is determined by looking up the index in the fields map using the * "key" as the key. If no such key exists, or the data is not a valid * int, a FormatException is thrown. */ private Integer extractInt(String key, CSVRecord record, boolean nullIsOk) throws FormatException { if(record.isMapped(key) == false) { throw new FormatException("Field not used but expected: " + key); } String value = record.get(key); if(value.isEmpty() && nullIsOk) { return null; } try { return Integer.parseInt(record.get(key)); } catch(NumberFormatException e) { throw new FormatException("Failed to parse field: " + key, e); } }
value = ""; } else { if (record.isMapped(annotation.getValuePath())) value = record.get(annotation.getValuePath()); else