![JAR search and dependency download from the Maven repository](/logo.png)
src.main.java.com.mgnt.lifecycle.management.BaseEntityFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of MgntUtils Show documentation
Show all versions of MgntUtils Show documentation
Set of various Utils: stacktrace noise filter, String to/from unicode sequence converter, simple Http client JSON parser/serializer,
Silent String parsing to Integer and other numeric types, Parsing String to time intervals with support for time unit suffixes,
JSON parser that provides serialization/deserialization of classes to JSON, Version comparator and Version ranges operations,
Self-throttling binary reader from Http request, File reader, A utility that automatically initiates a Factory with instances of all
classes that implement user provided interface. An infrastructure for writing Scheduled Task classes where time
interval for task execution is provided in humanly readable format (such as "9h" for 9 hours)
package com.mgnt.lifecycle.management;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* This is the parent factory class for all the factories. See the javadoc for the {@link com.mgnt.lifecycle.management}
* and source code in package {@code com.mgnt.lifecycle.management.example} for detailed explanation on how to use this class
* @param
*/
public abstract class BaseEntityFactory {
private Map entityHolder = new HashMap<>();
/**
* This method is for internal use by the infrastructure. It is used to place any newly instantiated class
* into the factory as part of new entity instantiation
* @param key
* @param bean
*/
void putEntity(String key, I bean) {
entityHolder.put(key, bean);
}
/**
* this method is for retrieval of an Instance of concrete implementation from the factory
* @param key
* @return
*/
public I getEntity(String key) {
return entityHolder.get(key);
}
/**
* This method returns all the implementations
* @return a Collection that contains all the implementations held in this factory
*/
public Collection getAllEntities() {
return entityHolder.values();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy