com.openexchange.mail
Class Quota

java.lang.Object
  extended by com.openexchange.mail.Quota

public final class Quota
extends java.lang.Object

Quota

Author:
Thorben Betten

Nested Class Summary
static class Quota.Type
          Quota.Type - The quota resource type
 
Field Summary
static int UNLIMITED
          Constant which indicates unlimited quota
 
Constructor Summary
Quota(long limit, long usage, Quota.Type type)
          Initializes a new Quota
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 long getLimit()
          Gets the limit
 Quota.Type getType()
          Gets the quota's resource type to which this quota limitation applies
static Quota getUnlimitedQuota(Quota.Type type)
          Gets constant for unlimited quota for specified resource type This is a convenience method that invokes Quota.Type.getUnlimited() for specified instance of Quota.Type.
static Quota[] getUnlimitedQuotas(Quota.Type[] types)
          Gets constants for unlimited quota for specified resource types This is a convenience method that invokes Quota.Type.getUnlimited() for each type in given array of Quota.Type.
 long getUsage()
          Gets the usage
 int hashCode()
           
 long[] toLongArray()
          Returns a newly created array of long from this quota's limit and usage values.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNLIMITED

public static final int UNLIMITED
Constant which indicates unlimited quota

See Also:
Constant Field Values
Constructor Detail

Quota

public Quota(long limit,
             long usage,
             Quota.Type type)
Initializes a new Quota

Parameters:
limit - The quota's limit
usage - The quota's usage
type - The quota's resource type to which this quota limitation applies
Method Detail

getUnlimitedQuota

public static Quota getUnlimitedQuota(Quota.Type type)
Gets constant for unlimited quota for specified resource type

This is a convenience method that invokes Quota.Type.getUnlimited() for specified instance of Quota.Type.

Parameters:
type - The resource type
Returns:
The constant for unlimited quota for specified resource type

getUnlimitedQuotas

public static Quota[] getUnlimitedQuotas(Quota.Type[] types)
Gets constants for unlimited quota for specified resource types

This is a convenience method that invokes Quota.Type.getUnlimited() for each type in given array of Quota.Type.

Parameters:
types - The resource types
Returns:
The constants for unlimited quota for specified resource types

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getLimit

public long getLimit()
Gets the limit

Returns:
the limit

getUsage

public long getUsage()
Gets the usage

Returns:
the usage

getType

public Quota.Type getType()
Gets the quota's resource type to which this quota limitation applies

Returns:
The quota's resource type to which this quota limitation applies

toLongArray

public long[] toLongArray()
Returns a newly created array of long from this quota's limit and usage values. Quota's limit is at index 0 and its usage is located at index 1.

Returns:
An array of long from this quota's limit and usage.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object