QJCC homepage

biz.chitec.quarterback.util
Class NameUtilities

java.lang.Object
  extended bybiz.chitec.quarterback.util.NameUtilities

public final class NameUtilities
extends java.lang.Object

Helper methods to handle names in one or the other manner.

Version:
$Id: dc6d9b0b49eec8fa2e24daad83cebe9dbf085aef $
Author:
cantamen/Dirk Hillbrecht 2006. Released under the LGPL.

Field Summary
static int ORDEREDBYNAME
           
static int ORDEREDBYPRENAME
           
 
Constructor Summary
private NameUtilities()
           
 
Method Summary
static java.lang.String combineNameAndPrename(int mode, java.util.Locale loc, java.lang.String name, java.lang.String prename)
          Combines a given name and a prename into one String while taking care for mode and locale.
static java.lang.String combineNameAndPrename(int mode, java.lang.String name, java.lang.String prename)
          Returns a combination of name and prename in the JVM's default locale.
static java.lang.String combineStreetAndStreetNumber(java.util.Locale loc, java.lang.String street, java.lang.String streetnumber)
          Combines a street name and a street number into one string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORDEREDBYNAME

public static final int ORDEREDBYNAME
See Also:
Constant Field Values

ORDEREDBYPRENAME

public static final int ORDEREDBYPRENAME
See Also:
Constant Field Values
Constructor Detail

NameUtilities

private NameUtilities()
Method Detail

combineNameAndPrename

public static java.lang.String combineNameAndPrename(int mode,
                                                     java.util.Locale loc,
                                                     java.lang.String name,
                                                     java.lang.String prename)
Combines a given name and a prename into one String while taking care for mode and locale. Mode indicates how the result should be ordered. Either the name or the prename should have precedence. Both name and prename can be empty or even null. In this case, only the non-empty part is printed and any part in between is omitted.

Note: Currently, the locale is not taken into consideration. The format is always either "Prename Name" or "Name, Prename".

Parameters:
mode - The mode to print the name and prename with. Should be one of the constants NameUtilities.ORDEREDBY(PRE)NAME.
loc - Locale to convert the name in.
name - (Sur)name of the person.
prename - Prename of the person.
Returns:
String combining name and prename in an appropriate manner.

combineNameAndPrename

public static java.lang.String combineNameAndPrename(int mode,
                                                     java.lang.String name,
                                                     java.lang.String prename)
Returns a combination of name and prename in the JVM's default locale.

Parameters:
mode - The mode to print the name and prename with. Should be one of the constants NameUtilities.ORDEREDBY(PRE)NAME.
name - (Sur)name of the person.
prename - Prename of the person.
Returns:
String combining name and prename in an appropriate manner.

combineStreetAndStreetNumber

public static java.lang.String combineStreetAndStreetNumber(java.util.Locale loc,
                                                            java.lang.String street,
                                                            java.lang.String streetnumber)
Combines a street name and a street number into one string. If the streetnumber is empty or null, it is omitted.

Parameters:
loc - Locale to use for combining.
street - Name of the street.
streetnumber - Number of the house in the street.
Returns:
Combination of street and street number, never null.

QJCC homepage