Beispiel #1
0
  /**
   * Get a 8 bit signed integer (byte) parameter.
   *
   * @param key the key identifying the parameter
   * @param min the minimum allowed value, a {@link java.lang.IllegalArgumentException
   *     IllegalArgumentException} will be thrown if this constraint is violated
   * @param max the maximum allowed value, a {@link java.lang.IllegalArgumentException
   *     IllegalArgumentException} will be thrown if this constraint is violated
   * @param def the default value
   * @return the parameter value, a byte parsed from the configuration data
   */
  public final byte getByte(final String key, final byte min, final byte max, final byte def) {
    final String k;
    final Object v;
    final java.lang.Number number;

    k = Configuration.__checkKey(key);

    synchronized (this.m_data) {
      v = this.m_data.get(k);

      if (v == null) {
        return def;
      }

      number = new ByteParser(min, max).parse(v);

      if (number != v) {
        this.m_data.put(key, v);
      }
    }

    return number.byteValue();
  }