{@link SuperCsvValidationException.Builder}のインスタンスを作成する。
@param context CsvContext CSVのコンテキスト。
@return 予め検証用のメッセージは設定された状態で作成される。
ただし、{@link #getValidationMessage()}がnullまたは空の場合、{@link #getDefaultValidationMessage()}が設定される。
191230
public SuperCsvValidationException.Builder createValidationException(final CsvContext context) {
        
        String message = getValidationMessage();
        if(Utils.isEmpty(message)) {
            message = getDefaultValidationMessage();
        }
        
        return new SuperCsvValidationException.Builder(context, this)
                .validationMessage(message);
    }
1042426
private void processConstraintViolation(final Set<ConstraintViolation<Object>> violations,
            final CsvBindingErrors bindingErrors, final ValidationContext<Object> validationContext) {
        
        for(ConstraintViolation<Object> violation : violations) {
            
            final String field = violation.getPropertyPath().toString();
            final ConstraintDescriptor<?> cd = violation.getConstraintDescriptor();
            
            final String[] errorCodes = determineErrorCode(cd);
            
            final Map<String, Object> errorVars = createVariableForConstraint(cd);
            
            if(isCsvField(field, validationContext)) {
                // フィールドエラーの場合
                
                final CsvFieldError fieldError = bindingErrors.getFirstFieldError(field);
                if(fieldError != null && fieldError.isProcessingFailure()) {
                    // CellProcessorで発生したエラーが既ににある場合は、処理をスキップする。
                    continue;
                }
                
                final ColumnMapping columnMapping = validationContext.getBeanMapping().getColumnMapping(field).get();
                
                errorVars.put("lineNumber", validationContext.getCsvContext().getLineNumber());
                errorVars.put("rowNumber", validationContext.getCsvContext().getRowNumber());
                errorVars.put("columnNumber", columnMapping.getNumber());
                errorVars.put("label", columnMapping.getLabel());
                errorVars.computeIfAbsent("printer", key -> columnMapping.getFormatter());
                
                // 実際の値を取得する
                final Object fieldValue = violation.getInvalidValue();
                errorVars.computeIfAbsent("validatedValue", key -> fieldValue);
                
                String defaultMessage = determineDefaltMessage(errorVars, violation);
                
                bindingErrors.rejectValue(field, columnMapping.getField().getType(), 
                        errorCodes, errorVars, defaultMessage);
                
            } else {
                // オブジェクトエラーの場合
                bindingErrors.reject(errorCodes, errorVars, violation.getMessage());
                
            }
            
        }
        
        
    }
1219835
public List<CsvFieldError> getFieldErrors() {
        final List<CsvFieldError> list = new ArrayList<CsvFieldError>();
        for(CsvError item : this.errors) {
            if(item instanceof CsvFieldError) {
                list.add((CsvFieldError) item);
            }
        }
        
        return list;
    }
575677
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		int hash = value.hashCode();
		if( !uniqueSet.add(hash) ) {
			throw new SuperCsvConstraintViolationException(
				String.format("duplicate value '%s' encountered with hashcode %d", value, hash), context, this);
		}
		
		return next.execute(value, context);
	}
500957
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		final String inputString = value.toString();
		
		for( final Enum<?> enumConstant : enumClass.getEnumConstants() ) {
			String constantName = enumConstant.name();
			if( ignoreCase ? constantName.equalsIgnoreCase(inputString) : constantName.equals(inputString) ) {
				return enumConstant;
			}
		}
		
		throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a enum of type %s", value,
			enumClass.getName()), context, this);
		
	}
881362
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 ZoneId result;
		try {
			if( aliasMap != null ) {
				result = ZoneId.of((String) value, aliasMap);
			} else {
				result = ZoneId.of((String) value);
			}
		}
		catch(DateTimeException e) {
			throw new SuperCsvCellProcessorException("Failed to parse value as a ZoneId", context, this, e);
		}
		return next.execute(result, context);

	}
