001/* 
002 * JKNIV, utils - Helper utilities for jdk code.
003 * 
004 * Copyright (C) 2017, the original author or authors.
005 *
006 * This library is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 2.1 of the License.
010 * 
011 * This library is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 * 
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with this library; if not, write to the Free Software Foundation, Inc., 
018 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
019 */
020package net.sf.jkniv.reflect;
021
022/**
023 * Create number instance representing a specific implementation.
024 * 
025 * @author Alisson Gomes
026 * @since 0.6.0
027 */
028public interface Numerical
029{
030    /**
031     * Returns a numerical object holding the value of the specified {@code Object.toString()}. 
032     * @param n the instance of object to be parsed to a number
033     * @return Return the parsed number
034     */
035    Number valueOf(Object n);
036
037    /**
038     * Returns a numerical object holding the value of the specified String. 
039     * @param n the string to be parsed to a number
040     * @return Return the parsed number
041     */
042    Number valueOf(String n);
043    
044    /**
045     * Returns a numerical object holding the value of the specified String. 
046     * @param n the number to be cast to specific number type
047     * @return Return the casted number
048     */
049    Number valueOf(Number n);
050    
051    /**
052     * The type of the number that this numerical implementation works
053     * @return class that represent a number.
054     */
055    Class<? extends Number> typeOf();
056}