Golibri

org.golibri.countries.be.socialsecurity
Class SocialSecurityNumber

java.lang.Object
  extended byorg.golibri.countries.be.socialsecurity.SocialSecurityNumber
All Implemented Interfaces:
java.io.Serializable

public class SocialSecurityNumber
extends java.lang.Object
implements java.io.Serializable

Number used by the social security to identify a single person The number consists out of the following elements

The number can be represented using the following formats

Author:
marc
See Also:
Serialized Form

Field Summary
static org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat DASH_LONG
           
static org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat DASH_SHORT
           
static org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat PLAIN
           
static org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat SPACE_LONG
           
static org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat SPACE_SHORT
           
 
Constructor Summary
SocialSecurityNumber(long value)
          Default constructor
SocialSecurityNumber(java.lang.String value)
          Default constructor
SocialSecurityNumber(java.lang.String value, org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat format)
          Default constructor
 
Method Summary
 boolean equals(java.lang.Object object)
           
 long getValue()
           
 int hashCode()
           
static boolean isValid(long value)
          Check if the value is a valid social security number To be valid the number needs to meet the following conditions not negative smaller than 9999999999 born before 2000 : check must equal 97 - (base modulo 97) born after 2000 : same check but a 2 is added in front of the base
 java.lang.String toString()
           
 java.lang.String toString(org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat format)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN

public static final org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat PLAIN

SPACE_SHORT

public static final org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat SPACE_SHORT

SPACE_LONG

public static final org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat SPACE_LONG

DASH_SHORT

public static final org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat DASH_SHORT

DASH_LONG

public static final org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat DASH_LONG
Constructor Detail

SocialSecurityNumber

public SocialSecurityNumber(long value)
Default constructor

Parameters:
value - Value of the social security number
Throws:
java.lang.IllegalArgumentException - When the number is not conform the rules

SocialSecurityNumber

public SocialSecurityNumber(java.lang.String value)
Default constructor

Parameters:
value - Value of the social security number
Throws:
java.lang.IllegalArgumentException - When the number is not conform the rules

SocialSecurityNumber

public SocialSecurityNumber(java.lang.String value,
                            org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat format)
Default constructor

Parameters:
value - Value of the social security number
Throws:
java.lang.IllegalArgumentException - When the number is not conform the rules
Method Detail

getValue

public long getValue()
Returns:
internal value

toString

public java.lang.String toString()
See Also:
Object.toString()

toString

public java.lang.String toString(org.golibri.countries.be.socialsecurity.SocialSecurityNumberFormat format)
Parameters:
format - to use
Returns:
social security number in the indicated format

equals

public boolean equals(java.lang.Object object)
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
See Also:
Object.hashCode()

isValid

public static boolean isValid(long value)
Check if the value is a valid social security number To be valid the number needs to meet the following conditions

Parameters:
value - The value to check.
Returns:
true When the value is conform the rules

Golibri