本文整理汇总了Java中com.ripple.core.fields.Field类的典型用法代码示例。如果您正苦于以下问题:Java Field类的具体用法?Java Field怎么用?Java Field使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Field类属于com.ripple.core.fields包,在下文中一共展示了Field类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCommonFields
import com.ripple.core.fields.Field; //导入依赖的package包/类
@Override
public void addCommonFields() {
put(Field.TransactionType, Requirement.REQUIRED);
put(Field.Account, Requirement.REQUIRED);
put(Field.Sequence, Requirement.REQUIRED);
put(Field.Fee, Requirement.REQUIRED);
put(Field.SigningPubKey, Requirement.REQUIRED);
put(Field.Flags, Requirement.OPTIONAL);
put(Field.SourceTag, Requirement.OPTIONAL);
put(Field.PreviousTxnID, Requirement.OPTIONAL);
put(Field.OperationLimit, Requirement.OPTIONAL);
put(Field.TxnSignature, Requirement.OPTIONAL);
put(Field.AccountTxnID, Requirement.OPTIONAL);
put(Field.LastLedgerSequence, Requirement.OPTIONAL);
put(Field.Memos, Requirement.OPTIONAL);
}
示例2: createdAccount
import com.ripple.core.fields.Field; //导入依赖的package包/类
public AccountID createdAccount() {
AccountID destination = null;
Hash256 destinationIndex = null;
if (transactionType() == TransactionType.Payment && meta.has(Field.AffectedNodes)) {
STArray affected = meta.get(STArray.AffectedNodes);
for (STObject node : affected) {
if (node.has(STObject.CreatedNode)) {
STObject created = node.get(STObject.CreatedNode);
if (STObject.ledgerEntryType(created) == LedgerEntryType.AccountRoot) {
if (destination == null) {
destination = txn.get(AccountID.Destination);
destinationIndex = Index.accountRoot(destination);
}
if (destinationIndex.equals(created.get(Hash256.LedgerIndex))) {
return destination;
}
}
}
}
}
return null;
}
示例3: modifiedRoots
import com.ripple.core.fields.Field; //导入依赖的package包/类
public Map<AccountID, STObject> modifiedRoots() {
HashMap<AccountID, STObject> accounts = null;
if (meta.has(Field.AffectedNodes)) {
accounts = new HashMap<AccountID, STObject>();
STArray affected = meta.get(STArray.AffectedNodes);
for (STObject node : affected) {
if (node.has(Field.ModifiedNode)) {
node = node.get(STObject.ModifiedNode);
if (STObject.ledgerEntryType(node) == LedgerEntryType.AccountRoot) {
STObject finalFields = node.get(STObject.FinalFields);
AccountID key;
if (finalFields != null) {
key = finalFields.get(AccountID.Account);
accounts.put(key, node);
}
}
}
}
}
return accounts;
}
示例4: cancelAllOffers
import com.ripple.core.fields.Field; //导入依赖的package包/类
private void cancelAllOffers(JSONObject data) throws JSONException {
JSONArray offers = data.optJSONArray("offers");
if (offers == null) {
log.info("There is no offer for account" + data.toString(4));
return;
}
int offersLength = offers.length();
for (int i = 0; i < offersLength; i++) {
JSONObject offer = offers.getJSONObject(i);
OfferCancel offerCancel = new OfferCancel();
offerCancel.account(rippleAccount.id());
offerCancel.put(Field.OfferSequence, new UInt32(offer.optString("seq")));
log.info("Cancell All Offers " + offerCancel.toJSON());
template.convertAndSend(Channels.OFFER_CANCEL, offerCancel.toJSON().toString());
}
}
示例5: add
import com.ripple.core.fields.Field; //导入依赖的package包/类
public void add(Field field, SerializedType value) {
addFieldHeader(field);
if (field.isVLEncoded()) {
addLengthEncoded(value);
} else {
value.toBytesSink(sink);
if (field.getType() == Type.STObject) {
addFieldHeader(Field.ObjectEndMarker);
} else if (field.getType() == Type.STArray) {
addFieldHeader(Field.ArrayEndMarker);
}
}
}
示例6: Format
import com.ripple.core.fields.Field; //导入依赖的package包/类
public Format(Object[] args) {
if ((!(args.length % 2 == 0)) || args.length < 2) {
throw new IllegalArgumentException("Varargs length should be a minimum multiple of 2");
}
for (int i = 0; i < args.length; i+= 2) {
Field f = (Field) args[i];
Requirement r = (Requirement) args[i + 1];
put(f, r);
}
}
示例7: signingHash
import com.ripple.core.fields.Field; //导入依赖的package包/类
public Hash256 signingHash() {
HalfSha512 signing = HalfSha512.prefixed256(HashPrefix.txSign);
toBytesSink(signing, new FieldFilter() {
@Override
public boolean evaluate(Field a) {
return a.isSigningField();
}
});
return signing.finish();
}
示例8: signingData
import com.ripple.core.fields.Field; //导入依赖的package包/类
public byte[] signingData() {
BytesList bl = new BytesList();
bl.add(HashPrefix.txSign.bytes);
toBytesSink(bl, new FieldFilter() {
@Override
public boolean evaluate(Field a) {
return a.isSigningField();
}
});
return bl.bytes();
}
示例9: readField
import com.ripple.core.fields.Field; //导入依赖的package包/类
public Field readField() {
int fieldCode = readFieldCode();
Field field = Field.fromCode(fieldCode);
if (field == null) {
throw new IllegalStateException("Couldn't parse field from " +
Integer.toHexString(fieldCode));
}
return field;
}
示例10: addFieldHeader
import com.ripple.core.fields.Field; //导入依赖的package包/类
public int addFieldHeader(Field f) {
if (!f.isSerialized()) {
throw new IllegalStateException(String.format("Field %s is a discardable field", f));
}
byte[] n = f.getBytes();
add(n);
return n.length;
}
示例11: blobField
import com.ripple.core.fields.Field; //导入依赖的package包/类
public static BlobField blobField(final Field f) {
return new BlobField() {
@Override
public Field getField() {
return f;
}
};
}
示例12: fromParser
import com.ripple.core.fields.Field; //导入依赖的package包/类
@Override
public STArray fromParser(BinaryParser parser, Integer hint) {
STArray stArray = new STArray();
while (!parser.end()) {
Field field = parser.readField();
if (field == Field.ArrayEndMarker) {
break;
}
STObject outer = new STObject();
// assert field.getType() == Type.STObject;
outer.put(field, STObject.translate.fromParser(parser));
stArray.add(STObject.formatted(outer));
}
return stArray;
}
示例13: ledgerFormatted
import com.ripple.core.fields.Field; //导入依赖的package包/类
private static STObject ledgerFormatted(STObject source, LedgerEntryType ledgerEntryType) {
STObject constructed = null;
switch (ledgerEntryType) {
case Offer:
constructed = new Offer();
break;
case RippleState:
constructed = new RippleState();
break;
case AccountRoot:
constructed = new AccountRoot();
break;
case Invalid:
break;
case DirectoryNode:
if (source.has(Field.Owner)) {
constructed = new DirectoryNode();
} else {
constructed = new OfferDirectory();
}
break;
case GeneratorMap:
break;
case Contract:
break;
case LedgerHashes:
constructed = new LedgerHashes();
break;
case Amendments:
break;
case FeeSettings:
break;
}
if (constructed == null) {
constructed = new LedgerEntry(ledgerEntryType);
}
constructed.fields = source.fields;
return constructed;
}
示例14: amountField
import com.ripple.core.fields.Field; //导入依赖的package包/类
private static AmountField amountField(final Field f) {
return new AmountField() {
@Override
public Field getField() {
return f;
}
};
}
示例15: accountField
import com.ripple.core.fields.Field; //导入依赖的package包/类
public static AccountIDField accountField(final Field f) {
return new AccountIDField() {
@Override
public Field getField() {
return f;
}
};
}