Package propel.core.userTypes

Examples of propel.core.userTypes.UnsignedShort


    if (targetType.equals(Int128.class))
      return bool ? new Int128("1") : new Int128("0");
    if (targetType.equals(UnsignedByte.class))
      return bool ? new UnsignedByte((byte) 1) : new UnsignedByte((byte) 0);
    if (targetType.equals(UnsignedShort.class))
      return bool ? new UnsignedShort(1) : new UnsignedShort(0);
    if (targetType.equals(UnsignedInteger.class))
      return bool ? new UnsignedInteger(1) : new UnsignedInteger(0);
    if (targetType.equals(UnsignedLong.class))
      return bool ? new UnsignedLong("1") : new UnsignedLong("0");
    if (targetType.equals(SignedByte.class))
View Full Code Here


    if (targetType.equals(Int128.class))
      return StringUtils.parseInt128(str);
    if (targetType.equals(UnsignedByte.class))
      return new UnsignedByte(str);
    if (targetType.equals(UnsignedShort.class))
      return new UnsignedShort(str);
    if (targetType.equals(UnsignedInteger.class))
      return new UnsignedInteger(str);
    if (targetType.equals(UnsignedLong.class))
      return new UnsignedLong(str);
    if (targetType.equals(SignedByte.class))
View Full Code Here

  @Validate
  public static UnsignedShort parseUInt16(@NotNull final String value, @NotNull final UnsignedShort minValue,
                                          @NotNull final UnsignedShort maxValue)
  {
    // parse
    UnsignedShort result;
    try
    {
      result = new UnsignedShort(value);
    }
    catch(Throwable e)
    {
      throw new NumberFormatException("The value '" + value + "' could not be parsed: " + e.getMessage());
    }

    // sanity check
    if (result.compareTo(minValue) < 0)
      throw new NumberFormatException("Value (" + result + ") was less than allowed minimum (" + minValue + ").");
    if (result.compareTo(maxValue) > 0)
      throw new NumberFormatException("Value (" + result + ") was more than allowed maximum (" + maxValue + ").");

    return result;
  }
View Full Code Here

      value = reverse(value);

    BigInteger result = BigInteger.ZERO;
    result = result.or(new BigInteger(CONSTANT.EMPTY_STRING + (((value[0] & 0xff) << 8) | (value[1] & 0xff))));

    return new UnsignedShort(result);
  }
View Full Code Here

  public static UnsignedShort bytesToUInt16(byte[] ba)
  {
    if (ba == null)
      throw new NullPointerException("ba");

    UnsignedShort hash = new UnsignedShort("5381");

    for (byte b : ba)
    {
      BigInteger bi = hash.bigIntegerValue();
      hash = new UnsignedShort(bi.shiftLeft(5).add(bi).add(new BigInteger(Integer.toString(0xFF & b))));
    }

    return hash;
  }
View Full Code Here

   * @throws IllegalArgumentException And argument is invalid
   * @throws NumberFormatException A number is invalid
   */
  public PortPropertyMetadata(String name, int minPort, int maxPort)
  {
    super(name, new UnsignedShort(minPort), new UnsignedShort(maxPort), true);
  }
View Full Code Here

   * @throws ValidationException A validation error occurs
   */
  public int validate(int port)
      throws ValidationException
  {
    UnsignedShort us;
    try
    {
      us = new UnsignedShort(port);
    }
    catch(NumberFormatException e)
    {
      throw new ValidationException("Number is not within valid TCP port range: " + port);
    }
View Full Code Here

TOP

Related Classes of propel.core.userTypes.UnsignedShort

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.