Package ej.bon
Class Immutables
- java.lang.Object
-
- ej.bon.Immutables
-
public class Immutables extends Object
This class gives access to the global immutable objects pool.Immutable objects are persistent and normally reside in read-only-memory, such as flash memory.
The method
get(String)allows to retrieve an object from the pool using its ID.
-
-
Constructor Summary
Constructors Constructor Description Immutables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String[]allIDs()Returns an array with the IDs of all the objects in the pool.static longfreeMemory()Returns the amount of free immutable memory still available.static Objectget(String ID)Retrieves the object that match the the given ID in the immutable objects pool.static booleanisImmutable(Object object)Gets whether or not the given object is in the immutable objects pool or not.static longtotalMemory()Returns the total amount of immutable memory.
-
-
-
Method Detail
-
get
public static Object get(String ID)
Retrieves the object that match the the given ID in the immutable objects pool.If no object can be found with such ID, a
NoSuchElementExceptionis thrown.- Parameters:
ID- the ID of the immutable object to get- Returns:
- the immutable object matching the ID
- Throws:
NoSuchElementException- if the ID is not foundImmutablesError- if an internal error occurred during immutable access
-
isImmutable
public static boolean isImmutable(Object object)
Gets whether or not the given object is in the immutable objects pool or not.- Parameters:
object- the object to check- Returns:
trueif the given object is immutable,falseotherwise- Throws:
NullPointerException- if given object isnull
-
allIDs
public static String[] allIDs()
Returns an array with the IDs of all the objects in the pool.- Returns:
- all the immutable objects ID.
- See Also:
get(String)
-
freeMemory
public static long freeMemory()
Returns the amount of free immutable memory still available.- Returns:
- the amount of free immutable memory
-
totalMemory
public static long totalMemory()
Returns the total amount of immutable memory.Note that the amount of memory required to hold an object of any given type may be implementation-dependent.
- Returns:
- the total amount of immutable memory
-
-