public interface ClassDef
Class definitions wrap the handling of run time references to classes.
Modifier and Type | Interface and Description |
---|---|
static interface |
ClassDef.Loader
Loader.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
createInstance(Class<T> expectedClass)
Creates an instance of the class.
|
String |
getClassName()
Gets the referenced class name.
|
Class<?> |
getInstanceClass()
Gets the class of instances created by this class definition.
|
Class<?> |
getInstanceClass(Optional<ClassLoader> classLoader)
Gets the class of instances created by this class definition.
|
String |
getMember()
Gets the package member name for the class.
|
String |
getPackageName()
Gets the package name for the class.
|
boolean |
isLoaded()
Asks if the class has been loaded.
|
@Nullable @CheckReturnValue <T> T createInstance(@Nonnull Class<T> expectedClass)
Uses the class returned by getInstanceClass()
, thus
triggering the class loading if needed. If either the class loading or
the instance creation fails, an error message is logged and a null value
is returned.
T
- The type of the returned value.expectedClass
- The expected class.@Nonnull @CheckReturnValue String getClassName()
@Nullable @CheckReturnValue Class<?> getInstanceClass()
If the class loading fails, an error message is logged and a null value is returned.
@Nullable @CheckReturnValue Class<?> getInstanceClass(@Nonnull Optional<ClassLoader> classLoader)
If the class loading fails, an error message is logged and a null value is returned.
classLoader
- The optional class loader to use.@Nonnull @CheckReturnValue String getMember()
@Nonnull @CheckReturnValue String getPackageName()
@CheckReturnValue boolean isLoaded()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.