Mercurial > hg > release > heapstats-2.1
view analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/SnapShotHeaderConverter.java @ 238:55773172374f
Bug 3219: Upload artifacts to the Maven Central Repository
Reviewed-by: yasuenag
GitHub: https://github.com/HeapStats/heapstats/pull/105
author | KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> |
---|---|
date | Mon, 26 Jun 2017 21:05:32 +0900 |
parents | b92aa059996a |
children |
line wrap: on
line source
/* * Copyright (C) 2014-2016 Yasumasa Suenaga * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package jp.co.ntt.oss.heapstats.plugin.builtin.snapshot; import java.util.Optional; import javafx.util.StringConverter; import jp.co.ntt.oss.heapstats.container.snapshot.SnapShotHeader; import jp.co.ntt.oss.heapstats.utils.HeapStatsUtils; /** * StringConverter for LocalDateTime of SnapShotHeader. * This class is used at JavaFX controls. * * @author Yasumasa Suenaga */ public class SnapShotHeaderConverter extends StringConverter<SnapShotHeader> { @Override public String toString(SnapShotHeader object) { return Optional.ofNullable(object) .map(o -> o.getSnapShotDate().format(HeapStatsUtils.getDateTimeFormatter())) .orElse(null); } @Override public SnapShotHeader fromString(String string) { throw new UnsupportedOperationException("SnapShotHeader DO NOT convert from String."); } }