org.joda.convert.ToString Java Examples

The following examples show how to use org.joda.convert.ToString. 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 File: AbstractDuration.java    From astor with 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 File: MonthDay.java    From astor with 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 #3
Source File: Arja_0049_s.java    From coming with 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 #4
Source File: MonthDay.java    From astor with 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 File: LongDoublePair.java    From Strata with 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 File: DoublesPair.java    From Strata with 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 File: Country.java    From Strata with 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 #8
Source File: CcpId.java    From Strata with Apache License 2.0 4 votes vote down vote up
@ToString
@Override
public String toString() {
  return name;
}
 
Example #9
Source File: MarketTenor.java    From Strata with 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 #10
Source File: TypedString.java    From Strata with 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 File: AttributeType.java    From Strata with 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 #12
Source File: CurrencyAmount.java    From Strata with 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 File: ResourceLocator.java    From Strata with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a string describing the locator.
 * <p>
 * This can be parsed using {@link #of(String)}.
 * 
 * @return the descriptive string
 */
@ToString
@Override
public String toString() {
  return locator;
}
 
Example #14
Source File: CurveInterpolator.java    From Strata with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the name that uniquely identifies this interpolator.
 * <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 #15
Source File: AbstractPeriod.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets the value as a String in the ISO8601 duration format.
 * <p>
 * For example, "P6H3M7S" represents 6 hours, 3 minutes, 7 seconds.
 * <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() {
    return ISOPeriodFormat.standard().print(this);
}
 
Example #16
Source File: StandardId.java    From Strata with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the identifier in a standard string format.
 * <p>
 * The returned string is in the form '{@code $scheme~$value}'.
 * This is suitable for use with {@link #parse(String)}.
 * 
 * @return a parsable representation of the identifier
 */
@Override
@ToString
public String toString() {
  return scheme + "~" + value;
}
 
Example #17
Source File: Index.java    From Strata with 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 #18
Source File: LegalEntityId.java    From Strata with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the identifier in a standard string format.
 * <p>
 * The returned string is in the form '{@code $scheme~$value}'.
 * This is suitable for use with {@link #parse(String)}.
 * For example, if the scheme is 'OG-Future' and the value is 'Eurex-FGBL-Mar14'
 * then the result is 'OG-Future~Eurex-FGBL-Mar14'.
 * 
 * @return a parsable representation of the identifier
 */
@ToString
@Override
public String toString() {
  return standardId.toString();
}
 
Example #19
Source File: IborFutureConvention.java    From Strata with 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 #20
Source File: IborIndex.java    From Strata with 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 #21
Source File: OvernightIndex.java    From Strata with 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 #22
Source File: DateTimeZone.java    From astor with GNU General Public License v2.0 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 #23
Source File: Years.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "P4Y" represents 4 years.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "P" + String.valueOf(getValue()) + "Y";
}
 
Example #24
Source File: Hours.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT4H" represents 4 hours.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "PT" + String.valueOf(getValue()) + "H";
}
 
Example #25
Source File: Months.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "P4M" represents 4 months.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "P" + String.valueOf(getValue()) + "M";
}
 
Example #26
Source File: MutableDateTime.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).
 * 
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    return ISODateTimeFormat.dateTime().print(this);
}
 
Example #27
Source File: LocalDateTime.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSS).
 * 
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    return ISODateTimeFormat.dateTime().print(this);
}
 
Example #28
Source File: Days.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "P4D" represents 4 days.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "P" + String.valueOf(getValue()) + "D";
}
 
Example #29
Source File: Seconds.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT4S" represents 4 seconds.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "PT" + String.valueOf(getValue()) + "S";
}
 
Example #30
Source File: Weeks.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "P4W" represents 4 weeks.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "P" + String.valueOf(getValue()) + "W";
}