本文整理汇总了Java中org.threeten.bp.ZonedDateTime.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.toString方法的具体用法?Java ZonedDateTime.toString怎么用?Java ZonedDateTime.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.toString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFXForwardSecurity
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
protected FXForwardSecurity createFXForwardSecurity(final Bundle bundle) {
final double putAmount = bundle._firstCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
final ZonedDateTime forwardDate = nextWorkingDay(bundle._tradeDate.plusDays(bundle._daysOffset), bundle._firstCurrency, bundle._secondCurrency);
final Double fxRate = getApproxFXRate(forwardDate.toLocalDate(), Pairs.of(bundle._firstCurrency, bundle._secondCurrency));
if (fxRate == null) {
return null;
}
final double callAmount = NOTIONAL * fxRate;
final Currency payCurrency = bundle._long ? bundle._secondCurrency : bundle._firstCurrency;
final Currency receiveCurrency = bundle._long ? bundle._firstCurrency : bundle._secondCurrency;
final String dateString = forwardDate.toString(DATE_FORMATTER);
final FXForwardSecurity fxForwardSecurity = new FXForwardSecurity(payCurrency, callAmount, receiveCurrency, putAmount, forwardDate, REGION);
final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
fxForwardSecurity.setName("Pay " + payCurrency + " " + callAmountString + ", receive " + receiveCurrency + " " + putAmountString + " on " + dateString);
return fxForwardSecurity;
}
示例2: createNDFXForwardSecurity
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
protected NonDeliverableFXForwardSecurity createNDFXForwardSecurity(final Bundle bundle) {
final double putAmount = bundle._firstCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
final ZonedDateTime forwardDate = nextWorkingDay(bundle._tradeDate.plusDays(bundle._daysOffset), bundle._firstCurrency, bundle._secondCurrency);
final Double fxRate = getApproxFXRate(forwardDate.toLocalDate(), Pairs.of(bundle._firstCurrency, bundle._secondCurrency));
if (fxRate == null) {
return null;
}
final double callAmount = NOTIONAL * fxRate;
final Currency payCurrency = bundle._long ? bundle._secondCurrency : bundle._firstCurrency;
final Currency receiveCurrency = bundle._long ? bundle._firstCurrency : bundle._secondCurrency;
final String dateString = forwardDate.toString(DATE_FORMATTER);
final NonDeliverableFXForwardSecurity security = new NonDeliverableFXForwardSecurity(payCurrency, callAmount, receiveCurrency, putAmount, forwardDate,
REGION, getRandom(BOOLEAN_VALUES));
final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
security.setName("Pay " + payCurrency + " " + callAmountString + ", receive " + receiveCurrency + " " + putAmountString + " on " + dateString);
return security;
}
示例3: createFXOptionSecurity
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
protected FXOptionSecurity createFXOptionSecurity(final Bundle bundle) {
final Currency putCurrency = bundle._firstCurrency;
final Currency callCurrency = bundle._secondCurrency;
final double putAmount = bundle._firstCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
final ZonedDateTime settlementDate = bundle._tradeDate.plusDays(bundle._daysOffset);
final Double fxRate = getApproxFXRate(settlementDate.toLocalDate(), Pairs.of(bundle._firstCurrency, bundle._secondCurrency));
if (fxRate == null) {
return null;
}
final double callAmount = NOTIONAL * fxRate;
final Expiry expiry = new Expiry(settlementDate, ExpiryAccuracy.DAY_MONTH_YEAR);
final String dateString = settlementDate.toString(DATE_FORMATTER);
final FXOptionSecurity fxOptionSecurity = new FXOptionSecurity(putCurrency, callCurrency, putAmount, callAmount, expiry, settlementDate, bundle._long, new EuropeanExerciseType());
final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
fxOptionSecurity.setName((bundle._long ? "Long " : "Short ") + "put " + putCurrency + " " + putAmountString + ", call " + callCurrency + " " + callAmountString + " on " + dateString);
return fxOptionSecurity;
}
示例4: createNDFXOptionSecurity
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
protected NonDeliverableFXOptionSecurity createNDFXOptionSecurity(final Bundle bundle) {
final Currency putCurrency = bundle._firstCurrency;
final Currency callCurrency = bundle._secondCurrency;
final double putAmount = bundle._firstCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
final ZonedDateTime settlementDate = bundle._tradeDate.plusDays(bundle._daysOffset);
final Double fxRate = getApproxFXRate(settlementDate.toLocalDate(), Pairs.of(bundle._firstCurrency, bundle._secondCurrency));
if (fxRate == null) {
return null;
}
final double callAmount = NOTIONAL * fxRate;
final Expiry expiry = new Expiry(settlementDate, ExpiryAccuracy.DAY_MONTH_YEAR);
final String dateString = settlementDate.toString(DATE_FORMATTER);
final NonDeliverableFXOptionSecurity optionSecurity = new NonDeliverableFXOptionSecurity(putCurrency, callCurrency, putAmount, callAmount, expiry, settlementDate,
getRandom(BOOLEAN_VALUES), new EuropeanExerciseType(), getRandom(BOOLEAN_VALUES));
final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
optionSecurity.setName((bundle._long ? "Long " : "Short ") + "put " + putCurrency + " " + putAmountString + ", call " + callCurrency + " " + callAmountString + " on " + dateString);
return optionSecurity;
}
示例5: createFXBarrierOptionSecurity
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
protected FXBarrierOptionSecurity createFXBarrierOptionSecurity(final Bundle bundle) {
final Currency putCurrency = bundle._firstCurrency;
final Currency callCurrency = bundle._secondCurrency;
final double putAmount = putCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
final ZonedDateTime settlementDate = nextWorkingDay(bundle._tradeDate.plusDays(bundle._daysOffset), bundle._firstCurrency, bundle._secondCurrency);
final Expiry expiry = new Expiry(settlementDate, ExpiryAccuracy.DAY_MONTH_YEAR);
final Double fxRate = getApproxFXRate(settlementDate.toLocalDate(), Pairs.of(bundle._firstCurrency, bundle._secondCurrency));
if (fxRate == null) {
return null;
}
final double callAmount = NOTIONAL * fxRate;
final String dateString = settlementDate.toString(DATE_FORMATTER);
final BarrierType barrierType = bundle._up ? BarrierType.UP : BarrierType.DOWN;
final BarrierDirection barrierDirection = BarrierDirection.KNOCK_IN;
final MonitoringType monitoringType = MonitoringType.CONTINUOUS;
final SamplingFrequency samplingFrequency = SamplingFrequency.DAILY_CLOSE;
final boolean invertBarrierLevel = !CurrencyPair.of(putCurrency, callCurrency).equals(getCurrencyPair(putCurrency, callCurrency));
// so if UP and ccy convention order, multiple, if UP and inverted ccy order, divide, if DOWN and ccy convention order multiply, if DOWN and inverted ccy order, divide.
final double barrierLevel = bundle._up ^ invertBarrierLevel ? fxRate * 1.5 : fxRate / 1.5;
final FXBarrierOptionSecurity fxBarrierOptionSecurity = new FXBarrierOptionSecurity(putCurrency, callCurrency, putAmount, callAmount, expiry, settlementDate, barrierType, barrierDirection,
monitoringType, samplingFrequency, barrierLevel, bundle._long);
final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
final String barrierLevelString = RATE_FORMATTER.format(barrierLevel);
final String barrierUnitString = callCurrency + "/" + putCurrency;
fxBarrierOptionSecurity.setName((bundle._long ? "Long " : "Short ") + (bundle._up ? "up" : "down") + " knock-in at " + barrierLevelString + " " + barrierUnitString + ", put " + putCurrency +
" " +
putAmountString + ", call " + callCurrency + " " + callAmountString + " on " + dateString);
return fxBarrierOptionSecurity;
}
示例6: getDBValue
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public String getDBValue(ZonedDateTime model) {
if (model == null) {
return null;
}
return model.toString();
}
示例7: convertToDatabaseValue
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public String convertToDatabaseValue(ZonedDateTime entityProperty) {
return entityProperty.toString();
}
示例8: serializeZonedDateTime
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public static String serializeZonedDateTime(ZonedDateTime time) {
return time.toString();
}
示例9: SubscriptionStatus
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
* Create a new subscription state.
*
* @param state the state of the subscription
* @param time the time the subscription got the state
*/
public SubscriptionStatus(SubscriptionState state, ZonedDateTime time) {
_state = state.name();
_timestamp = time.toString();
}