com.atlassian.crowd.model.token
Class TokenLifetime

java.lang.Object
  extended by com.atlassian.crowd.model.token.TokenLifetime

public class TokenLifetime
extends Object

A value object that describes the requested lifetime of a new Token. Get an instance using the factory method, or use the default lifetime constant.


Field Summary
static TokenLifetime USE_DEFAULT
          Indicates that the token does not specify a concrete lifetime, and will use the default lifetime
 
Method Summary
 boolean equals(Object o)
           
 long getSeconds()
           
 int hashCode()
           
static TokenLifetime inSeconds(long seconds)
          Builds a new instance that represents a requested lifetime of a given number of seconds
 boolean isDefault()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_DEFAULT

public static final TokenLifetime USE_DEFAULT
Indicates that the token does not specify a concrete lifetime, and will use the default lifetime

Method Detail

getSeconds

public long getSeconds()
Returns:
the token lifetime in seconds
Throws:
IllegalStateException - if this is the default lifetime, i.e., it does not prescribe a particular duration

isDefault

public boolean isDefault()
Returns:
true if this is the default lifetime, i.e., it does not prescribe a particular duration

inSeconds

public static TokenLifetime inSeconds(long seconds)
Builds a new instance that represents a requested lifetime of a given number of seconds

Parameters:
seconds - requested token lifetime in seconds
Returns:
a new instance of TokenLifetime

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013 Atlassian. All Rights Reserved.