All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jd.blockchain.ledger.TransactionPrivilegeBitset Maven / Gradle / Ivy

There is a newer version: 1.6.5.RELEASE
Show newest version
package com.jd.blockchain.ledger;

import java.util.ArrayList;
import java.util.List;

import utils.StringUtils;

public class TransactionPrivilegeBitset extends PrivilegeBitset implements TransactionPrivilege {

	public TransactionPrivilegeBitset() {
	}

	public TransactionPrivilegeBitset(byte[] codeBytes) {
		super(codeBytes);
	}

	@Override
	public TransactionPrivilegeBitset clone() {
		return (TransactionPrivilegeBitset) super.clone();
	}


	public List getPrivilege(){
		List permissionList = new ArrayList<>();
		String permissionStr = super.cloneBitSet().get(8,Integer.MAX_VALUE).toString();
		if(!StringUtils.isEmpty(permissionStr)){
			for (TransactionPermission transactionPermission : TransactionPermission.values()){
				if(super.cloneBitSet().get(8,Integer.MAX_VALUE).get(transactionPermission.CODE)){
					permissionList.add(transactionPermission);
				}
			}
		}
		return permissionList;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy