Search in sources :

Example 1 with UUIDAdapter

use of com.github.games647.craftapi.UUIDAdapter in project FastLogin by games647.

the class SQLStorage method parseResult.

private Optional<StoredProfile> parseResult(ResultSet resultSet) throws SQLException {
    if (resultSet.next()) {
        long userId = resultSet.getInt(1);
        UUID uuid = Optional.ofNullable(resultSet.getString(2)).map(UUIDAdapter::parseId).orElse(null);
        String name = resultSet.getString(3);
        boolean premium = resultSet.getBoolean(4);
        String lastIp = resultSet.getString(5);
        Instant lastLogin = resultSet.getTimestamp(6).toInstant();
        return Optional.of(new StoredProfile(userId, uuid, name, premium, lastIp, lastLogin));
    }
    return Optional.empty();
}
Also used : StoredProfile(com.github.games647.fastlogin.core.StoredProfile) Instant(java.time.Instant) UUID(java.util.UUID)

Aggregations

StoredProfile (com.github.games647.fastlogin.core.StoredProfile)1 Instant (java.time.Instant)1 UUID (java.util.UUID)1