本文整理汇总了Java中org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode类的典型用法代码示例。如果您正苦于以下问题:Java Iso4217CurrencyCode类的具体用法?Java Iso4217CurrencyCode怎么用?Java Iso4217CurrencyCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Iso4217CurrencyCode类属于org.bouncycastle.asn1.x509.qualified包,在下文中一共展示了Iso4217CurrencyCode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkValues
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
private void checkValues(
MonetaryValue mv,
int amount,
int exponent)
{
if (mv.getAmount().intValue() != amount)
{
fail("amounts don't match.");
}
if (mv.getExponent().intValue() != exponent)
{
fail("exponents don't match.");
}
Iso4217CurrencyCode cc = mv.getCurrency();
if (!cc.getAlphabetic().equals(CURRENCY_CODE))
{
fail("currency code wrong");
}
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:23,代码来源:MonetaryValueUnitTest.java
示例2: MonetaryValueOption
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
public MonetaryValueOption(Iso4217CurrencyCode currency, Range2Type amountRange,
Range2Type exponentRange) {
this.currency = ParamUtil.requireNonNull("currency", currency);
this.amountRange = ParamUtil.requireNonNull("amountRange", amountRange);
this.exponentRange = ParamUtil.requireNonNull("exponentRange", exponentRange);
this.currencyString = currency.isAlphabetic() ? currency.getAlphabetic().toUpperCase()
: Integer.toString(currency.getNumeric());
}
开发者ID:xipki,项目名称:xipki,代码行数:10,代码来源:MonetaryValueOption.java
示例3: performTest
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
public void performTest()
throws Exception
{
MonetaryValue mv = new MonetaryValue(new Iso4217CurrencyCode(CURRENCY_CODE), TEST_AMOUNT, ZERO_EXPONENT);
checkValues(mv, TEST_AMOUNT, ZERO_EXPONENT);
mv = MonetaryValue.getInstance(mv);
checkValues(mv, TEST_AMOUNT, ZERO_EXPONENT);
ASN1InputStream aIn = new ASN1InputStream(mv.toASN1Object().getEncoded());
ASN1Sequence seq = (ASN1Sequence)aIn.readObject();
mv = MonetaryValue.getInstance(seq);
checkValues(mv, TEST_AMOUNT, ZERO_EXPONENT);
mv = MonetaryValue.getInstance(null);
if (mv != null)
{
fail("null getInstance() failed.");
}
try
{
MonetaryValue.getInstance(new Object());
fail("getInstance() failed to detect bad object.");
}
catch (IllegalArgumentException e)
{
// expected
}
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:38,代码来源:MonetaryValueUnitTest.java
示例4: checkNumeric
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
private void checkNumeric(
Iso4217CurrencyCode cc,
String code)
{
if (!cc.isAlphabetic())
{
fail("non-alphabetic code found when one expected.");
}
if (!cc.getAlphabetic().equals(code))
{
fail("string codes don't match.");
}
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:15,代码来源:Iso4217CurrencyCodeUnitTest.java
示例5: getMonetaryValueStringValue
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
private String getMonetaryValueStringValue(ASN1Encodable asn1Encodable, int baseIndentLevel) {
// @formatter:off
/*
MonetaryValue ::= SEQUENCE
{
currency Iso4217CurrencyCode,
amount INTEGER,
exponent INTEGER
}
Iso4217CurrencyCode ::= CHOICE
{
alphabetic PrintableString,
numeric INTEGER(1..999)
}
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
MonetaryValue monetaryValue = MonetaryValue.getInstance(asn1Encodable);
BigInteger amount = monetaryValue.getAmount();
Iso4217CurrencyCode currency = monetaryValue.getCurrency();
BigInteger exponent = monetaryValue.getExponent();
if (currency != null) {
String currencyString = currency.isAlphabetic() ? currency.getAlphabetic() : "" + currency.getNumeric();
sb.append(INDENT.toString(baseIndentLevel));
sb.append(MessageFormat.format(res.getString("QCEuLimitValue.Currency"), currencyString));
sb.append(NEWLINE);
}
if (amount != null) {
sb.append(INDENT.toString(baseIndentLevel));
sb.append(MessageFormat.format(res.getString("QCEuLimitValue.Amount"), amount.toString()));
sb.append(NEWLINE);
}
if (exponent != null) {
sb.append(INDENT.toString(baseIndentLevel));
sb.append(MessageFormat.format(res.getString("QCEuLimitValue.Exponent"), exponent.toString()));
sb.append(NEWLINE);
}
return sb.toString();
}
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:49,代码来源:X509Ext.java
示例6: currency
import org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode; //导入依赖的package包/类
public Iso4217CurrencyCode currency() {
return currency;
}
开发者ID:xipki,项目名称:xipki,代码行数:4,代码来源:MonetaryValueOption.java
注:本文中的org.bouncycastle.asn1.x509.qualified.Iso4217CurrencyCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论