org.geotools.resources
Class Utilities

java.lang.Object
  extended byorg.geotools.resources.Utilities

public final class Utilities
extends java.lang.Object

A set of miscellaneous methods.

Since:
2.0
Version:
$Id: Utilities.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Method Summary
static boolean equals(java.lang.Object object1, java.lang.Object object2)
          Convenience method for testing two objects for equality.
static java.lang.String getShortClassName(java.lang.Object object)
          Returns a short class name for the specified object.
static java.lang.String getShortName(java.lang.Class classe)
          Returns a short class name for the specified class.
static boolean sameInterfaces(java.lang.Class object1, java.lang.Class object2, java.lang.Class base)
          Returns if the two specified objects implements exactly the same set of interfaces.
static java.lang.String spaces(int length)
          Returns a string of the specified length filled with white spaces.
static void unexpectedException(java.lang.String paquet, java.lang.String classe, java.lang.String method, java.lang.Throwable error)
          Invoked when an unexpected error occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public static boolean equals(java.lang.Object object1,
                             java.lang.Object object2)
Convenience method for testing two objects for equality. One or both objects may be null.


sameInterfaces

public static boolean sameInterfaces(java.lang.Class object1,
                                     java.lang.Class object2,
                                     java.lang.Class base)
Returns if the two specified objects implements exactly the same set of interfaces. Only interfaces assignable to are compared. Declaration order doesn't matter. For example in ISO 19111, different interfaces exist for different coordinate system geometries (, , etc.). We can check if two CS implementations has the same geometry with the following code:
if (sameInterfaces(cs1, cs2, CoordinateSystem.class))


spaces

public static java.lang.String spaces(int length)
Returns a string of the specified length filled with white spaces. This method tries to return a pre-allocated string if possible.

Parameters:
length - The string length. Negative values are clamped to 0.
Returns:
A string of length filled with white spaces.

getShortName

public static java.lang.String getShortName(java.lang.Class classe)
Returns a short class name for the specified class. This method will omit the package name. For example, it will return "String" instead of "java.lang.String" for a String object. It will also name array according Java language usage, for example "double[]" instead of "[D".

Parameters:
classe - The object class (may be ).
Returns:
A short class name for the specified object.

getShortClassName

public static java.lang.String getShortClassName(java.lang.Object object)
Returns a short class name for the specified object. This method will omit the package name. For example, it will return "String" instead of "java.lang.String" for a String object.

Parameters:
object - The object (may be ).
Returns:
A short class name for the specified object.

unexpectedException

public static void unexpectedException(java.lang.String paquet,
                                       java.lang.String classe,
                                       java.lang.String method,
                                       java.lang.Throwable error)
Invoked when an unexpected error occurs.

Parameters:
paquet - The package where the error occurred. This information may be used to fetch an appropriate Logger for logging the error.
classe - The class name where the error occurred.
method - The method name where the error occurred.
error - The error.


Copyright © GeoTools. All Rights Reserved.