Enum Price.PriceType
java.lang.Object
java.lang.Enum<Price.PriceType>
com.github.badpop.jcoinbase.model.data.Price.PriceType
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Price.PriceType>
,java.lang.constant.Constable
- Enclosing class:
- Price
public static enum Price.PriceType extends java.lang.Enum<Price.PriceType>
There is three types of prices in Coinbase : BUY, SELL and SPOT. This enum allow us to manage
these types in a more fluent way than simple strings representations.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description static Price.PriceType
fromString(java.lang.String type)
Retrieve a price type from a string representation.static io.vavr.control.Option<Price.PriceType>
fromStringToOption(java.lang.String type)
Retrieve a price type from a string representation.static java.util.Optional<Price.PriceType>
fromStringToOptional(java.lang.String type)
Retrieve a price type from a string representation.static Price.PriceType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Price.PriceType[]
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, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Enum Constant Details
-
BUY
-
SELL
-
SPOT
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
fromStringToOptional
Retrieve a price type from a string representation. This method return an Optional containing the founded PriceType, otherwise the Optional will be empty- Parameters:
type
- the string representation of the price type as given by the coinbase api- Returns:
- an Optional containing the founded PriceType or an empty Optional
-
fromStringToOption
Retrieve a price type from a string representation. This method return an Option containing * the founded PriceType, otherwise the Option will be empty- Parameters:
type
- the string representation of the price type as given by the coinbase api- Returns:
- a Vavr Option containing the founded price type or an empty Option
-
fromString
Retrieve a price type from a string representation. This method return the PriceType if exists or throws exception otherwise- Parameters:
type
- the string representation of the price type as given by the coinbase api- Returns:
- the founded PriceType or throws a
PriceTypeNotFoundException
-