99987
@Override
    public XMLValidator createValidator(ValidationContext ctxt)
        throws XMLStreamException
    {
        if (mFullyValidating) {
            return new DTDValidator(this, ctxt, mHasNsDefaults,
                                    getElementMap(), getGeneralEntityMap());
        }
        return new DTDTypingNonValidator(this, ctxt, mHasNsDefaults,
                                         getElementMap(), getGeneralEntityMap());

    }
110692
@Override
    public void validate(final FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }

        final Validator[] validators = getValidators();
        final Object value = getValue();

        if (!validateRequired(context, value)) {
            return;
        }

        if (validators == null) {
            return;
        }

        for (final Validator validator : validators) {
            try {
                validator.validate(context, this, value);
            }
            catch (final ValidatorException ve) {
                // If the validator throws an exception, we're
                // invalid, and we need to add a message
                setValid(false);
                FacesMessage message;
                final String validatorMessageString = getValidatorMessage();

                if (null != validatorMessageString) {
                    message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                validatorMessageString,
                                validatorMessageString);
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                }
                else {
                    final Collection<FacesMessage> messages = ve.getFacesMessages();
                    if (null != messages) {
                        message = null;
                        final String cid = getClientId(context);
                        for (final FacesMessage m : messages) {
                            context.addMessage(cid, m);
                        }
                    }
                    else {
                        message = ve.getFacesMessage();
                    }
                }
                if (message != null) {
                    final Sheet sheet = getSheet();
                    if (sheet == null) {
                        return;
                    }
                    context.addMessage(getClientId(context), message);
                    sheet.getInvalidUpdates().add(
                                new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, value,
                                            message.getDetail()));

                }
            }
        }

    }
878967
public String getMessage(Context context) {
        if (customMessage != null) {
            return customMessage;
        }
        return context.getResources().getString(message);
    }
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);
		}
	}
498250
@Override
    @GwtIncompatible("incompatible method")
    public String getFormattedExceptionMessage(final String baseMessage){
        final StringBuilder buffer = new StringBuilder(256);
        if (baseMessage != null) {
            buffer.append(baseMessage);
        }

        if (contextValues.size() > 0) {
            if (buffer.length() > 0) {
                buffer.append('\n');
            }
            buffer.append("Exception Context:\n");

            int i = 0;
            for (final Pair<String, Object> pair : contextValues) {
                buffer.append("\t[");
                buffer.append(++i);
                buffer.append(':');
                buffer.append(pair.getKey());
                buffer.append("=");
                final Object value = pair.getValue();
                if (value == null) {
                    buffer.append("null");
                } else {
                    String valueStr;
                    try {
                        valueStr = value.toString();
                    } catch (final Exception e) {
                        valueStr = "Exception thrown on toString(): " + ExceptionUtils.getStackTrace(e);
                    }
                    buffer.append(valueStr);
                }
                buffer.append("]\n");
            }
            buffer.append("---------------------------------");
        }
        return buffer.toString();
    }
392863
public List<CsvError> convert(final SuperCsvException exception, final BeanMapping<?> beanMapping) {
        
        Objects.requireNonNull(beanMapping, "beanMapping should not be null.");
        Objects.requireNonNull(exception, "exception should not be null.");
        
        final List<CsvError> errors = new ArrayList<>();
        
        if(exception instanceof SuperCsvBindingException) {
            errors.addAll(convert((SuperCsvBindingException) exception, beanMapping));
            
        } if(exception instanceof SuperCsvRowException) {
            errors.addAll(convert((SuperCsvRowException) exception, beanMapping));
            
        } else if(exception instanceof SuperCsvValidationException) {
            errors.addAll(convert((SuperCsvValidationException)exception, beanMapping));
            
        } else if(exception instanceof SuperCsvCellProcessorException) {
            errors.addAll(convert((SuperCsvCellProcessorException)exception, beanMapping));
            
        } else if(exception instanceof SuperCsvNoMatchColumnSizeException) {
            errors.addAll(convert((SuperCsvNoMatchColumnSizeException)exception, beanMapping));
            
        } else if(exception instanceof SuperCsvNoMatchHeaderException) {
            errors.addAll(convert((SuperCsvNoMatchHeaderException)exception, beanMapping));
            
        } else {
            errors.addAll(convertDefault(exception, beanMapping));
            
        }
        
        return errors;
    }
