org.entityfs.entityattrs
Class UidGid

java.lang.Object
  extended by org.entityfs.entityattrs.UidGid

public final class UidGid
extends Object

Simple, immutable object that contains a user id (UID) and a group id (GID).

UID:s and GID:s are positive integer values.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-core

Constructor Summary
UidGid(int uid, int gid)
          Create a UidGid object without secondary GID:s
UidGid(int uid, int gid, Collection<Integer> secondaryGids)
           
 
Method Summary
 boolean equals(Object o)
           
 int getPrimaryGid()
          Get the primary GID.
 Set<Integer> getSecondaryGids()
           
 int getUid()
          Get the UID.
 int hashCode()
           
 String toString()
           
static void validateGid(int gid)
          Validate a GID.
static void validateUid(int uid)
          Validate a UID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UidGid

public UidGid(int uid,
              int gid)
       throws IllegalArgumentException
Create a UidGid object without secondary GID:s

Parameters:
uid - The user id.
gid - The primary group id.
Throws:
IllegalArgumentException - If the UID or the GID is less than zero.

UidGid

public UidGid(int uid,
              int gid,
              Collection<Integer> secondaryGids)
       throws IllegalArgumentException
Throws:
IllegalArgumentException
Method Detail

validateUid

public static void validateUid(int uid)
                        throws IllegalArgumentException
Validate a UID.

Parameters:
uid - The UID to validate.
Throws:
IllegalArgumentException - If the UID is less than zero

validateGid

public static void validateGid(int gid)
                        throws IllegalArgumentException
Validate a GID.

Parameters:
gid - The GID to validate.
Throws:
IllegalArgumentException - If the GID is less than zero

getUid

public int getUid()
Get the UID.

Returns:
The UID.

getPrimaryGid

public int getPrimaryGid()
Get the primary GID.

Returns:
The primary GID.

getSecondaryGids

public Set<Integer> getSecondaryGids()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object