Java generics "registry" design pattern



So here is what I am after:

I want to have a generic class MyClass<T> that holds a data member
ArrayList<T> m_TList

Now, suppose I have a method that reads a file, and has to fill in the
list. The file is a list of strings, and I want to have a registry
class that knows how to turn a string into a T object. T is
"Identifiable" - that is, each object has a unique String ID. I want
the T class to be able to return its (static) Registry object so to
have something like:

public class MyClass<T>
{
public void readFile(String filename)
{
// open file
// get registry of T
Registry<T> registryOfT = ...
// for each line of file
// read String ID
T newObject = registryOfT.getObject( ID );
m_TList.add( newObject )
}
}

The idea is that T can be a person with a social security number ID,
or a part with a unique identifier.

Any ideas?

Thanks, Ofer.
.



Relevant Pages

  • Re: Importing Excel files with columns > 255 chars
    ... or similar string manipulation to get the required maximum length. ... to change the column width of Error output columns, ... Create a connection to that spreadsheet and check the data ... the following registry key when reading the spreadsheet: ...
    (microsoft.public.sqlserver.dts)
  • Re: ascii -> hex-wandler und Reg_Binary eintrag
    ... Integer usw. und Strings klar machen. ... Damit schreibst Du die ASCII-Werte der in dem String OutputText enthaltenen ... Zeichen in die Registry. ... Du solltest Dich erst mal gründlich mit Grundlagen wie Datentypen ...
    (microsoft.public.de.vb)
  • Re: Editing Registry in WinCE 6.0
    ... ActivateDeviceEx and DeactivateDevice calls to load/unload my driver. ... This reads a string value from the reg. ... Copy this registry to file. ... Saves you from having to reboot all the time... ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Securing my app with serial number
    ... The app has two passwords hard-coded into it, we'll call them A and B. ... It then encrypts that string with password A, ... and stores it in the registry as a challenge code. ... I can also insert some extra data into the beginning of unlock code ...
    (microsoft.public.dotnet.languages.vb)
  • OT - Another Windows Vulnerability
    ... The now infamous Regedit vulnerability ... "The weakness is caused due to an error in the Registry Editor ... Utility when handling long string names. ... to hide strings in the "Run" registry key. ...
    (rec.outdoors.rv-travel)