Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.attr
Class HexBinaryAttribute  view HexBinaryAttribute download HexBinaryAttribute.java

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeValue
      extended bycom.sun.xacml.attr.HexBinaryAttribute
All Implemented Interfaces:
com.sun.xacml.cond.Evaluatable

public class HexBinaryAttribute
extends AttributeValue

Representation of an xsi:hexBinary value. This class supports parsing xsi:hexBinary values. All objects of this class are immutable and all methods of the class are thread-safe.

Since:
1.0

Field Summary
private static java.lang.RuntimeException earlyException
          RuntimeException that wraps an Exception thrown during the creation of identifierURI, null if none.
static java.lang.String identifier
          Official name of this type
private static java.net.URI identifierURI
          URI version of name for this type
private  java.lang.String strValue
          The value returned by toString().
private  byte[] value
          The actual binary value that this object represents.
 
Fields inherited from class com.sun.xacml.attr.AttributeValue
 
Constructor Summary
HexBinaryAttribute(byte[] value)
          Creates a new HexBinaryAttribute that represents the byte [] value supplied.
 
Method Summary
private static java.lang.String binToHex(byte[] bytes)
          Return a straight hexadecimal conversion of a byte array.
private static char binToHexNibble(int nibble)
          Return the hex character for a particular nibble (half a byte).
 java.lang.String encode()
          Encodes the value in a form suitable for including in XML data like a request or an obligation.
 boolean equals(java.lang.Object o)
          Returns true if the input is an instance of this class and if its value equals the value contained in this class.
static HexBinaryAttribute getInstance(org.w3c.dom.Node root)
          Returns a new HexBinaryAttribute that represents the xsi:hexBinary at a particular DOM node.
static HexBinaryAttribute getInstance(java.lang.String value)
          Returns a new HexBinaryAttribute that represents the xsi:hexBinary value indicated by the string provided.
 byte[] getValue()
          Returns the byte [] value represented by this object.
 int hashCode()
          Returns the hashcode value used to index and compare this object with others of the same type.
private static byte[] hexToBin(java.lang.String hex)
          Parse a hex string, returning a new byte array containing the value.
private static int hexToBinNibble(char c)
          Return the int value of a hex character.
 java.lang.String toString()
          Returns a String representation.
 
Methods inherited from class com.sun.xacml.attr.AttributeValue
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

identifier

public static final java.lang.String identifier
Official name of this type

See Also:
Constant Field Values

identifierURI

private static java.net.URI identifierURI
URI version of name for this type

This field is initialized by a static initializer so that we can catch any exceptions thrown by URI(String) and transform them into a RuntimeException, since this should never happen but should be reported properly if it ever does.


earlyException

private static java.lang.RuntimeException earlyException
RuntimeException that wraps an Exception thrown during the creation of identifierURI, null if none.


value

private byte[] value
The actual binary value that this object represents.


strValue

private java.lang.String strValue
The value returned by toString(). Cached, but only generated if needed.

Constructor Detail

HexBinaryAttribute

public HexBinaryAttribute(byte[] value)
Creates a new HexBinaryAttribute that represents the byte [] value supplied.

Method Detail

getInstance

public static HexBinaryAttribute getInstance(org.w3c.dom.Node root)
                                      throws com.sun.xacml.ParsingException
Returns a new HexBinaryAttribute that represents the xsi:hexBinary at a particular DOM node.


getInstance

public static HexBinaryAttribute getInstance(java.lang.String value)
                                      throws com.sun.xacml.ParsingException
Returns a new HexBinaryAttribute that represents the xsi:hexBinary value indicated by the string provided.


getValue

public byte[] getValue()
Returns the byte [] value represented by this object. Note that this value is cloned before returning to prevent unauthorized modifications.


hashCode

public int hashCode()
Returns the hashcode value used to index and compare this object with others of the same type. Typically this is the hashcode of the backing data object.


equals

public boolean equals(java.lang.Object o)
Returns true if the input is an instance of this class and if its value equals the value contained in this class.


hexToBinNibble

private static int hexToBinNibble(char c)
Return the int value of a hex character. Return -1 if the character is not a valid hex character.


hexToBin

private static byte[] hexToBin(java.lang.String hex)
Parse a hex string, returning a new byte array containing the value. Return null in case of a parsing error.


binToHexNibble

private static char binToHexNibble(int nibble)
Return the hex character for a particular nibble (half a byte).


binToHex

private static java.lang.String binToHex(byte[] bytes)
Return a straight hexadecimal conversion of a byte array. This is a String containing only hex digits.


toString

public java.lang.String toString()
Returns a String representation.


encode

public java.lang.String encode()
Description copied from class: AttributeValue
Encodes the value in a form suitable for including in XML data like a request or an obligation. This must return a value that could in turn be used by the factory to create a new instance with the same value.

Specified by:
encode in class AttributeValue