432679
protected void validateColumnAndSupplyPartialColumn(final Class<?> beanType, final List<ColumnMapping> list) {
        
        final Optional<CsvPartial> partialAnno = Optional.ofNullable(beanType.getAnnotation(CsvPartial.class));
        
        if(list.isEmpty()) {
            throw new SuperCsvInvalidAnnotationException(MessageBuilder.create("anno.notFound")
                    .varWithClass("property", beanType)
                    .varWithAnno("anno", CsvColumn.class)
                    .format());
        }
        
        // 番号の重複などのチェック
        BeanMappingFactoryHelper.validateDuplicatedColumnNumber(beanType, list);
        
        // 不足している番号のカラムを補完する。
        BeanMappingFactoryHelper.supplyLackedNumberMappingColumn(beanType, list, partialAnno, new String[0]);
        
    }
1101310
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		final boolean matches = regexPattern.matcher((String) value).matches();
		if( !matches ) {
			final String msg = REGEX_MSGS.get(regex);
			if( msg == null ) {
				throw new SuperCsvConstraintViolationException(String.format(
					"'%s' does not match the regular expression '%s'", value, regex), context, this);
			} else {
				throw new SuperCsvConstraintViolationException(
					String.format("'%s' does not match the constraint '%s' defined by the regular expression '%s'",
						value, msg, regex), context, this);
			}
		}
		return next.execute(value, context);
	}
1322167
public static TreeSet<Integer> validateDuplicatedColumnNumber(final Class<?> beanType, final List<ColumnMapping> list) {
        
        final TreeSet<Integer> checkedNumber = new TreeSet<>();
        final TreeSet<Integer> duplicatedNumbers = new TreeSet<>();
        for(ColumnMapping columnMapping : list) {
            
            if(checkedNumber.contains(columnMapping.getNumber())) {
                duplicatedNumbers.add(columnMapping.getNumber());
            }
            checkedNumber.add(columnMapping.getNumber());
            
        }
        
        if(!duplicatedNumbers.isEmpty()) {
            // 重複している 属性 numberが存在する場合
            throw new SuperCsvInvalidAnnotationException(MessageBuilder.create("anno.attr.duplicated")
                    .var("property", beanType.getName())
                    .varWithAnno("anno", CsvColumn.class)
                    .var("attrName", "number")
                    .var("attrValues", duplicatedNumbers)
                    .format());
        }
        
        // カラム番号が1以上かチェックする
        final int minColumnNumber = checkedNumber.first();
        if(minColumnNumber <= 0) {
            throw new SuperCsvInvalidAnnotationException(MessageBuilder.create("anno.attr.min")
                    .var("property", beanType.getName())
                    .varWithAnno("anno", CsvColumn.class)
                    .var("attrName", "number")
                    .var("attrValue", minColumnNumber)
                    .var("min", 1)
                    .format());
            
        }
        
        return checkedNumber;
    }
1153277
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		final String stringValue = value.toString();
		final String result;
		if( stringValue.length() <= maxSize ) {
			result = stringValue;
		} else {
			result = stringValue.substring(0, maxSize) + suffix;
		}
		
		return next.execute(result, context);
	}
1138407
private String buildCsvValue(final Field field,
                                 final String fieldValue) {


        return (areTextValuesWrapped && field.getType().equals(String.class)
                || isValueWrappable.test(fieldValue))
                ? wrapWithQuotes(fieldValue)
                : fieldValue;
    }