Ejemplo n.º 1
0
  /**
   * Casts the specified value to String data type.
   *
   * @see DataType#STRING
   */
  private static String toString(Object value) {

    if (value instanceof String) {
      return (String) value;
    } else if ((value instanceof Double)
        || (value instanceof Float)
        || (value instanceof Integer)) {
      Number number = (Number) value;

      return number.toString();
    }

    throw new TypeCheckException(DataType.STRING, value);
  }