• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BaseLocal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.joda.time.base.BaseLocal的典型用法代码示例。如果您正苦于以下问题:Java BaseLocal类的具体用法?Java BaseLocal怎么用?Java BaseLocal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseLocal类属于org.joda.time.base包,在下文中一共展示了BaseLocal类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
@Override
public Object create(Object request, SpecimenContext context) {

    if (!(request instanceof SpecimenType)) {
        return new NoSpecimen();
    }

    SpecimenType type = (SpecimenType) request;
    if (!BaseLocal.class.isAssignableFrom(type.getRawType())) {
        return new NoSpecimen();
    }

    Date date = (Date) context.resolve(Date.class);
    long instant = date.getTime();

    try {
        return type.getRawType().getDeclaredConstructor(long.class).newInstance(instant);
    } catch (Exception e) {
        e.printStackTrace();
        return new NoSpecimen();
    }
}
 
开发者ID:FlexTradeUKLtd,项目名称:jfixture,代码行数:23,代码来源:BaseLocalRelay.java


示例2: createDate

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Creates a date object using the user selected date and time from the date and time pickers.
 * Null if no date selected.
 *
 * @return a date object with user selected date/time or null if no date selected
 */
private BaseLocal createDate() {
    if (dateToggleButton.isChecked()) {
        if (timeToggleButton.isChecked()) {
            return new LocalDateTime(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth(), timePicker.getCurrentHour(), timePicker.getCurrentMinute(), 0);
        } else {
            return new LocalDate(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth());
        }
    } else return null;
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:16,代码来源:QuickReschedule.java


示例3: ToDoItem

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param name     The name
 * @param date     The due date (Null if no due date set)
 * @param group    The group (No Group, Work, Personal)
 * @param priority The priority (Not Set, Low, Medium, High)
 * @param timeSet
 */
public ToDoItem(String name, BaseLocal date, String group, String priority, boolean timeSet) {
    this.name = name;
    this.date = date;
    this.group = group;
    this.priority = priority;
    this.timeSet = timeSet;
    complete = false;

    if (!(this.group.equals("No Group") || this.group.equals("Work") || this.group.equals("Personal") || this.group.equals("School")))
        throw new IllegalArgumentException("No such group exists.");
    if (!(this.priority.equals("Not Set") || this.priority.equals("Low") || this.priority.equals("Medium") || this.priority.equals("High")))
        throw new IllegalArgumentException("No such priority exists.");
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:23,代码来源:ToDoItem.java


示例4: createDate

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Creates a date object using the user selected date and time from the date and time pickers.
 * Null if no date selected.
 *
 * @return a date object with user selected date/time
 */
private BaseLocal createDate() {
    if (dateToggleButton.isChecked()) {
        if (timeToggleButton.isChecked()) {
            return new LocalDateTime(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth(), timePicker.getCurrentHour(), timePicker.getCurrentMinute(), 0);
        } else {
            return new LocalDate(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth());
        }

    } else return null;
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:17,代码来源:EditItem.java


示例5: createDate

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Creates a date object using the user selected date and time from the date and time pickers.
 * Null if no date selected.
 *
 * @return a date object with user selected date/time
 */
private BaseLocal createDate() {
    if (dateToggleButton.isChecked()) {
        if (timeToggleButton.isChecked()) {
            return new LocalDateTime(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth(), timePicker.getCurrentHour(), timePicker.getCurrentMinute(), 0);
        } else {
            return new LocalDate(datePicker.getYear(), datePicker.getMonth() + 1, datePicker.getDayOfMonth());
        }
    } else return null;
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:16,代码来源:CreateItem.java


示例6: canHandle

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
@Override
public boolean canHandle(Object source, TypeToken<?> targetTypeToken) {
    return targetTypeToken.isSubtypeOf(BaseLocal.class) && stringToDateConverter.canHandle(source, TypeToken.of(Date.class));
}
 
开发者ID:keepcosmos,项目名称:beanmother,代码行数:5,代码来源:StringToJodaTimeBaseLocalConverter.java


示例7: canHandle

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
@Override
public boolean canHandle(Object source, TypeToken<?> targetTypeToken) {
    return targetTypeToken.isSubtypeOf(BaseLocal.class) && (source instanceof Date);
}
 
开发者ID:keepcosmos,项目名称:beanmother,代码行数:5,代码来源:DateToJodaTimeBaseLocalConverter.java


示例8: cursorToItem

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Converts data from the database into ToDoItem objects.
 *
 * @param cursor To be converted into a ToDoItem
 * @return ToDoItem with values from the cursor
 */
private ToDoItem cursorToItem(Cursor cursor) {
    long id = cursor.getLong(0);
    String name = cursor.getString(1);

    BaseLocal date;

    if (cursor.getString(2).equals("null")) {
        date = null;
    } else {
        String split[] = cursor.getString(2).split(":");
        if (split[split.length - 1].equals("00")) {
            date = formatter.parseLocalDateTime(cursor.getString(2));
        } else {
            split = cursor.getString(2).split(" ");
            //need better solution
            split = split[0].split("/");

            StringBuilder stringBuilder = new StringBuilder();
            for (int i = split.length - 1; i > -1; i--) {
                stringBuilder.append(split[i]);
                if (i != 0) {
                    stringBuilder.append("-");
                }
            }

            String parseDate = stringBuilder.toString();

            date = new LocalDate(parseDate);
        }
    }

    boolean complete;
    if (cursor.getString(3).equals("0")) complete = false;
    else complete = true;

    String group = cursor.getString(4);
    String priority = cursor.getString(5);
    boolean reminder = Boolean.parseBoolean(cursor.getString(6));
    long eventID = cursor.getLong(7);
    boolean timeSet = Boolean.parseBoolean(cursor.getString(8));

    ToDoItem toDoItem = new ToDoItem(name, date, group, priority, timeSet);
    toDoItem.setId(id);
    toDoItem.setEventID(eventID);
    toDoItem.setComplete(complete);
    toDoItem.setReminder(reminder);
    return toDoItem;
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:55,代码来源:ItemsDataSource.java


示例9: getDate

import org.joda.time.base.BaseLocal; //导入依赖的package包/类
/**
 * Returns null if no date has been set.
 *
 * @return date
 */
public BaseLocal getDate() {
    return date;
}
 
开发者ID:JamesFrost,项目名称:SimpleDo,代码行数:9,代码来源:ToDoItem.java



注:本文中的org.joda.time.base.BaseLocal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CPacketPlayerTryUseItem类代码示例发布时间:2022-05-23
下一篇:
Java InfoEndpoint类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap