T
- the type of the base-class. Automatically assigned to the property baseClass
.E
- the type of the extending class. Automatically assigned to the property extendingClass
.public abstract class AbstractClassExtension<T,E extends T> extends Object implements ClassExtension<T>
ClassExtension
.
It is highly recommended not to implement the interface ClassExtension
directly. Instead,
implementors should always extend this abstract base-class.
In most cases, an implementation of a ClassExtension
looks simply like this example:
public class SsSymlinkClassExtension extends AbstractClassExtension<Symlink, SsSymlink> { }
It is recommended to use the naming scheme "${extendingClassName}" + "ClassExtension" as shown in the example above.
Constructor and Description |
---|
AbstractClassExtension() |
Modifier and Type | Method and Description |
---|---|
Class<T> |
getBaseClass()
Gets the base-class to be extended by instantiating a sub-class instead.
|
Class<E> |
getExtendingClass()
Gets the sub-class extending the
baseClass to be instantiated whenever
a new instance of the base-class is requested. |
int |
getPriority()
Gets the priority of this extension.
|
public AbstractClassExtension()
public int getPriority()
If there are multiple ClassExtension
-implementations for the same baseClass
, the
extension with the highest priority (i.e the greatest number returned here) is chosen.
The default implementation in AbstractClassExtension
returns 0. Override and return
either a negative value, if you want to provide a fallback-implementation (that is likely to be
replaced by a different ClassExtension
) or a positive value in order to override
another ClassExtension
(make sure your priority is greater than the other extension's priority).
getPriority
in interface ClassExtension<T>
public Class<T> getBaseClass()
ClassExtension
getBaseClass
in interface ClassExtension<T>
null
.public Class<E> getExtendingClass()
ClassExtension
baseClass
to be instantiated whenever
a new instance of the base-class is requested.getExtendingClass
in interface ClassExtension<T>
baseClass
. Never null
.Copyright © 2013–2019. All rights reserved.