Java Code Examples for org.joda.convert.ToString

The following examples show how to use org.joda.convert.ToString. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: astor   Source File: AbstractDuration.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the value as a String in the ISO8601 duration format including
 * only seconds and milliseconds.
 * <p>
 * For example, "PT72.345S" represents 1 minute, 12 seconds and 345 milliseconds.
 * <p>
 * For more control over the output, see
 * {@link org.joda.time.format.PeriodFormatterBuilder PeriodFormatterBuilder}.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    long millis = getMillis();
    StringBuffer buf = new StringBuffer();
    buf.append("PT");
    boolean negative = (millis < 0);
    FormatUtils.appendUnpaddedInteger(buf, millis);
    while (buf.length() < (negative ? 7 : 6)) {
        buf.insert(negative ? 3 : 2, "0");
    }
    if ((millis / 1000) * 1000 == millis) {
        buf.setLength(buf.length() - 3);
    } else {
        buf.insert(buf.length() - 3, ".");
    }
    buf.append('S');
    return buf.toString();
}
 
Example 2
Source Project: coming   Source File: Arja_0049_s.java    License: MIT License 5 votes vote down vote up
/**
 * Output the month-day in ISO8601 format (--MM-dd).
 *
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    List<DateTimeFieldType> fields = new ArrayList<DateTimeFieldType>();
    fields.add(DateTimeFieldType.monthOfYear());
    fields.add(DateTimeFieldType.dayOfMonth());
    return ISODateTimeFormat.forFields(fields, true, true).print(this);
}
 
Example 3
Source Project: astor   Source File: MonthDay.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Output the month-day in ISO8601 format (--MM-dd).
 *
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    List<DateTimeFieldType> fields = new ArrayList<DateTimeFieldType>();
    fields.add(DateTimeFieldType.monthOfYear());
    fields.add(DateTimeFieldType.dayOfMonth());
    return ISODateTimeFormat.forFields(fields, true, true).print(this);
}
 
Example 4
Source Project: astor   Source File: MonthDay.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Output the month-day in ISO8601 format (--MM-dd).
 *
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    List<DateTimeFieldType> fields = new ArrayList<DateTimeFieldType>();
    fields.add(DateTimeFieldType.monthOfYear());
    fields.add(DateTimeFieldType.dayOfMonth());
    return ISODateTimeFormat.forFields(fields, true, true).print(this);
}
 
Example 5
Source Project: Strata   Source File: DoublesPair.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the pair using a standard string format.
 * <p>
 * The standard format is '[$first, $second]'. Spaces around the values are trimmed.
 * 
 * @return the pair as a string
 */
@Override
@ToString
public String toString() {
  return new StringBuilder()
      .append('[')
      .append(first)
      .append(", ")
      .append(second)
      .append(']')
      .toString();
}
 
Example 6
Source Project: Strata   Source File: LongDoublePair.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the pair using a standard string format.
 * <p>
 * The standard format is '[$first, $second]'. Spaces around the values are trimmed.
 * 
 * @return the pair as a string
 */
@Override
@ToString
public String toString() {
  return new StringBuilder()
      .append('[')
      .append(first)
      .append(", ")
      .append(second)
      .append(']')
      .toString();
}
 
Example 7
Source Project: Strata   Source File: MarketTenor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns a formatted string representing the market tenor.
 *
 * @return the formatted market tenor
 */
@ToString
@Override
public String toString() {
  return code;
}
 
Example 8
Source Project: Strata   Source File: CcpId.java    License: Apache License 2.0 4 votes vote down vote up
@ToString
@Override
public String toString() {
  return name;
}
 
Example 9
Source Project: Strata   Source File: AttributeType.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns the name.
 * 
 * @return the string form, not empty
 */
@Override
@ToString
public final String toString() {
  return name;
}
 
Example 10
Source Project: Strata   Source File: TypedString.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns the name.
 * 
 * @return the string form, not empty
 */
@Override
@ToString
public final String toString() {
  return name;
}
 
Example 11
Source Project: Strata   Source File: Country.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns a string representation of the country, which is the two letter code.
 * 
 * @return the two letter country code
 */
@Override
@ToString
public String toString() {
  return code;
}
 
Example 12
Source Project: Strata   Source File: CurrencyAmount.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Gets the amount as a string.
 * <p>
 * The format is the currency code, followed by a space, followed by the
 * amount: '${currency} ${amount}'.
 *
 * @return the currency amount
 */
@Override
@ToString
public String toString() {
  return currency + " " +
      (DoubleMath.isMathematicalInteger(amount) ? Long.toString((long) amount) : Double.toString(amount));
}
 
Example 13
Source Project: Strata   Source File: ThreeLegBasisSwapConvention.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this convention.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 14
Source Project: coming   Source File: Cardumen_00189_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 15
Source Project: Strata   Source File: RollConvention.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this convention.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 16
Source Project: coming   Source File: Cardumen_00239_t.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 17
Source Project: Strata   Source File: Tenor.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns a formatted string representing the tenor.
 * <p>
 * The format is a combination of the quantity and unit, such as 1D, 2W, 3M, 4Y.
 *
 * @return the formatted tenor
 */
@ToString
@Override
public String toString() {
  return name;
}
 
Example 18
Source Project: Strata   Source File: FloatingRateName.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this floating rate.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * It will be the external name, typically from FpML, such as 'GBP-LIBOR-BBA'.
 * 
 * @return the external name
 */
@ToString
@Override
public abstract String getName();
 
Example 19
Source Project: coming   Source File: Cardumen_0074_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 20
Source Project: Strata   Source File: FpmlParserPlugin.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this parser.
 * <p>
 * The name must be the name of the product element in FpML that is to be parsed.
 * For example, 'fra', 'swap' or 'fxSingleLeg'.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 21
Source Project: coming   Source File: Cardumen_00282_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 22
Source Project: Strata   Source File: TermDepositConvention.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this convention.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 23
Source Project: coming   Source File: Cardumen_0070_t.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 24
Source Project: Strata   Source File: FixedIborSwapConvention.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this convention.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 25
Source Project: coming   Source File: Cardumen_00137_t.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 26
Source Project: Strata   Source File: PriceIndex.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this index.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 27
Source Project: coming   Source File: Nopol2017_0089_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 28
Source Project: Strata   Source File: IborFixingDepositConvention.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this convention.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 * 
 * @return the unique name
 */
@ToString
@Override
public abstract String getName();
 
Example 29
Source Project: coming   Source File: Time_25_DateTimeZone_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}
 
Example 30
Source Project: coming   Source File: Time_17_DateTimeZone_s.java    License: MIT License 2 votes vote down vote up
/**
 * Gets the ID of this datetime zone.
 * 
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}