Package java.math

Examples of java.math.BigDecimal.shortValue()


            {
                return Byte.valueOf(value.byteValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_SHORT))
            {
                return Short.valueOf(value.shortValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_FLOAT))
            {
                return Float.valueOf(value.floatValue());
            }
View Full Code Here


            {
                return new Byte(value.byteValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_SHORT))
            {
                return new Short(value.shortValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_FLOAT))
            {
                return new Float(value.floatValue());
            }
View Full Code Here

  }
  /** Returns the value in short. If null, zero is returned.
   */
  public short shortValue() throws WrongValueException {
    final BigDecimal val = getValue();
    return val != null ? val.shortValue(): 0;
  }
  /** Sets the value (in BigDecimal).
   * @exception WrongValueException if value is wrong
   */
  public void setValue(BigDecimal value) throws WrongValueException {
View Full Code Here

                break;
            case NUMERIC_LONG:
                dcv.setNumericValue( value == null ? null : value.longValue() );
                break;
            case NUMERIC_SHORT:
                dcv.setNumericValue( value == null ? null : value.shortValue() );
                break;
        }

    }
View Full Code Here

            BigDecimal val = lexer.decimalValue();
            lexer.nextToken(JSONToken.COMMA);

            if (clazz == short.class || clazz == Short.class) {
                return (T) Short.valueOf(val.shortValue());
            }

            if (clazz == byte.class || clazz == Byte.class) {
                return (T) Byte.valueOf(val.byteValue());
            }
View Full Code Here

    assertEquals("incorrect scale", resScale, result.scale());
  }

  public void testShortValue() {
    BigDecimal value = BigDecimal.valueOf(0x13fff);
    assertEquals(0x3fff, value.shortValue());
    try {
      value.shortValueExact();
      fail("Expected ArithmeticException");
    } catch (ArithmeticException expected) {
    }
View Full Code Here

            } else if (BigInteger.class.equals(type)) {
                return type.cast(convertedValue.toBigInteger());
            } else if (BigDecimal.class.equals(type)) {
                return type.cast(convertedValue);
            } else if (Short.class.equals(type) || short.class.equals(type)) {
                return type.cast(convertedValue.shortValue());
            } else if (Byte.class.equals(type) || byte.class.equals(type)) {
                return type.cast(convertedValue.byteValue());
            }
        } else if(Enum.class.isAssignableFrom(type)) {
            return type.cast(Enum.valueOf((Class)type, value));
View Full Code Here

                break;
            case NUMERIC_LONG :
                dcv.setNumericValue( value == null ? null : value.longValue() );
                break;
            case NUMERIC_SHORT :
                dcv.setNumericValue( value == null ? null : value.shortValue() );
                break;
        }

    }
View Full Code Here

                break;
            case NUMERIC_LONG:
                dcv.setNumericValue( value == null ? null : value.longValue() );
                break;
            case NUMERIC_SHORT:
                dcv.setNumericValue( value == null ? null : value.shortValue() );
                break;
        }

    }
View Full Code Here

                break;
            case NUMERIC_LONG:
                dcv.setNumericValue( value == null ? null : value.longValue() );
                break;
            case NUMERIC_SHORT:
                dcv.setNumericValue( value == null ? null : value.shortValue() );
                break;
        }

    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.