IBlock
ChangeBlock
, OpenBlock
, ReceiveBlock
, SendBlock
, StateBlock
public abstract class Block extends Object implements IBlock
Modifier | Constructor | Description |
---|---|---|
protected |
Block(BlockType type) |
|
|
Block(BlockType type,
String hash,
com.google.gson.JsonObject jsonRepresentation,
String signature,
WorkSolution workSolution) |
Deprecated, for removal: This API element is subject to removal in a future version.
|
|
Block(BlockType type,
String hash,
String signature,
WorkSolution workSolution) |
Modifier and Type | Method | Description |
---|---|---|
protected byte[] |
calculateHashBytes() |
|
boolean |
equals(Object o) |
|
protected abstract byte[][] |
generateHashables() |
|
String |
getHash() |
Returns the block hash, or attempts to calculate it if the hash value was not present.
|
byte[] |
getHashBytes() |
|
com.google.gson.JsonObject |
getJsonObject() |
|
com.google.gson.JsonObject |
getJsonObject(boolean fillBlanks) |
|
String |
getSignature() |
|
BlockType |
getType() |
|
WorkSolution |
getWorkSolution() |
|
int |
hashCode() |
|
boolean |
isComplete() |
Returns whether or not this object contains all the necessary fields to be a block.
|
static Block |
parse(com.google.gson.JsonObject json) |
Parses a block from a given
JsonObject instance. |
static Block |
parse(String json) |
Parses a block from a given JSON string.
|
String |
toJsonString() |
|
String |
toJsonString(boolean fillBlanks) |
|
String |
toString() |
protected Block(BlockType type)
@Deprecated(forRemoval=true) public Block(BlockType type, String hash, com.google.gson.JsonObject jsonRepresentation, String signature, WorkSolution workSolution)
public Block(BlockType type, String hash, String signature, WorkSolution workSolution)
public final String getHash()
public final byte[] getHashBytes()
public final BlockType getType()
public final String getSignature()
getSignature
in interface IBlock
public final WorkSolution getWorkSolution()
getWorkSolution
in interface IBlock
public boolean isComplete()
protected abstract byte[][] generateHashables()
protected final byte[] calculateHashBytes()
public final String toJsonString()
public final String toJsonString(boolean fillBlanks)
fillBlanks
- if true, null properties will be filled with dummy datapublic final com.google.gson.JsonObject getJsonObject()
JsonObject
public final com.google.gson.JsonObject getJsonObject(boolean fillBlanks)
fillBlanks
- if true, null properties will be filled with dummy dataJsonObject
public static Block parse(String json)
json
- the json to parse fromBlockDeserializer
public static Block parse(com.google.gson.JsonObject json)
JsonObject
instance.json
- the json to parse fromBlockDeserializer
Copyright © 2020. All rights reserved.