Package propel.core.validation

Examples of propel.core.validation.ValidationException


  protected void checkNonZero(UUID value)
      throws ValidationException
  {
    if (getNonZero())
      if (value.equals(CONSTANT.EMPTY_UUID))
        throw new ValidationException(String.format(SHOULD_NOT_BE_ZERO_GUID, getName()));
  }
View Full Code Here


        // ensure one of allowed values is used
        if (!StringUtils.contains(allowedValues, value, comparison))
        {
          // decide whether to include allowed values in error message
          if (includeAllowedStringsInErrorMessage)
            throw new ValidationException(getName() + " specified ('" + value + "') is not one of the following: "
                + StringUtils.delimit(allowedValues, ", "));

          // do not include
          throw new ValidationException(getName() + " specified a value which is not an allowed value: " + value);
        }
      }

    return result;
  }
View Full Code Here

  {
    boolean empty = value.equals(CONSTANT.EMPTY_STRING);

    if (getNotEmpty())
      if (empty)
        throw new ValidationException(String.format(SHOULD_NOT_BE_EMPTY, getName()));

    return empty;
  }
View Full Code Here

    // check lengths
    int length = value.length();

    if (getMinLength() == getMaxLength())
      if (length != getMinLength())
        throw new ValidationException(String.format(SHOULD_BE_EXACTLY, getName(), getMaxLength()));
    if (length < getMinLength())
      throw new ValidationException(String.format(SHOULD_BE_LONGER, getName(), getMinLength()));
    if (length > getMaxLength())
      throw new ValidationException(String.format(SHOULD_BE_SHORTER, getName(), getMaxLength()));
  }
View Full Code Here

  protected void checkNoNullChars(String value)
      throws ValidationException
  {
    if (getNoNullChars())
      if (StringUtils.contains(value, CONSTANT.NULL_CHAR))
        throw new ValidationException(String.format(SHOULD_NOT_CONTAIN_NULL_CHARS, getName()));
  }
View Full Code Here

    {
      us = new UnsignedShort(port);
    }
    catch(NumberFormatException e)
    {
      throw new ValidationException("Number is not within valid TCP port range: " + port);
    }

    return validate(us).intValue();
  }
View Full Code Here

    for (int i = 0; i < value.length(); i++)
    {
      char ch = value.charAt(i);

      if (ch < 32 || ch > 126)
        throw new ValidationException(String.format(EncodedStringPropertyMetadata.CANNOT_CONTAIN, getName()) + "'" + ch + "'");
    }
  }
View Full Code Here

  protected void checkNotNull(T value)
      throws ValidationException
  {
    if (getNotNull())
      if (value == null)
        throw new ValidationException(String.format(SHOULD_NOT_BE_NULL, getName()));
  }
View Full Code Here

      throws ValidationException
  {
    // check conditions
    if (getMaxSize() == getMinSize())
      if (array.length() != getMaxSize())
        throw new ValidationException(String.format(SHOULD_BE_EXACTLY, getName()) + getMaxSize());

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

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

    val iterator = array.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

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.