The Numbers
class does not use ObjectConverter
anymore.
The Numbers
class has been intentionally restricted to primitive types,
with sometime the addition of String
. Other types like BigDecimal
are not the purpose of this class anymore, but are rather delegated to the more heavy
ConverterRegistry
class.
Command line:
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r27595:27596 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/resources/ClassChanger.java
Revision 27595 | Revision 27596 |
---|---|
if (object instanceof Number) {
return (Number) object;
}
return getClassChanger(object.getClass()).convert(object);
}
return null;
} |
if (object instanceof Number) { return (Number) object; } ClassChanger changer = getClassChanger(object.getClass()); return changer.convert(object); } return null; } |
* @param classe The desired classe for return value. * @throws ClassNotFoundException if {@code classe} is not a registered class. */ public static <C extends Comparable> C toComparable(final Number value, final Class<C> classe) throws ClassNotFoundException { |
* @param classe The desired classe for return value.
* @throws ClassNotFoundException if {@code classe} is not a registered class.
*/
@SuppressWarnings("unchecked")
public static <C extends Comparable> C toComparable(final Number value, final Class<C> classe)
throws ClassNotFoundException
{ |
if (Number.class.isAssignableFrom(classe)) { return classe.cast(value); } @SuppressWarnings("unchecked") final Comparable<?> c = getClassChanger(classe).inverseConvert(value); return classe.cast(c); } return null; |
if (Number.class.isAssignableFrom(classe)) { return classe.cast(value); } ClassChanger changer = getClassChanger(classe); final Comparable c = changer.inverseConvert(value); return classe.cast(c); } return null; |