Performs all data validation that is based on the string representation of the value before it is converted.

@param text - the string representation of the data value
@throws DataValidationException if any of the data constraints are violated
516383
public void preValidate(String text) throws DataValidationException {
        // size
        Trace.g.std.note(Validator.class, "preValidate: size = " + _size);
        if (_size > 0 && text.length() > _size) {
            throw new DataValidationException("SIZE", _name, text);
        }

        // pattern
        Trace.g.std.note(Validator.class, "preValidate: pattern = " + _pattern);
        if (_pattern != null && !_pattern.matcher(text).matches()) {
            throw new DataValidationException("PATTERN", _name, text);
        }
    }
1331611
@Override
	public boolean validate(final Problems problems, final String compName, final String text) {
		if (text.trim().length() == 0) {
			return true;
		}
		final String result = !Utilities.isJavaIdentifier(text)
				? ValidationBundle.getMessage(NotJavaIdentifierValidator.class, "ERR_JAVA_IDENTIFIER", text)
				: null; // NOI18N
		if (result != null) {
			problems.add(result);
		}
		return result == null;
	}
564702
def validate(self, text, **kwargs):
        """"""
        cleaned = self.clean(text, **kwargs)
        return cleaned is not None
257255
public List<Mistake> checkText(String text) {
    List<Mistake> mistakes = null;
    try {
      mistakes = analyseAndCheckText(text).mistakes;
    } catch (IndexOutOfBoundsException e) {
      LOGGER.fatal("Failed to process text: " + text, e);
      throw new RuntimeException(e);
    }
    return mistakes;

  }
