Here you can find the source of isBigDecimal(final N number)
Parameter | Description |
---|---|
number | The number to check |
N | The type of the number |
public static <N extends Number> boolean isBigDecimal(final N number)
//package com.java2s; /*/* ww w . j a v a2 s . c om*/ * #%L * utils-commons * %% * Copyright (C) 2016 - 2018 Gilles Landel * %% * 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://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License 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. * #L% */ import java.math.BigDecimal; public class Main { /** * Check if the number is a {@link BigDecimal} * * @param number * The number to check * @param <N> * The type of the number * @return true, if matches */ public static <N extends Number> boolean isBigDecimal(final N number) { return isNumberType(number, BigDecimal.class); } private static <N extends Number> boolean isNumberType(final N number, final Class<? extends Number> classNumber) { return number != null && classNumber.isAssignableFrom(number.getClass()); } }