Package org.joda.time

Examples of org.joda.time.LocalDateTime


        Map<UserField, Object> data = new HashMap<UserField, Object>();
        data.put(UserField.kUserType, UserType.kVip);
        data.put(UserField.kDaysServed, 30);
        data.put(UserField.kPackages, getPackages(PackageType.kVipUserPackage2));
        List<Slip> slips = new ArrayList<Slip>();
        slips.add(new Slip(SlipType.kPhoneCall, new LocalDateTime(), 2001));
        slips.add(new Slip(SlipType.kShortMessage, new LocalDateTime(), 501));
        slips.add(new Slip(SlipType.kInternet, new LocalDateTime(), 300 * 1000 + 100));
        data.put(UserField.kSlips, slips);
        UserMonthUsage usage = new UserMonthUsage(1, data);
        assertEquals(Money.get(200, 35), calculator.calculate(usage));
    }
View Full Code Here


    public void testVipUserNewJoinWithInLimit() {
        Map<UserField, Object> data = new HashMap<UserField, Object>();
        data.put(UserField.kUserType, UserType.kVip);
        data.put(UserField.kDaysServed, 15);
        List<Slip> slips = new ArrayList<Slip>();
        slips.add(new Slip(SlipType.kPhoneCall, new LocalDateTime(), 200));
        slips.add(new Slip(SlipType.kShortMessage, new LocalDateTime(), 200));
        slips.add(new Slip(SlipType.kInternet, new LocalDateTime(), 100 * 1000));
        data.put(UserField.kSlips, slips);

        data.put(UserField.kIsNewUser, true);

        UserMonthUsage usage = new UserMonthUsage(1, data);
View Full Code Here

    public void testVipUserNewJoinMore() {
        Map<UserField, Object> data = new HashMap<UserField, Object>();
        data.put(UserField.kUserType, UserType.kVip);
        data.put(UserField.kDaysServed, 15);
        List<Slip> slips = new ArrayList<Slip>();
        slips.add(new Slip(SlipType.kPhoneCall, new LocalDateTime(), 201));
        slips.add(new Slip(SlipType.kShortMessage, new LocalDateTime(), 201));
        slips.add(new Slip(SlipType.kInternet, new LocalDateTime(), 100 * 1000 + 100));
        data.put(UserField.kSlips, slips);

        data.put(UserField.kIsNewUser, true);

        UserMonthUsage usage = new UserMonthUsage(1, data);
View Full Code Here

        final DateTimeZone timeZone = DateTimeZone.forTimeZone(TimeZone.getDefault());
        return new LocalDate(getTime(), timeZone);
    }

    public static LocalDateTime getTimeAsLocalDateTime() {
        return new LocalDateTime(getTime(), Defaults.getTimeZone());
    }
View Full Code Here

    }

    private JodaValuedEntity createEntity() {
        final JodaValuedEntity jve = jodaValuesEntityRepository.newEntity();
        jve.setLocalDateProperty(new LocalDate(2008,3,21));
        jve.setLocalDateTimeProperty(new LocalDateTime(2009, 4, 29, 13, 45, 22));
        jve.setDateTimeProperty(new DateTime(2010, 3, 31, 9, 50, 43, DateTimeZone.UTC));
        return jve;
    }
View Full Code Here

    @Override
    protected LocalDateTime doParse(final Object context, final String entry, final Localization localization) {

        updateTitleStringFormatterIfOverridden();
       
        LocalDateTime contextDateTime = (LocalDateTime) context;

        final String dateString = entry.trim().toUpperCase();
        if (dateString.startsWith("+") && contextDateTime != null) {
            return JodaLocalDateTimeUtil.relativeDateTime(contextDateTime, dateString, true);
        } else if (dateString.startsWith("-"&& contextDateTime != null) {
View Full Code Here

    @Override
    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDateTime dateTime = (LocalDateTime) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateTimeUtil.titleString(f, dateTime);
View Full Code Here

        return JodaLocalDateTimeUtil.titleString(f, dateTime);
    }

    @Override
    public String titleStringWithMask(final Object value, final String usingMask) {
        final LocalDateTime dateTime = (LocalDateTime) value;
        return JodaLocalDateTimeUtil.titleString(DateTimeFormat.forPattern(usingMask), dateTime);
    }
View Full Code Here

    // EncoderDecoder
    // //////////////////////////////////////////////////////////////////

    @Override
    protected String doEncode(final Object object) {
        final LocalDateTime date = (LocalDateTime) object;
        return encode(date);
    }
View Full Code Here

    // //////////////////////////////////////

   
    static LocalDateTime relativeDateTime(final LocalDateTime contextDate, final String str, final boolean add) {
        LocalDateTime relativeDate = contextDate;
        if (str.equals("")) {
            return contextDate;
        }

        try {
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDateTime

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.