org.deegree_impl.model.resources
Class Utilities

java.lang.Object
  extended byorg.deegree_impl.model.resources.Utilities

public final class Utilities
extends java.lang.Object

A set of miscellaneous methods.

Version:
1.0
Author:
Martin Desruisseaux

Field Summary
private static java.lang.String[] spacesFactory
          An array of strings containing only white spaces.
 
Constructor Summary
private Utilities()
          Forbive object creation.
 
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 isSubScript(char c)
          Determines whether the character is a subscript.
static boolean isSuperScript(char c)
          Determines whether the character is a superscript.
static java.lang.String spaces(int length)
          Returns a string of the specified length filled with white spaces.
static char toNormalScript(char c)
          Converts the character argument to normal script.
static char toSubScript(char c)
          Converts the character argument to subscript.
static char toSuperScript(char c)
          Converts the character argument to superscript.
static void unexpectedException(java.lang.String paquet, java.lang.String classe, java.lang.String method, java.lang.Throwable error)
          Invoked when an unexpected error occured.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spacesFactory

private static final java.lang.String[] spacesFactory
An array of strings containing only white spaces. String length are equal to their index + 1 in the spacesFactory array. For example, spacesFactory[4] contains a string of length 5. Strings are constructed only when first needed.

Constructor Detail

Utilities

private Utilities()
Forbive object creation.

Method Detail

isSuperScript

public static boolean isSuperScript(char c)
Determines whether the character is a superscript. Most superscripts have unicode value from \\u2070 to \\u207F inclusive. Superscripts are the following symbols:
 ? ¹ ² ³ ? ? ? ? ? ? ? ? ? ? ? ?
 


isSubScript

public static boolean isSubScript(char c)
Determines whether the character is a subscript. Most subscripts have unicode value from \\u2080 ti \\u208E inclusive. Subscripts are the following symbols:
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
 


toSuperScript

public static char toSuperScript(char c)
Converts the character argument to superscript. Only the following characters can be converted (other characters are left unchanged):
 0 1 2 3 4 5 6 7 8 9 + - = ( ) n
 


toSubScript

public static char toSubScript(char c)
Converts the character argument to subscript. Only the following characters can be converted (other characters are left unchanged):
 0 1 2 3 4 5 6 7 8 9 + - = ( ) n
 


toNormalScript

public static char toNormalScript(char c)
Converts the character argument to normal script.


spaces

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

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

getShortName

public static java.lang.String getShortName(java.lang.Class classe)
Returns a short class name for the specified class. This method will ommit the package name. For exemple, it will returns "String" instead of "java.lang.String" for a String object.

Parameters:
classe - The object (may be null).
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 ommit the package name. For exemple, it will returns "String" instead of "java.lang.String" for a String object.

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

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.


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 occured. The action taken by this method is implementation dependent. On JRE 1.4, it may record the error in the logging. On JRE 1.3, it may just dump the stack trace on the error stream.

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