{@inheritDoc}

@throws SuperCsvCellProcessorException
if value is null or isn't a String
@throws SuperCsvConstraintViolationException
if value is an empty String
180749
public Object execute(final Object value, final CsvContext context) {
		if (value == null){
			throw new SuperCsvConstraintViolationException("the String should not be null", context, this);
		}
		
		if( value instanceof String ) {
			final String stringValue = (String) value;
			if( stringValue.length() == 0 ) {
				throw new SuperCsvConstraintViolationException("the String should not be empty", context, this);
			}
		} else {
			throw new SuperCsvCellProcessorException(String.class, value, context, this);
		}
		
		return next.execute(value, context);
	}
459661
@SuppressWarnings("unchecked")
    public Object execute(final Object value, final CsvContext context) {
        
        if(value == null) {
            return next.execute(value, context);
        }
        
        final String stringValue = value.toString();
        final int length = stringValue.length();
        
        if( !requriedLengths.contains(length)) {
            final String joinedLength = requriedLengths.stream()
                    .map(String::valueOf).collect(Collectors.joining(", "));
            
            throw createValidationException(context)
                .messageFormat("the length (%d) of value '%s' not any of required lengths (%s)",
                        length, stringValue, joinedLength)
                .rejectedValue(stringValue)
                .messageVariables("length", length)
                .messageVariables("requiredLengths", getRequiredLengths())
                .build();
                
        }
        
        return next.execute(stringValue, context);
    }
675017
@Override
	public void setValue(StringValue value) {
		checkNotNull(value);
		setValue(value.value, 0, value.len);
	}
1260027
static public function string($value, $message = null, $propertyPath = null)
        {
            if ( ! is_string($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" expected to be string, type %s given.',
                    static::stringify($value),
                    gettype($value)
                );

                throw static::createException($value, $message, static::INVALID_STRING, $propertyPath);
            }
        }
1088511
public static boolean isEmpty(Object value) {
		return (null == value || (value instanceof String && StrUtil.isEmpty((String) value)));
	}
1318865
void write(Object value) throws IOException {
    if (clientInputSerializer != null) {
      clientInputSerializer.serialize(value);
      return;
    }

    byte[] bval;
    int valSize;
    if (value instanceof BytesWritable) {
      BytesWritable val = (BytesWritable) value;
      bval = val.getBytes();
      valSize = val.getLength();
    } else if (value instanceof Text) {
      Text val = (Text) value;
      bval = val.getBytes();
      valSize = val.getLength();
    } else {
      String sval = value.toString();
      bval = sval.getBytes("UTF-8");
      valSize = bval.length;
    }
    clientOut_.write(bval, 0, valSize);
  }
694050
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		final Class<T> ourType = getType();
		if( !(value.getClass().equals(ourType)) ) {
			throw new SuperCsvCellProcessorException(ourType, value, context, this);
		}
		final TemporalAccessor timeType = ourType.cast(value);
		try {
			if( formatter != null ) {
				return formatter.format(timeType);
			} else {
				return timeType.toString();
			}
		}
		catch(DateTimeException | IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException(
				String.format("Failed to format value as a %s", ourType.getSimpleName()), context, this, e);
		}
	}
1008555
static public function subclassOf($value, $className, $message = null, $propertyPath = null)
        {
            if (!is_subclass_of($value, $className)) {
                $message = $message ?: sprintf(
                    'Class "%s" was expected to be subclass of "%s".',
                    static::stringify($value),
                    $className
                );

                throw static::createException($value, $message, static::INVALID_SUBCLASS_OF, $propertyPath, array('class' => $className));
            }
        }
