public final class Utilities extends Object
Common Utilities, primarily immutability functionality.
Modifier and Type | Method and Description |
---|---|
static byte[] |
copy(byte[] bytes)
Copy method for Byte Arrays, to have a central way to protect the data
structures from external changes.
|
static Date |
copy(Date date)
Copy method for standard Date Objects, to have a central way to protect
those pesky mutable Objects.
|
static Date |
newDate()
Although this method may appear to be silly, it serves the purpose of
acting as an intermediate between the old Date Object and the newer
Java8 Time functionality.
|
static Date |
newDate(long millisSinceEpoch)
Although this method may appear to be silly, it serves the purpose of
acting as an intermediate between the old Date Object and the newer
Java8 Time functionality.
|
public static Date newDate(long millisSinceEpoch)
millisSinceEpoch
- Milli Seconds since epoch (1970-01-01 00:00:00)public static Date newDate()
public static Date copy(Date date)
date
- Date Object to protectpublic static byte[] copy(byte[] bytes)
Copy method for Byte Arrays, to have a central way to protect the data structures from external changes.
Note, that as the API is only exposed via a WebService (SOAP/REST), there is currently no need for a proper copying.
Further, the copy here is fake - meaning that it doesn't do anything. This is important, as some byte arrays must be actively destroyed, which is harder if multiple actual copies exists.
bytes
- Byte Array to protectCopyright © 2019 JavaDog.io. All rights reserved.