com.nimbusds.jose
Class Algorithm

java.lang.Object
  extended by com.nimbusds.jose.Algorithm
All Implemented Interfaces:
net.minidev.json.JSONAware
Direct Known Subclasses:
EncryptionMethod, JWEAlgorithm, JWSAlgorithm

@Immutable
public class Algorithm
extends Object
implements net.minidev.json.JSONAware

The base class for algorithm names, with optional implementation requirement. This class is immutable.

Includes constants for the following standard algorithm names:

Version:
$version$ (2013-03-27)
Author:
Vladimir Dzhuvinov

Field Summary
static Algorithm NONE
          No algorithm (plain JOSE object without signature / encryption).
 
Constructor Summary
Algorithm(String name)
          Creates a new JOSE algorithm name.
Algorithm(String name, Requirement req)
          Creates a new JOSE algorithm name.
 
Method Summary
 boolean equals(Object object)
          Overrides Object.equals().
 String getName()
          Gets the name of this algorithm.
 Requirement getRequirement()
          Gets the implementation requirement of this algorithm.
 int hashCode()
          Overrides Object.hashCode().
 String toJSONString()
          Returns the JSON string representation of this algorithm.
 String toString()
          Returns the string representation of this algorithm.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Algorithm NONE
No algorithm (plain JOSE object without signature / encryption).

Constructor Detail

Algorithm

public Algorithm(String name,
                 Requirement req)
Creates a new JOSE algorithm name.

Parameters:
name - The algorithm name. Must not be null.
req - The implementation requirement, null if not known.

Algorithm

public Algorithm(String name)
Creates a new JOSE algorithm name.

Parameters:
name - The algorithm name. Must not be null.
Method Detail

getName

public final String getName()
Gets the name of this algorithm.

Returns:
The algorithm name.

getRequirement

public final Requirement getRequirement()
Gets the implementation requirement of this algorithm.

Returns:
The implementation requirement, null if not known.

hashCode

public final int hashCode()
Overrides Object.hashCode().

Overrides:
hashCode in class Object
Returns:
The object hash code.

equals

public boolean equals(Object object)
Overrides Object.equals().

Overrides:
equals in class Object
Parameters:
object - The object to compare to.
Returns:
true if the objects have the same value, otherwise false.

toString

public final String toString()
Returns the string representation of this algorithm.

Overrides:
toString in class Object
Returns:
The string representation.
See Also:
getName()

toJSONString

public final String toJSONString()
Returns the JSON string representation of this algorithm.

Specified by:
toJSONString in interface net.minidev.json.JSONAware
Returns:
The JSON string representation.


Copyright © 2013 NimbusDS. All Rights Reserved.