Package org.hyperledger.fabric.contract
Class Context
- java.lang.Object
-
- org.hyperledger.fabric.contract.Context
-
public class Context extends java.lang.ObjectThis context is available to all 'transaction functions' and provides the transaction context. It also provides access to the APIs for the world state usinggetStub()Applications can implement their own versions if they wish to add functionality. All subclasses MUST implement a constructor, for example
public MyContext extends Context { public MyContext(ChaincodeStub stub) { super(stub); } }
-
-
Field Summary
Fields Modifier and Type Field Description protected ClientIdentityclientIdentityprotected ChaincodeStubstub
-
Constructor Summary
Constructors Constructor Description Context(ChaincodeStub stub)Creates new client identity and sets it as a property of the stub.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientIdentitygetClientIdentity()ChaincodeStubgetStub()
-
-
-
Field Detail
-
stub
protected ChaincodeStub stub
-
clientIdentity
protected ClientIdentity clientIdentity
-
-
Constructor Detail
-
Context
public Context(ChaincodeStub stub)
Creates new client identity and sets it as a property of the stub.- Parameters:
stub- Instance of theChaincodeStubto use
-
-
Method Detail
-
getStub
public ChaincodeStub getStub()
- Returns:
- ChaincodeStub instance to use
-
getClientIdentity
public ClientIdentity getClientIdentity()
- Returns:
- ClientIdentity object to use
-
-