Java Code Examples for java.time.LocalTime#toString()

The following examples show how to use java.time.LocalTime#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: TCKLocalTime.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@Test()
@UseDataProvider("provider_sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 2
Source File: Alarm.java    From FXTutorials with MIT License 5 votes vote down vote up
public Alarm(LocalTime time) {
    this.time = time;

    getStyleClass().add("alarm");

    Text text = new Text(time.toString());
    text.getStyleClass().add("alarm_text");

    getChildren().add(text);
    setAlignment(Pos.CENTER_LEFT);
}
 
Example 3
Source File: TCKLocalTime.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 4
Source File: LongColumnLocalTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(LocalTime value) {
    return value.toString();
}
 
Example 5
Source File: TimeColumnLocalTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(LocalTime value) {
    return value.toString();
}
 
Example 6
Source File: SqlDialect.java    From sqlg with MIT License 4 votes vote down vote up
default String toRDBSStringLiteral(PropertyType propertyType, Object value) {
    switch (propertyType.ordinal()) {
        case BOOLEAN_ORDINAL:
            Boolean b = (Boolean) value;
            return b.toString();
        case BYTE_ORDINAL:
            Byte byteValue = (Byte) value;
            return byteValue.toString();
        case SHORT_ORDINAL:
            Short shortValue = (Short) value;
            return shortValue.toString();
        case INTEGER_ORDINAL:
            Integer intValue = (Integer) value;
            return intValue.toString();
        case LONG_ORDINAL:
            Long longValue = (Long) value;
            return longValue.toString();
        case FLOAT_ORDINAL:
            Float floatValue = (Float) value;
            return floatValue.toString();
        case DOUBLE_ORDINAL:
            Double doubleValue = (Double) value;
            return doubleValue.toString();
        case STRING_ORDINAL:
            return "'" + value.toString() + "'";
        case LOCALDATE_ORDINAL:
            LocalDate localDateValue = (LocalDate) value;
            return "'" + localDateValue.toString() + "'";
        case LOCALDATETIME_ORDINAL:
            LocalDateTime localDateTimeValue = (LocalDateTime) value;
            return "'" + localDateTimeValue.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + "'";
        case LOCALTIME_ORDINAL:
            LocalTime localTimeValue = (LocalTime) value;
            return "'" + localTimeValue.toString() + "'";
        case ZONEDDATETIME_ORDINAL:
            break;
        case PERIOD_ORDINAL:
            break;
        case DURATION_ORDINAL:
            break;
        case JSON_ORDINAL:
            break;
        case POINT_ORDINAL:
            break;
        case LINESTRING_ORDINAL:
            break;
        case POLYGON_ORDINAL:
            break;
        case GEOGRAPHY_POINT_ORDINAL:
            break;
        case GEOGRAPHY_POLYGON_ORDINAL:
            break;
        case boolean_ARRAY_ORDINAL:
            break;
        case BOOLEAN_ARRAY_ORDINAL:
            break;
        case byte_ARRAY_ORDINAL:
            break;
        case BYTE_ARRAY_ORDINAL:
            break;
        case short_ARRAY_ORDINAL:
            break;
        case SHORT_ARRAY_ORDINAL:
            break;
        case int_ARRAY_ORDINAL:
            break;
        case INTEGER_ARRAY_ORDINAL:
            break;
        case long_ARRAY_ORDINAL:
            break;
        case LONG_ARRAY_ORDINAL:
            break;
        case float_ARRAY_ORDINAL:
            break;
        case FLOAT_ARRAY_ORDINAL:
            break;
        case double_ARRAY_ORDINAL:
            break;
        case DOUBLE_ARRAY_ORDINAL:
            break;
        case STRING_ARRAY_ORDINAL:
            break;
        case LOCALDATETIME_ARRAY_ORDINAL:
            break;
        case LOCALDATE_ARRAY_ORDINAL:
            break;
        case LOCALTIME_ARRAY_ORDINAL:
            break;
        case ZONEDDATETIME_ARRAY_ORDINAL:
            break;
        case DURATION_ARRAY_ORDINAL:
            break;
        case PERIOD_ARRAY_ORDINAL:
            break;
        case JSON_ARRAY_ORDINAL:
            break;
    }
    return "'" + value.toString() + "'";
}
 
Example 7
Source File: TCKLocalTime.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 8
Source File: TCKLocalTime.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 9
Source File: QueueOffsetSpec.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
public static QueueOffsetSpec ofRollTime(final LocalTime time, final ZoneId zoneId) {
    return new QueueOffsetSpec(Type.ROLL_TIME, new String[]{time.toString(), zoneId.toString()});
}
 
Example 10
Source File: TCKLocalTime.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 11
Source File: TCKLocalTime.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 12
Source File: TCKLocalTime.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 13
Source File: IntegerColumnLocalTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(LocalTime value) {
    return value.toString();
}
 
Example 14
Source File: TCKLocalTime.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 15
Source File: TimestampColumnLocalTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(LocalTime value) {
    return value.toString();
}
 
Example 16
Source File: TCKLocalTime.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 17
Source File: TCKLocalTime.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 18
Source File: TCKLocalTime.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 19
Source File: TimePicker.java    From LGoodDatePicker with MIT License 2 votes vote down vote up
/**
 * getTimeStringOrEmptyString, This will return the last valid time as a string. If the last
 * valid time is empty, this will return an empty string ("").
 *
 * Time values will be output in one of the following ISO-8601 formats: "HH:mm", "HH:mm:ss",
 * "HH:mm:ss.SSS", "HH:mm:ss.SSSSSS", "HH:mm:ss.SSSSSSSSS".
 *
 * The format used will be the shortest that outputs the full value of the time where the
 * omitted parts are implied to be zero.
 */
public String getTimeStringOrEmptyString() {
    LocalTime time = getTime();
    return (time == null) ? "" : time.toString();
}
 
Example 20
Source File: TimePicker.java    From LGoodDatePicker with MIT License 2 votes vote down vote up
/**
 * getTimeStringOrSuppliedString, This will return the last valid time as a string. If the last
 * valid time is empty, this will return the value of emptyTimeString.
 *
 * Time values will be output in one of the following ISO-8601 formats: "HH:mm", "HH:mm:ss",
 * "HH:mm:ss.SSS", "HH:mm:ss.SSSSSS", "HH:mm:ss.SSSSSSSSS".
 *
 * The format used will be the shortest that outputs the full value of the time where the
 * omitted parts are implied to be zero.
 */
public String getTimeStringOrSuppliedString(String emptyTimeString) {
    LocalTime time = getTime();
    return (time == null) ? emptyTimeString : time.toString();
}