Package org.supercsv.exception

Examples of org.supercsv.exception.NullInputException


  this.regexPattern = Pattern.compile(regex);
  this.regex = regex;
}

private void handleArguments(final String regex)  {
  if( regex == null ) { throw new NullInputException("the regular expression cannot be null", this); }
  if( regex.equals("") ) { throw new SuperCSVException(
    "the regular expression  cannot be \"\" as this has no effect", this); }
}
View Full Code Here


/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
 
  boolean found = regexPattern.matcher((String) value).find();
  if (!found) {
    String msg = regexMessages.get(regex);
View Full Code Here

*             upon detecting a duplicate entry
* @return the argument value if the value is unique
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
 
  // check for uniqueness
  final int hash = value.hashCode();
  if( uniqueSet.contains(hash) ) { throw new SuperCSVException("Duplicate entry \"" + value
View Full Code Here

public HashMapper(final Map<Object, Object> mapping, final Object defaultValue, final BoolCellProcessor next) {
  super(next);
  this.mapping = mapping;
  this.defaultValue = defaultValue;
  if( mapping == null ) { throw new NullInputException("Mapping cannot be null", this); }
}
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
  Object result = mapping.get(value);
  if( result == null ) {
    result = defaultValue;
  }
View Full Code Here

  this.regexPattern = Pattern.compile(regex);
  this.replacement = replacement;
}

private void handleArguments(final String regex, final String replacement)  {
  if( regex == null ) { throw new NullInputException("the regular expression cannot be null", this); }
  if( replacement == null ) { throw new NullInputException("the replacement string cannot be null", this); }
  if( regex.equals("") ) { throw new SuperCSVException(
    "the regular expression  cannot be \"\" as this has no effect", this); }
}
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
  String result = regexPattern.matcher((String) value).replaceAll(replacement);
  return next.execute(result, context);
}
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  final Integer result;
  if( value instanceof Integer ) {
    result = (Integer) value;
  } else if( value instanceof String ) {
    try {
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " column " + context.columnNumber, context, this); }
  if( !(value instanceof Date) ) { throw new ClassCastInputCSVException("the value '" + value
    + "' is not of type Date", context, this); }
  final String result = formatter.format((Date) value);
  return next.execute(result, context);
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
 
  final Double result;
  if( value instanceof Double ) {
    result = (Double) value;
  } else if( value instanceof String ) {
View Full Code Here

TOP

Related Classes of org.supercsv.exception.NullInputException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.