I have various classes that extend a single class, NormalizedTransfer
, where I want to store some data (and do some other things, like transfer the list of normalizations somewhere). The parent class is:
public abstract class NormalizedTransfer
{
protected final List< Normalized > normalizedList = new ArrayList<>();
}
...and subclasses are defined like this:
public class BundleNormalizer extends NormalizedTransfer...
public class PatientNormalizer extends NormalizedTransfer...
public class ObservationNormalizer extends NormalizedTransfer...
public class ProcedureNormalizer extends NormalizedTransfer...
public class EncounterNormalizer extends NormalizedTransfer...
Each of the subclasses does something like this:
public class BundleNormalizer extends NormalizedTransfer
{
public void normalize()
{
normalizedList.add( new Normalized( /* some specification of a normalization accomplished */ ) );
}
}
Here, I show a simplified version of those classes (for bundles) after the essence of NormalizedTransfer
which is supposed to hold all discovered normalizations of all normalizers (and do other stuff), PatientNormalizer
, ObservationNormalizer
, etc. (plus BundleNomalizer
, obviously).
Only, when I analyse a the next patient in a document, and instantiate a new PatientNormalizer
, the normalizedList
of NormalizedTransfer
is a different list that the one for a bundle, than the other one for an observation, etc.
Of course it is; I know this. I'm probably looking for a "pattern" to implement.
Also, all of this code will be executed by myriad other threads handling each a separate medical document. So, what I'm asking for is a single (simple) database (ArrayList
) bookkeeping a list of normalizations that I'm recording for a whole document no matter what the type and how many resources (patients, observations, accounts, etc.) are encountered. And it can't have anything to do with whatever's being found in other documents.