426971
String convertToString(Object value) {
        if (value == null) {
            return null;
        } else if (value instanceof String) {
            return (String) value;
        } else if (value instanceof List) {
            List<?> list = ((List<?>) value);
            if (list.size() == 0) {
                return EvaluationContext.EMPTY_STRING;
            } else if (list.size() == 1) {
                String strValue = String.valueOf(list.get(0));
                return escapeValue(strValue);
            } else {
                StringBuilder builder = new StringBuilder();
                Iterator<?> iterator = list.iterator();
                while (iterator.hasNext()) {
                    String strValue = String.valueOf(iterator.next());
                    strValue = escapeValue(strValue);
                    builder.append(strValue);
                    if (iterator.hasNext()) {
                        builder.append(", ");
                    }
                }
                return builder.toString();
            }
        } else if (value instanceof String[]) {
            String[] array = (String[]) value;
            if (array.length == 0) {
                return EvaluationContext.EMPTY_STRING;
            } else if (array.length == 1) {
                return escapeValue(array[0]);
            } else {
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < array.length; i++) {
                    String strValue = escapeValue(array[i]);
                    builder.append(strValue);
                    if (i + 1 < array.length) {
                        builder.append(", ");
                    }
                }
                return builder.toString();
            }
        } else if (value.getClass().isArray()) {
            int size = Array.getLength(value);
            if (size == 0) {
                return EvaluationContext.EMPTY_STRING;
            } else if (size == 1) {
                String strValue = String.valueOf(Array.get(value, 0));
                return escapeValue(strValue);
            } else {
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < size; i++) {
                    String strValue = String.valueOf(Array.get(value, i));
                    strValue = escapeValue(strValue);
                    builder.append(strValue);
                    if (i + 1 < size) {
                        builder.append(", ");
                    }
                }
                return builder.toString();
            }
        } else {
            return value.toString();
        }
    }
417947
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		if( !(value instanceof String) ) {
			throw new SuperCsvCellProcessorException(String.class, value, context, this);
		}
		
		try {
			if( locale == null ) {
				formatter = new SimpleDateFormat(dateFormat);
			} else {
				formatter = new SimpleDateFormat(dateFormat, locale);
			}
			formatter.setLenient(lenient);
			Object result = parseValue(value);
			return next.execute(result, context);
		}
		catch(final ParseException e) {
			throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Date", value),
				context, this, e);
		}
	}
518084
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		if( !(value instanceof Boolean) ) {
			throw new SuperCsvCellProcessorException(Boolean.class, value, context, this);
		}
		
		final String result = ((Boolean) value).booleanValue() ? trueValue : falseValue;
		return next.execute(result, context);
	}
544005
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		if (!(value.getClass().equals(jodaClass))) {
			throw new SuperCsvCellProcessorException(jodaClass, value, context,
					this);
		}
		final T jodaType = jodaClass.cast(value);
		try {
			if (formatter != null) {
				return format(jodaType, formatter);
			} else if (pattern != null) {
				return format(jodaType, pattern, locale);
			} else {
				return format(jodaType);
			}
		} catch (IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException(
					String.format("Failed to format value as a %s",
							jodaClass.getSimpleName()), context, this, e);
		}
	}
1141264
public Object execute(final Object value, final CsvContext context) {
		
		if( !collection.contains(value) ) {
			throw new SuperCsvConstraintViolationException(String.format(
				"'%s' is not an element of the supplied Collection", value), context, this);
		}
		
		return next.execute(value, context);
	}
300265
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		if( !(value instanceof Number) ) {
			throw new SuperCsvCellProcessorException(Number.class, value, context, this);
		}
		
		// create a new DecimalFormat if one is not supplied
		final DecimalFormat decimalFormatter;
		try {
			decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat);
		}
		catch(IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException(
				String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e);
		}
		
		final String result = decimalFormatter.format(value);
		return next.execute(result, context);
	}
1266231
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		final String stringValue = value.toString();
		final int length = stringValue.length();
		if( !requiredLengths.contains(length) ) {
			throw new SuperCsvConstraintViolationException(String.format("the length (%d) of value '%s' not any of the required lengths",
				length, stringValue), context, this);
		}
		
		return next.execute(value, context);
	}
447305
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		if (!(value instanceof String)) {
			throw new SuperCsvCellProcessorException(String.class, value,
					context, this);
		}
		final Duration result;
		try {
			result = Duration.parse((String) value);
		} catch (IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException(
					"Failed to parse value as a Duration", context, this, e);
		}
		return next.execute(result, context);
	}
838047
@SuppressWarnings("fallthrough")
  private void beforeValue() throws IOException {
    switch (peekScope()) {
      case NONEMPTY_DOCUMENT:
        if (!lenient) {
          throw new IllegalStateException(
              "JSON must have only one top-level value.");
        }
        // fall-through
      case EMPTY_DOCUMENT: // first in document
        replaceTop(NONEMPTY_DOCUMENT);
        break;

      case EMPTY_ARRAY: // first in array
        replaceTop(NONEMPTY_ARRAY);
        newline();
        break;

      case NONEMPTY_ARRAY: // another in array
        sink.writeByte(',');
        newline();
        break;

      case DANGLING_NAME: // value for name
        sink.writeUtf8(separator);
        replaceTop(NONEMPTY_OBJECT);
        break;

      default:
        throw new IllegalStateException("Nesting problem.");
    }
  }