/** * Compare the versions. * * @param versionNumber * Version number string to compare against * @return The result is a negative integer if o is _numerically_ less than this number. The result is a positive integer if o is _numerically_ greater than * this number. The result is zero if the version numbers are _numerically_ equal. */ public int compareTo(String versionNumber) { return versionCompare(toString(), versionNumber); }
/** * Check whether the date can be parsed. * * @param dateString * @return */ public static boolean isDate(String dateString) { Long date = fromISO8601(dateString); return date != null; }
/** * Return the next published version number * * @return next published version number */ public VersionNumber nextPublished() { return new VersionNumber(major + 1, 0); }
/** * Convert the provided unixtimestamp (miliseconds since midnight, January 1, 1970 UTC) to an ISO8601 string. Use the fallback timestamp if the provided * timestamp is null. * * @param timestampInMs * @param fallback * @return */ public static String toISO8601(Long timestampInMs, long fallback) { long time = timestampInMs == null ? fallback : timestampInMs; return toISO8601(time); }
/** * Hash the given key in order to generate a uniform etag hash. * * @param builder * builder which provides the keys of the string that will be hashed * @return Computed hash */ public static String hash(StringBuilder builder) { return hash(builder.toString()); }
/** * Return the full version string. */ @Override public String toString() { return getFullVersion(); }
public int compareTo(MavenVersionNumber other) { return compareTo(other, true); }
@Override public String deploymentID() { // In Gentics Mesh we use shortened UUIDs instead of the full Uuids. return UUIDUtil.toShortUuid(super.deploymentID()); }
/** * Create an instance * @param v1 first object * @param v2 second object * @return instance */ public static <V1, V2> Tuple<V1, V2> tuple(V1 v1, V2 v2) { return new Tuple<>(v1, v2); }
/** * Return the current page. * * @return Current page number */ default int getPage() { return NumberUtils.toInt(getParameter(PAGE_PARAMETER_KEY), DEFAULT_PAGE); }
/** * Return the per page count. * * @return Per page count */ default Long getPerPage() { return NumberUtils.toLong(getParameter(PER_PAGE_PARAMETER_KEY), null); }
/** * Return the image height. * * @return */ default Integer getHeight() { return toInteger(getParameter(HEIGHT_QUERY_PARAM_KEY), null); }
/** * Compare two versions. * * @param version */ default int compareTo(SCV version) { return VersionUtil.compareVersions(getVersion(), version.getVersion()); }
/** * Return the ISO 8601 formatted creation date. * * @return */ default String getCreationDate() { return DateUtils.toISO8601(getCreationTimestamp(), 0); }
/** * Compare the versions. * * @param versionNumber * Version number to compare against * @return The result is a negative integer if versionNumber is _numerically_ less than this number. The result is a positive integer if versionNumber is * _numerically_ greater than this number. The result is zero if the version numbers are _numerically_ equal. */ @Override public int compareTo(VersionNumber versionNumber) { return versionCompare(toString(), versionNumber.toString()); }
public static Long fromISO8601(String dateString) { return fromISO8601(dateString, false); }
/** * Return the next draft version number * * @return next draft version number */ public VersionNumber nextDraft() { return new VersionNumber(major, minor + 1); }
/** * Return the start date of the job. * * @return */ default String getStartDate() { Long timestamp = getStartTimestamp(); if (timestamp == null) { return null; } return DateUtils.toISO8601(timestamp); }
/** * Return the stop date of the job. * * @return */ default String getStopDate() { Long timestamp = getStopTimestamp(); if (timestamp == null) { return null; } return DateUtils.toISO8601(timestamp); }
/** * Return the ISO8601 formatted edited date. * * @return */ default String getLastEditedDate() { return DateUtils.toISO8601(getLastEditedTimestamp(), 0); }