Java BigDecimal tryToStoreAsIntegerBigDecimal(Object ob)

Here you can find the source of tryToStoreAsIntegerBigDecimal(Object ob)

Description

try To Store As Integer Big Decimal

License

Apache License

Declaration

private static BigDecimal tryToStoreAsIntegerBigDecimal(Object ob) 

Method Source Code

//package com.java2s;
/**/*  w ww  .  ja va 2s.  c  om*/
 * *****************************************************************************
 * Copyright 2007 Amazon Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License");
 *
 * You may not use this file except in compliance with the License. You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 This file is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 * ***************************************************************************** __ _ _ ___ ( )( \/\/ )/ __) /__\ \ / \__ \ (_)(_) \/\/ (___/
 *
 * Amazon Simple DB Java Library API Version: 2007-11-07 Generated: Fri Jan 18 01:13:17 PST 2008
 *
 */

import java.math.BigDecimal;

public class Main {
    private static BigDecimal tryToStoreAsIntegerBigDecimal(Object ob) {
        BigDecimal bigDecimal = null;
        if (canBeStoredAsIntegerBigDecimal(ob)) {
            bigDecimal = new BigDecimal(ob.toString());
        }

        return bigDecimal;
    }

    private static boolean canBeStoredAsIntegerBigDecimal(Object ob) {
        return ob instanceof Number && !(ob instanceof Float || ob instanceof Double);
    }
}

Related

  1. tangent(BigDecimal x)
  2. tanto(BigDecimal r, BigDecimal n)
  3. textToBigDecimal(String amountAsText)
  4. transferDonateAmount2Point(BigDecimal donateAmount)
  5. tryParseBigDecimal(Object val, BigDecimal defaultVal)
  6. tryToStoreAsRealBigDecimal(Object ob)
  7. unformattedFromBigDecimal(BigDecimal n)
  8. unformattedToBigDecimal(String str)
  9. valueOf(final BigDecimal value)