getInstance method

IModel getInstance(
  1. String key
)

IModel Multiton Factory method.

  • Returns the IModel Multiton instance for the specified key.

Implementation

static IModel getInstance(String key) {
  if (key == null || key == "") return null;
  if (instanceMap == null) instanceMap = new Map<String, IModel>();
  if (instanceMap[key] == null) instanceMap[key] = new Model(key);
  return instanceMap[key];
}