T- the type of the base-class to be extended (i.e. replaced in all instantiations) by a certain sub-class.
public interface ClassExtension<T>
ClassExtensiondeclares that a sub-class must be instantiated instead of a certain base-class.
In order to register a sub-class as replacement for a certain base-class, implementors have to provide a
ClassExtension and register it using the
ServiceLoader-mechanism. This means, they must place a file
in their extension-project and enlist their
Important: It is recommended not to directly implement this interface, but to sub-class
Important 2: If a certain base-class should be replaceable using this mechanism, all occurrences
new MyBaseClass(...) in the entire code-base must be replaced by
Important 3: It is urgently recommended not to use this approach, whenever it is possible to use a better solution,
preferably a well-defined service (=>
ServiceLoader). There are situations, though, e.g. data-model-classes
(a.k.a. entities), where services are not possible and
ClassExtension is the perfect solution.
|Modifier and Type||Method and Description|
Gets the base-class to be extended by instantiating a sub-class instead.
Gets the sub-class extending the
Gets the priority of this extension.
If there are multiple
ClassExtension-implementations for the same
extension with the highest priority (i.e the greatest number returned here) is chosen.
Copyright © 2013–2018. All rights reserved.