Package org.apache.isis.applib.value

Examples of org.apache.isis.applib.value.Time


        return time;
    }

    @Override
    protected Date dateValue(final Object object) {
        final Time time = (Time) object;
        return time == null ? null : time.asJavaDate();
    }
View Full Code Here


        return time == null ? null : time.asJavaDate();
    }

    @Override
    protected Time now() {
        return new Time();
    }
View Full Code Here

        return new Time();
    }

    @Override
    protected Time setDate(final Date date) {
        return new Time(date.getTime());
    }
View Full Code Here

        this.dataType = dataType;
    }

    @Override
    protected Object preparedStatementObject(final ObjectAdapter value) {
        final Time asTime = (Time) value.getObject();
        return asTime.asJavaTime();
    }
View Full Code Here

         * .fromEncodedString(valueString);
         */
        ObjectAdapter restoredValue;
        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
        if (correspondingClass == Time.class) {
            final Time timeValue = results.getTime(columnName);
            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
        } else {
            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
View Full Code Here

        try {
            final String string = set.getString(columnName);
            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
            final DateTimeZone defaultTimeZone = Defaults.getTimeZone();
            final DateTime utcDate = formatter.withZone(defaultTimeZone).parseDateTime(string);
            return new Time(utcDate);
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
        }
    }
View Full Code Here

                will(returnValue(null));
            }
        });

        TestClock.initialize();
        time = new Time(8, 13);
        holder = new FacetHolderImpl();
        setValue(adapter = new TimeValueSemanticsProvider(holder, mockConfiguration, mockContext));
    }
View Full Code Here

    }

    @Test
    public void testParseEntryOfHoursMinutesText() throws Exception {
        final Object parsed = adapter.parseTextEntry(null, "8:30", null);
        assertEquals(new Time(8, 30), parsed);
    }
View Full Code Here

    @Test
    @Ignore
    public void testParseEntryOfHoursMinutesSecondsText() throws Exception {
        final Object parsed = adapter.parseTextEntry(null, "8:30:45", null);
        // I can't get the text parser to parse HH:mm:ss before HH:mm!!
        final Time expected = new Time(8, 30, 45);
        assertEquals(expected, parsed);
    }
View Full Code Here

    }

    @Test
    public void testParseEntryOfHoursAfterTime() throws Exception {
        final Object parsed = adapter.parseTextEntry(time, "+5H", null);
        assertEquals(new Time(13, 13), parsed);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.value.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.