I think the final reference to the array of enumerations should be immutable.
The uniqueness and peculiarity of the enumerations is ensured by the JVM, so I believe that it is safe to say that they are immutable.
The final link cannot be changed, so the link is immutable.
But ... how about an array? Could it be possible to undermine an array containing enumeration references?
I have a list of enumerations matching the database columns. These column names and the data associated with them do not change, so ... I would like to have a list as a class variable like this:
static final List<MetaData<Client>> C_COLUMNS = DataTables.CLIENTS.getTableColumnsAsEnums();
where CLIENTS is a DataTable enumeration for which a list of column enumerations is created. The method that does this follows:
public <T extends DB> List<MetaData<T>> getTableColumnsAsEnums() { Class<? extends MetaData> cls = this.columnsEnumToken(); return new ArrayList(Arrays.<MetaData<T>>asList(cls.getEnumConstants())); }
I'm right? This should become part of a multi-threaded design, and therefore I am concerned about how to make this critical list of static data application rendering very vulnerable ... if it is really modified.
source share