com.google.bitcoin.core
Enum Wallet.BalanceType

java.lang.Object
  extended by java.lang.Enum<Wallet.BalanceType>
      extended by com.google.bitcoin.core.Wallet.BalanceType
All Implemented Interfaces:
Serializable, Comparable<Wallet.BalanceType>
Enclosing class:
Wallet

public static enum Wallet.BalanceType
extends Enum<Wallet.BalanceType>

It's possible to calculate a wallets balance from multiple points of view. This enum selects which getBalance() should use.

Consider a real-world example: you buy a snack costing $5 but you only have a $10 bill. At the start you have $10 viewed from every possible angle. After you order the snack you hand over your $10 bill. From the perspective of your wallet you have zero dollars (AVAILABLE). But you know in a few seconds the shopkeeper will give you back $5 change so most people in practice would say they have $5 (ESTIMATED).


Enum Constant Summary
AVAILABLE
          Balance that can be safely used to create new spends.
ESTIMATED
          Balance calculated assuming all pending transactions are in fact included into the best chain by miners.
 
Method Summary
static Wallet.BalanceType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Wallet.BalanceType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ESTIMATED

public static final Wallet.BalanceType ESTIMATED
Balance calculated assuming all pending transactions are in fact included into the best chain by miners. This includes the value of immature coinbase transactions.


AVAILABLE

public static final Wallet.BalanceType AVAILABLE
Balance that can be safely used to create new spends. This is whatever the default coin selector would make available, which by default means transaction outputs with at least 1 confirmation and pending transactions created by our own wallet which have been propagated across the network.

Method Detail

values

public static Wallet.BalanceType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Wallet.BalanceType c : Wallet.BalanceType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Wallet.BalanceType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2014. All rights reserved.