当前位置: 首页>>代码示例>>Java>>正文


Java Field类代码示例

本文整理汇总了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);
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:18,代码来源:TxFormat.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:24,代码来源:TransactionResult.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:24,代码来源:TransactionResult.java

示例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());
	}

}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:19,代码来源:RippleAccountOffersPublisher.java

示例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);
        }
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:14,代码来源:BinarySerializer.java

示例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);
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:11,代码来源:Format.java

示例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();
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:11,代码来源:Transaction.java

示例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();
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:12,代码来源:Transaction.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:11,代码来源:BinaryParser.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:BinarySerializer.java

示例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;
        }
    };
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:Blob.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:16,代码来源:STArray.java

示例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;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:41,代码来源:STObjectFormatter.java

示例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;
        }
    };
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:Amount.java

示例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;
        }
    };
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:AccountID.java


注:本文中的com.ripple.core.fields.Field类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。