91489
@VisibleForTesting
  static Context parse(String text) {
    Queue<String> parts = Lists.newLinkedList(Arrays.asList(text.split(" ")));
    Context.Builder builder = HTML_PCDATA.toBuilder();
    builder.withState(HtmlContext.valueOf(parts.remove()));
    if (!parts.isEmpty()) {
      try {
        builder.withElType(ElementType.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      try {
        builder.withAttrType(AttributeType.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      try {
        builder.withDelimType(AttributeEndDelimiter.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      try {
        builder.withSlashType(JsFollowingSlash.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      try {
        builder.withUriPart(UriPart.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      try {
        builder.withUriType(UriType.valueOf(parts.element()));
        parts.remove();
      } catch (IllegalArgumentException ex) {
        // OK
      }
    }
    if (!parts.isEmpty()) {
      String part = parts.element();
      String prefix = "templateNestDepth=";
      if (part.startsWith(prefix)) {
        try {
          builder.withTemplateNestDepth(Integer.parseInt(part.substring(prefix.length())));
          parts.remove();
        } catch (NumberFormatException ex) {
          // OK
        }
      }
    }
    if (!parts.isEmpty()) {
      String part = parts.element();
      String prefix = "jsTemplateLiteralNestDepth=";
      if (part.startsWith(prefix)) {
        try {
          builder.withJsTemplateLiteralNestDepth(Integer.parseInt(part.substring(prefix.length())));
          parts.remove();
        } catch (NumberFormatException ex) {
          // OK
        }
      }
    }
    if (!parts.isEmpty()) {
      throw new IllegalArgumentException(
          "Unable to parse context \"" + text + "\". Unparsed portion: " + parts);
    }
    Context result = builder.build();
    return result;
  }
591322
public void setAsText(final String text) {
        if (BeanUtils.isNull(text)) {
            setValue(null);
            return;
        }
        try {
            Object newValue = Short.decode(text);
            setValue(newValue);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Failed to parse short.", e);
        }
    }
519619
@Override
	public boolean validate(final Problems problems, final String compName, final String text) {
		boolean invalid = text.contains(File.separator) || text.contains(File.pathSeparator);
		if (!invalid && Utilities.isWindows()) {
			invalid = text.contains(":");
		}
		final String result = invalid
				? ValidationBundle.getMessage(IllegalCharactersInFileNameValidator.class, "ERR_INVALID_FILE_NAME", compName, text)
				: null; // NOI18N
		if (result != null) {
			problems.add(result);
		}
		return !invalid;
	}
113803
public void validate(Object o)
    {
        if (o != null && o instanceof String)
        {
            int l = ((String)o).length();
            if (m_minLength != -1 && l < m_minLength)
            {
                String message = m_propertyMetadata.getMessageSourceAccessor().getMessage(m_message, new Object[]{ m_propertyMetadata.getLabelName(), m_minLength,m_maxLength,String.valueOf(o) });
                throw new ValidationException(message);                
            }
            if (m_maxLength != -1 && l > m_maxLength)
            {
                String message = m_propertyMetadata.getMessageSourceAccessor().getMessage(m_message, new Object[]{ m_propertyMetadata.getLabelName(),m_minLength,m_maxLength, String.valueOf(o) });
                throw new ValidationException(message);                
            }
        }
    }
706786
protected boolean verifyPatternMatch(String text) {
		if (this.expectedPattern == null) {
			return false;
		}
		return this.expectedPattern.matcher(text).matches();
	}
19572
private void validateText(String receivedMessagePayload, String controlMessagePayload) {
        if (!StringUtils.hasText(controlMessagePayload)) {
            log.debug("Skip message payload validation as no control message was defined");
            return;
        } else {
            Assert.isTrue(StringUtils.hasText(receivedMessagePayload), "Validation failed - " +
                    "expected message contents, but received empty message!");
        }

        if (!receivedMessagePayload.equals(controlMessagePayload)) {
            if (StringUtils.trimAllWhitespace(receivedMessagePayload).equals(StringUtils.trimAllWhitespace(controlMessagePayload))) {
                throw new ValidationException("Text values not equal (only whitespaces!), expected '" + controlMessagePayload + "' " +
                        "but was '" + receivedMessagePayload + "'");
            } else {
                throw new ValidationException("Text values not equal, expected '" + controlMessagePayload + "' " +
                        "but was '" + receivedMessagePayload + "'");
            }
        }
    }
729140
@Override
    public void setAsText(String text) {
        if (BeanUtils.isNull(text)) {
            setValue(null);
            return;
        }
        ParseException pe = null;

        for (int i = 0; i < formats.length; i++) {
            try {
                // try to parse the date
                DateFormat df = formats[i];
                Date date = df.parse(text);

                // store the date in both forms
                this.text = text;
                super.setValue(date);

                // done
                return;
            } catch (ParseException e) {
                // remember the last seen exception
                pe = e;
            }
        }
        // couldn't parse
        throw new IllegalArgumentException("Failed to parse to Date!", pe);
    }
297360
@SuppressWarnings("unchecked")
	@Override
	protected void performValidation(String path, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";
		value = ObjectReader.getValue(value);

		super.performValidation(path, value, results);

		if (value == null)
			return;

		if (value instanceof List<?>) {
			List<Object> list = (List<Object>) value;
			int index = 0;
			for (Object element : list) {
				String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index;
				performTypeValidation(elementPath, _valueType, element, results);
				index++;
			}
		} else if (value.getClass().isArray()) {
			int length = Array.getLength(value);
			for (int index = 0; index < length; index++) {
				Object element = Array.get(value, index);
				String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index;
				performTypeValidation(elementPath, _valueType, element, results);
				index++;
			}
		} else {
			results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_ARRAY",
					name + " type must be List or Array", "List", value.getClass()));
		}
	}
179381
private void validateString(Type type) throws SerializerException {
        if (null == type || !String.class.equals(TypeToken.of(type).getRawType())) {
            throw new SerializerException("String serializer is able to work only with data types assignable from java.lang.String");
        }
    }
468162
@LogExecTime
	public void verifyTextPresent(String text, String msg)
	{
		jtCore.verifyTextPresent(text, msg);
	}
826867
@Override
	public void validate() throws HostNameException {
		if(parsedHost != null) {
			return;
		}
		if(validationException != null) {
			throw validationException;
		}
		synchronized(this) {
			if(parsedHost != null) {
				return;
			}
			if(validationException != null) {
				throw validationException;
			}
			try {
				parsedHost = getValidator().validateHost(this);
			} catch(HostNameException e) {
				validationException = e;
				throw e;
			}
		}
	}
285294
public static <T extends CharSequence> T validateWord(T value, String errorMsg) throws ValidateException {
		if (false == isWord(value)) {
			throw new ValidateException(errorMsg);
		}
		return value;
	}
298523
@Override
	public void setData(final Object data) {
		if (isRichTextArea() && data instanceof String) {
			super.setData(sanitizeInputText((String) data));
		} else {
			super.setData(data);
		}
	}