Package me.deecaad.weaponmechanics.utils
Class Factory<T>
java.lang.Object
me.deecaad.weaponmechanics.utils.Factory<T>
- Direct Known Subclasses:
ExposureFactory,ShapeFactory
-
Constructor Details
-
Factory
Only subclasses should be able to instantiate this class. It does not make sense to instantiate a factory otherwise.
-
-
Method Details
-
get
public final T get(@NotNull @NotNull String key, @NotNull @NotNull Map<String, Object> arguments) throws me.deecaad.core.file.SerializerExceptionReturns a constructed object of who inherits fromT, constructed from the givenarguments. In order to add a new type, useset(String, Arguments).The given
argumentsMUST explicitly contain ALL objects defined by theFactory.Arguments.arguments. If an argument is missing, aSerializerExceptionis thrown. The given objects are type-casted to their expected type. Ensure that the constructors for your defined arguments exist.- Parameters:
key- The non-null, non-case-sensitive name of the class to instantiate.arguments- The non-null map of arguments.- Returns:
- Instantiated object.
- Throws:
InternalError- If no "good" constructor exists.me.deecaad.core.file.SerializerException- invalid key OR missing argument OR invalid argument type.
-
set
-
getOptions
-
getMap
-