org.hyperledger.fabric.contract.Context Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric-chaincode-shim Show documentation
Show all versions of fabric-chaincode-shim Show documentation
Hyperledger Fabric Java Chaincode Shim
/*
Copyright IBM Corp., DTCC All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.fabric.contract;
import org.hyperledger.fabric.shim.ChaincodeStub;
/**
*
* This context is available to all 'transaction functions' and provides the
* transaction context. It also provides access to the APIs for the world state
* using {@link #getStub()}
*
* Applications can implement their own versions if they wish to add
* functionality. All subclasses MUST implement a constructor, for example
*
* {@code
*
* public MyContext extends Context {
*
* public MyContext(ChaincodeStub stub) {
* super(stub);
* }
* }
*
*}
*
*
*/
public class Context {
protected ChaincodeStub stub;
/**
* Constructor
* @param stub Instance of the {@link ChaincodeStub} to use
*/
public Context(ChaincodeStub stub) {
this.stub = stub;
}
/**
*
* @return ChaincodeStub instance to use
*/
public ChaincodeStub getStub() {
return this.stub;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy