@org.joda.convert.ToString - java examples

Here are the examples of the java api @org.joda.convert.ToString taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

49 Examples 7

19 View Complete Implementation : SubjectJodaConvert.java
Copyright Apache License 2.0
Author : JadiraOrg
@ToString
public String marshalJoda() {
    return value + ":MARSHALLED_BY_JODA";
}

19 View Complete Implementation : ImmJodaConvertBean.java
Copyright Apache License 2.0
Author : JodaOrg
@ToString
public String formattedString() {
    return base + ":" + extra;
}

19 View Complete Implementation : AbstractDateTime.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).
 * <p>
 * Note that this method does not output the chronology or time-zone.
 * This can be confusing, as the equals and hashCode methods use both
 * chronology and time-zone. If two objects are not {@code equal} but have the
 * same {@code toString} then either the chronology or time-zone differs.
 *
 * @return ISO8601 time formatted string, not null
 */
@ToString
public String toString() {
    return super.toString();
}

19 View Complete Implementation : AbstractDuration.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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();
}

19 View Complete Implementation : AbstractInstant.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).
 *
 * @return ISO8601 time formatted string, not null
 */
@ToString
public String toString() {
    return ISODateTimeFormat.dateTime().print(this);
}

19 View Complete Implementation : AbstractPeriod.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Gets the value as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT6H3M7S" 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);
}

19 View Complete Implementation : Days.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : Hours.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : Minutes.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT4M" represents 4 minutes.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
    return "PT" + String.valueOf(getValue()) + "M";
}

19 View Complete Implementation : Months.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : Seconds.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : Weeks.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : Years.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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";
}

19 View Complete Implementation : AbstractInstant.java
Copyright GNU General Public License v3.0
Author : redfish64
// -----------------------------------------------------------------------
/**
 * 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);
}

19 View Complete Implementation : AbstractPeriod.java
Copyright GNU General Public License v3.0
Author : redfish64
// -----------------------------------------------------------------------
/**
 * 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);
}

19 View Complete Implementation : Time_19_DateTimeZone_s.java
Copyright MIT License
Author : SpoonLabs
// Principal methods
// --------------------------------------------------------------------
/**
 * Gets the ID of this datetime zone.
 *
 * @return the ID of this datetime zone
 */
@ToString
public final String getID() {
    return iID;
}

18 View Complete Implementation : CurrencyUnit.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Gets the currency code as a string.
 *
 * @return the currency code, never null
 */
@Override
@ToString
public String toString() {
    return code;
}

18 View Complete Implementation : YearMonth.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * Output the year-month in ISO8601 format (yyyy-MM).
 *
 * @return ISO8601 time formatted string.
 */
@ToString
public String toString() {
    return ISODateTimeFormat.yearMonth().print(this);
}

18 View Complete Implementation : Currency.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * Returns a string representation of the currency, which is the three letter code.
 *
 * @return the three letter currency code
 */
@Override
@ToString
public String toString() {
    return code;
}

18 View Complete Implementation : CurrencyAmount.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * 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));
}

18 View Complete Implementation : CurrencyPair.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * Returns the formatted string version of the currency pair.
 * <p>
 * The format is '${baseCurrency}/${counterCurrency}'.
 *
 * @return the formatted string
 */
@Override
@ToString
public String toString() {
    return base.getCode() + "/" + counter.getCode();
}

18 View Complete Implementation : Money.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * 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 + " " + amount.toString();
}

18 View Complete Implementation : HolidayCalendarId.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * Gets the name that uniquely identifies this calendar.
 * <p>
 * This name is used in serialization and can be parsed using {@link #of(String)}.
 *
 * @return the unique name
 */
@ToString
@Override
public String getName() {
    return name;
}

18 View Complete Implementation : Tenor.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * Returns a formatted string representing the tenor.
 * <p>
 * The format is a combination of the quanreplacedy and unit, such as 1D, 2W, 3M, 4Y.
 *
 * @return the formatted tenor
 */
@ToString
@Override
public String toString() {
    return name;
}

18 View Complete Implementation : Country.java
Copyright Apache License 2.0
Author : OpenGamma
// -------------------------------------------------------------------------
/**
 * 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;
}

18 View Complete Implementation : Frequency.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * Returns a formatted string representing the periodic frequency.
 * <p>
 * The format is a combination of the quanreplacedy and unit, such as P1D, P2W, P3M, P4Y.
 * The 'Term' amount is returned as 'Term'.
 *
 * @return the formatted frequency
 */
@ToString
@Override
public String toString() {
    return name;
}

18 View Complete Implementation : StandardId.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * 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;
}

18 View Complete Implementation : ResourceLocator.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * 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;
}

18 View Complete Implementation : DoublesPair.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * 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();
}

18 View Complete Implementation : TypedString.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * Returns the name.
 *
 * @return the string form, not empty
 */
@Override
@ToString
public final String toString() {
    return name;
}

18 View Complete Implementation : MarketDataName.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * Returns the name.
 *
 * @return the name
 */
@Override
@ToString
public final String toString() {
    return getName();
}

18 View Complete Implementation : CcpId.java
Copyright Apache License 2.0
Author : OpenGamma
@ToString
@Override
public String toString() {
    return name;
}

18 View Complete Implementation : EtdContractGroupId.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * Returns the identifier in a standard string format.
 * <p>
 * The returned string is in the form '{@code $exchange::$code}'.
 * This is suitable for use with {@link #parse(String)}.
 *
 * @return a parsable representation of the identifier
 */
@ToString
@Override
public String toString() {
    return exchangeId + SEPARATOR + code;
}

18 View Complete Implementation : EtdContractSpecId.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * 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 'ECAG-FGBL-Mar14'
 * then the result is 'OG-Future~ECAG-FGBL-Mar14'.
 *
 * @return a parsable representation of the identifier
 */
@ToString
@Override
public String toString() {
    return standardId.toString();
}

18 View Complete Implementation : LegalEntityId.java
Copyright Apache License 2.0
Author : OpenGamma
/**
 * 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();
}

18 View Complete Implementation : Days.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of days.
 * This will be in the format 'PnD' where n is the number of days.
 *
 * @return the number of days in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "P" + days + "D";
}

18 View Complete Implementation : Hours.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of hours.
 * This will be in the format 'PTnH' where n is the number of hours.
 *
 * @return the number of hours in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "PT" + hours + "H";
}

18 View Complete Implementation : Interval.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Outputs this interval as a {@code String}, such as {@code 2007-12-03T10:15:30/2007-12-04T10:15:30}.
 * <p>
 * The output will be the ISO-8601 format formed by combining the
 * {@code toString()} methods of the two instants, separated by a forward slash.
 *
 * @return a string representation of this instant, not null
 */
@Override
@ToString
public String toString() {
    return start.toString() + '/' + end.toString();
}

18 View Complete Implementation : LocalDateRange.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Outputs this range as a {@code String}, such as {@code 2007-12-03/2007-12-04}.
 * <p>
 * The output will be the ISO-8601 format formed by combining the
 * {@code toString()} methods of the two dates, separated by a forward slash.
 *
 * @return a string representation of this date, not null
 */
@Override
@ToString
public String toString() {
    return start.toString() + '/' + end.toString();
}

18 View Complete Implementation : Minutes.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of minutes.
 * This will be in the format 'PTnM' where n is the number of minutes.
 *
 * @return the number of minutes in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "PT" + minutes + "M";
}

18 View Complete Implementation : Months.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of months.
 * This will be in the format 'PnM' where n is the number of months.
 *
 * @return the number of months in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "P" + months + "M";
}

18 View Complete Implementation : TaiInstant.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * A string representation of this instant.
 * <p>
 * The string is formatted as {@code {seconds).(nanosOfSecond}s(TAI)}.
 * At least one second digit will be present.
 * The nanoseconds will always be nine digits.
 *
 * @return a representation of this instant, not null
 */
