本文整理汇总了Java中org.threeten.bp.LocalTime.parse方法的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.parse方法的具体用法?Java LocalTime.parse怎么用?Java LocalTime.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.LocalTime
的用法示例。
在下文中一共展示了LocalTime.parse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Lesson
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
public Lesson(@NonNull String syncId, Schedule schedule, DayOfWeek weekday, boolean isGroupSchedule) {
this._id = null;
this.syncId = syncId;
this.auditoryList = schedule.auditory;
this.employeeList = schedule.employee;
String[] lessonTime = TextUtils.split(schedule.lessonTime, "-");
try {
this.lessonTimeStart = LocalTime.parse(lessonTime[0]);
this.lessonTimeEnd = LocalTime.parse(lessonTime[1]);
} catch (IndexOutOfBoundsException e) {
Timber.e("Something went wrong: " + e.getMessage());
}
this.lessonType = schedule.lessonType;
this.note = schedule.note;
this.numSubgroup = schedule.numSubgroup;
this.studentGroupList = schedule.studentGroup;
this.subject = schedule.subject;
this.weekNumberList = schedule.weekNumber;
this.weekday = weekday;
this.isGroupSchedule = isGroupSchedule;
}
示例2: testSerialization
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
@Test
public void testSerialization() {
LocalTime localTime = LocalTime.parse("10:34:00");
String json = gson.toJson(localTime);
assertEquals(json, "\"10:34:00\"");
}
示例3: mapFromCursor
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
@NonNull @Override public Lesson mapFromCursor(@NonNull Cursor cursor) {
String[] auditoryArray =
mGson.fromJson(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_AUDITORY_LIST)),
String[].class);
if (auditoryArray == null) {
auditoryArray = new String[] {};
}
Employee[] employeeArray =
mGson.fromJson(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_EMPLOYEE_LIST)),
Employee[].class);
if (employeeArray == null) {
employeeArray = new Employee[] {};
}
String[] studentGroupArray =
mGson.fromJson(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_STUDENT_GROUP_LIST)),
String[].class);
Integer[] weekNumberArray =
mGson.fromJson(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_WEEK_NUMBER_LIST)),
Integer[].class);
return new Lesson(cursor.getLong(cursor.getColumnIndex(LessonEntry._ID)),
cursor.getString(cursor.getColumnIndex(LessonEntry.COL_SYNC_ID)),
new ArrayList<>(Arrays.asList(auditoryArray)),
new ArrayList<>(Arrays.asList(employeeArray)),
LocalTime.parse(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_LESSON_TIME_START))),
LocalTime.parse(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_LESSON_TIME_END))),
cursor.getString(cursor.getColumnIndex(LessonEntry.COL_LESSON_TYPE)),
cursor.getString(cursor.getColumnIndex(LessonEntry.COL_NOTE)),
cursor.getInt(cursor.getColumnIndex(LessonEntry.COL_NUM_SUBGROUP)),
new ArrayList<>(Arrays.asList(studentGroupArray)),
cursor.getString(cursor.getColumnIndex(LessonEntry.COL_SUBJECT)),
new ArrayList<>(Arrays.asList(weekNumberArray)),
DayOfWeek.valueOf(cursor.getString(cursor.getColumnIndex(LessonEntry.COL_WEEKDAY))),
cursor.getInt(cursor.getColumnIndex(LessonEntry.COL_IS_GROUP_SCHEDULE)) != 0);
}
示例4: getModelValue
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
@Override
public LocalTime getModelValue(String data) {
if (data == null) {
return null;
}
return LocalTime.parse(data);
}
示例5: testSerialisation
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
/**
* Tests that serialising to JSON works.
*/
@Test
public void testSerialisation() throws Exception
{
final Gson gson = registerLocalTime(new GsonBuilder()).create();
final LocalTime localTime = LocalTime.parse("12:56:00");
final String json = gson.toJson(localTime);
assertThat(json, is("\"12:56:00\""));
}
示例6: parseTime
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
private static LocalTime parseTime(String time) {
return time.isEmpty() ? null : LocalTime.parse(time, TIME_FORMAT);
}
示例7: get
import org.threeten.bp.LocalTime; //导入方法依赖的package包/类
@Override public LocalTime get(@NonNull String key, @NonNull SharedPreferences preferences) {
return LocalTime.parse(preferences.getString(key, "07:00"));
}