org.apache.directory.server.kerberos.shared.messages.value.flags
Class AbstractKerberosFlags

java.lang.Object
  extended by org.apache.directory.shared.asn1.primitives.BitString
      extended by org.apache.directory.server.kerberos.shared.messages.value.flags.AbstractKerberosFlags
All Implemented Interfaces:
java.io.Serializable, KerberosFlags
Direct Known Subclasses:
TicketFlags

public abstract class AbstractKerberosFlags
extends org.apache.directory.shared.asn1.primitives.BitString
implements KerberosFlags

An implementation of a BitString for any KerberosFlags. The different values are stored in an int, as there can't be more than 32 flags (TicketFlag). Some basic operations are implemented in this abstract class, like those manipulating flags.

Version:
$Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
static int MAX_SIZE
          The maximum size of the BitString as specified for Kerberos flags.
protected  int value
          The associated value
 
Fields inherited from class org.apache.directory.shared.asn1.primitives.BitString
EMPTY_STRING, STREAMED
 
Constructor Summary
AbstractKerberosFlags()
          Standard constructor, which create a BitString containing 32 bits
AbstractKerberosFlags(byte[] flags)
          Standard constructor, taking a byte array
 
Method Summary
 void clearFlag(int flag)
          clear a flag in a list of flags
 void clearFlag(KerberosFlag flag)
          clear a flag in a list of flags
 byte[] getBytes()
           
static byte[] getBytes(int flags)
          A static method to get the bayte array representation of an int
 int getHexValue()
           
 int getIntValue()
          Returns the int value associated with the flags
 boolean isFlagSet(int flag)
          Check if a flag is set
static boolean isFlagSet(int flags, int flag)
          Check if a flag is set
 boolean isFlagSet(KerberosFlag flag)
          Check if a flag is set for the actual value
 void setFlag(int flag)
          Set a flag in a list of flags
 void setFlag(KerberosFlag flag)
          Set a flag in a list of flags
 void setFlags(byte[] bytes)
          Modify a byte array to an integer value
 
Methods inherited from class org.apache.directory.shared.asn1.primitives.BitString
clearBit, getBit, getData, getUnusedBits, isStreamed, setBit, setData, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SIZE

public static final int MAX_SIZE
The maximum size of the BitString as specified for Kerberos flags.

See Also:
Constant Field Values

value

protected int value
The associated value

Constructor Detail

AbstractKerberosFlags

public AbstractKerberosFlags()
Standard constructor, which create a BitString containing 32 bits


AbstractKerberosFlags

public AbstractKerberosFlags(byte[] flags)
Standard constructor, taking a byte array

Method Detail

getBytes

public static byte[] getBytes(int flags)
A static method to get the bayte array representation of an int

Returns:
The byte array for a list of flags.

getBytes

public byte[] getBytes()
Specified by:
getBytes in interface KerberosFlags
Returns:
The byte array for a KerberosFlags

getIntValue

public int getIntValue()
Returns the int value associated with the flags

Specified by:
getIntValue in interface KerberosFlags

isFlagSet

public static boolean isFlagSet(int flags,
                                int flag)
Check if a flag is set

Parameters:
flags - The flags to test
flag - The flag to check
Returns:
True if the flag is set in the list of flags

isFlagSet

public boolean isFlagSet(KerberosFlag flag)
Check if a flag is set for the actual value

Specified by:
isFlagSet in interface KerberosFlags
Parameters:
flag - The flag to check
Returns:
True if the flag is set in the list of flags

isFlagSet

public boolean isFlagSet(int flag)
Check if a flag is set

Specified by:
isFlagSet in interface KerberosFlags
Parameters:
flag - The flags to test
Returns:
True if the flag is set in the list of flags

setFlag

public void setFlag(KerberosFlag flag)
Set a flag in a list of flags

Specified by:
setFlag in interface KerberosFlags
Parameters:
flag - The flag to set

setFlag

public void setFlag(int flag)
Set a flag in a list of flags

Specified by:
setFlag in interface KerberosFlags
Parameters:
flag - The flag to set

setFlags

public void setFlags(byte[] bytes)
Modify a byte array to an integer value

Parameters:
bytes - The 4 bytes byte array to transform.

clearFlag

public void clearFlag(KerberosFlag flag)
clear a flag in a list of flags

Specified by:
clearFlag in interface KerberosFlags
Parameters:
flag - The flag to set

clearFlag

public void clearFlag(int flag)
clear a flag in a list of flags

Specified by:
clearFlag in interface KerberosFlags
Parameters:
flag - The flag to set

getHexValue

public int getHexValue()
Returns:
The hex value for this flag, in its position. For instance, getting the flag 5 will return 0x0000 0010


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.