@Override
@ToString
public String toString() {
    StringBuilder buf = new StringBuilder();
    buf.append(seconds);
    int pos = buf.length();
    buf.append(nanos + NANOS_PER_SECOND);
    buf.setCharAt(pos, '.');
    buf.append("s(TAI)");
    return buf.toString();
}

18 View Complete Implementation : Seconds.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of seconds.
 * This will be in the format 'PTnS' where n is the number of seconds.
 *
 * @return the number of seconds in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "PT" + seconds + "S";
}

18 View Complete Implementation : Weeks.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of weeks.
 * This will be in the format 'PnW' where n is the number of weeks.
 *
 * @return the number of weeks in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "P" + weeks + "W";
}

18 View Complete Implementation : Years.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the number of years.
 * This will be in the format 'PnY' where n is the number of years.
 *
 * @return the number of years in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    return "P" + years + "Y";
}

18 View Complete Implementation : YearWeek.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Outputs this year-week as a {@code String}, such as {@code 2015-W13}.
 * <p>
 * The output will be in the format {@code YYYY-'W'ww}:
 *
 * @return a string representation of this year-week, not null
 */
@Override
@ToString
public String toString() {
    int absYear = Math.abs(year);
    StringBuilder buf = new StringBuilder(10);
    if (absYear < 1000) {
        if (year < 0) {
            buf.append(year - 10000).deleteCharAt(1);
        } else {
            buf.append(year + 10000).deleteCharAt(0);
        }
    } else {
        if (year > 9999) {
            buf.append('+');
        }
        buf.append(year);
    }
    return buf.append(week < 10 ? "-W0" : "-W").append(week).toString();
}

17 View Complete Implementation : MonthDay.java
Copyright Apache License 2.0
Author : JodaOrg
// -----------------------------------------------------------------------
/**
 * 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);
}

16 View Complete Implementation : UtcInstant.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * A string representation of this instant.
 * <p>
 * The string is formatted using ISO-8601.
 * The output includes seconds, 9 nanosecond digits and a trailing 'Z'.
 * The time-of-day will be 23:59:60 during a positive leap second.
 *
 * @return a representation of this instant, not null
 */
@Override
@ToString
public String toString() {
    // TODO: capacity/import issues
    LocalDate date = LocalDate.MAX.with(JulianFields.MODIFIED_JULIAN_DAY, mjDay);
    StringBuilder buf = new StringBuilder(30);
    int sod = (int) (nanoOfDay / NANOS_PER_SECOND);
    int hourValue = sod / (60 * 60);
    int minuteValue = (sod / 60) % 60;
    int secondValue = sod % 60;
    int nanoValue = (int) (nanoOfDay % NANOS_PER_SECOND);
    if (hourValue == 24) {
        hourValue = 23;
        minuteValue = 59;
        secondValue = 60;
    }
    buf.append(date).append('T').append(hourValue < 10 ? "0" : "").append(hourValue).append(minuteValue < 10 ? ":0" : ":").append(minuteValue).append(secondValue < 10 ? ":0" : ":").append(secondValue);
    if (nanoValue > 0) {
        buf.append('.');
        if (nanoValue % 1000_000 == 0) {
            buf.append(Integer.toString((nanoValue / 1000_000) + 1000).substring(1));
        } else if (nanoValue % 1000 == 0) {
            buf.append(Integer.toString((nanoValue / 1000) + 1000_000).substring(1));
        } else {
            buf.append(Integer.toString((nanoValue) + 1000_000_000).substring(1));
        }
    }
    buf.append('Z');
    return buf.toString();
}

14 View Complete Implementation : PeriodDuration.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : ThreeTen
// -----------------------------------------------------------------------
/**
 * Returns a string representation of the amount.
 * This will be in the format 'PnYnMnDTnHnMnS', with sections omitted as necessary.
 * An empty amount will return "PT0S".
 *
 * @return the period in ISO-8601 string format
 */
@Override
@ToString
public String toString() {
    if (period.isZero()) {
        return duration.toString();
    }
    if (duration.isZero()) {
        return period.toString();
    }
    return period.toString() + duration.toString().substring(1);
}