Package propel.core.validation

Examples of propel.core.validation.ValidationException


  protected void checkNoDisallowedChars(char[] value)
      throws ValidationException
  {
    for (char ch : value)
      if (Linq.contains(getDisallowedChars(), ch))
        throw new ValidationException(String.format(CANNOT_CONTAIN, getName()) + "'" + ch + "'");
  }
View Full Code Here


      throws ValidationException
  {
    if (windowsFilename)
      if (value.endsWith("."))
        if (!value.equals(".") && !value.equals("..")) // these are the current and parent directory
          throw new ValidationException("Windows file/directory names cannot end with a dot: " + value);
  }
View Full Code Here

    // scan for double dots
    for (char ch : value)
      if (ch == CONSTANT.DOT_CHAR)
      {
        if (dotFound)
          throw new ValidationException(String.format(CANNOT_CONTAIN_DOUBLE_DOT, getName()));
        else
          dotFound = true;
      } else
        dotFound = false;
  }
View Full Code Here

    for (int i = chars.length - 1; i >= 0; i--)
    {
      int j = (chars[i]) - 48;
      if (j < 0 || j >= deltas.length)
        throw new ValidationException(String.format(CREDIT_CARD_NUMBER_INVALID, getName()));
      checksum += j;
      if (((i - chars.length) % 2) == 0)
        checksum += deltas[j];
    }

    if ((checksum % 10) != 0)
      throw new ValidationException(String.format(CREDIT_CARD_NUMBER_INVALID, getName()));
  }
View Full Code Here

    for (char ch : value.toCharArray())
    {
      if (ch == '.')
      {
        if (previousIsDot)
          throw new ValidationException(getName() + " cannot contain two consecutive dots.");
        else
          previousIsDot = true;
      } else
        previousIsDot = false;
    }
View Full Code Here

  protected void checkBounds(DateTime value)
      throws ValidationException
  {
    // check conditions
    if (value.compareTo(getMaxValue()) > 0)
      throw new ValidationException(String.format(BoundedValueTypePropertyMetadata.SHOULD_NOT_BE_GREATER_THAN, getName()) + getMaxValue());

    if (value.compareTo(getMinValue()) < 0)
      throw new ValidationException(String.format(BoundedValueTypePropertyMetadata.SHOULD_NOT_BE_LESS_THAN, getName()) + getMinValue());
  }
View Full Code Here

  {
    // check conditions
    int size = Linq.count(iterable);
    if (getMaxSize() == getMinSize())
      if (size != getMaxSize())
        throw new ValidationException(String.format(SHOULD_BE_EXACTLY, getName()) + getMaxSize());

    if (size > getMaxSize())
      throw new ValidationException(String.format(SHOULD_NOT_BE_GREATER_THAN, getName()) + getMaxSize());

    if (size < getMinSize())
      throw new ValidationException(String.format(SHOULD_NOT_BE_LESS_THAN, getName()) + getMinSize());
  }
View Full Code Here

    val iterator = iterable.iterator();
    while (iterator.hasNext())
    {
      val elem = iterator.next();
      if (elem == null)
        throw new ValidationException(String.format(SHOULD_NOT_CONTAIN_NULL_ELEMENTS, getName()));
    }
  }
View Full Code Here

  protected void checkBounds(T value)
      throws ValidationException
  {
    // check conditions
    if (value.compareTo(getMaxValue()) > 0)
      throw new ValidationException(String.format(SHOULD_NOT_BE_GREATER_THAN, getName()) + getMaxValue());

    if (value.compareTo(getMinValue()) < 0)
      throw new ValidationException(String.format(SHOULD_NOT_BE_LESS_THAN, getName()) + getMinValue());
  }
View Full Code Here

      throws ValidationException
  {
    if (OsUtils.isWindows())
      if (value.endsWith("."))
        if (!value.equals(".") && !value.equals("..")) // these are the current and parent directory
          throw new ValidationException("Windows file/directory names cannot end with a dot: " + value);
  }
View Full Code Here

TOP

Related Classes of propel.core.validation.ValidationException

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.