ClassDef.Loader| Constructor and Description |
|---|
ClassDefImpl(Class<?> aClass)
Constructs an instance.
|
ClassDefImpl(String className)
Constructs an instance.
|
ClassDefImpl(String packageName,
String member)
Constructs an instance.
|
| 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.
|
String |
toString()
Returns a String representation of itself.
|
public ClassDefImpl(@Nonnull
Class<?> aClass)
Used to create default class definitions.
aClass - A class object.public ClassDefImpl(@Nonnull
String className)
Creates a class definition from a string.
className - The complete class name.public ClassDefImpl(@Nonnull
String packageName,
@Nonnull
String member)
packageName - The name of the package containing the class.member - The class name without the package specification.public <T> T createInstance(Class<T> expectedClass)
Uses the class returned by ClassDef.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.
createInstance in interface ClassDefT - The type of the returned value.expectedClass - The expected class.public String getClassName()
getClassName in interface ClassDefpublic Class<?> getInstanceClass()
If the class loading fails, an error message is logged and a null value is returned.
getInstanceClass in interface ClassDefpublic Class<?> getInstanceClass(Optional<ClassLoader> classLoader)
If the class loading fails, an error message is logged and a null value is returned.
getInstanceClass in interface ClassDefclassLoader - The optional class loader to use.public String getMember()
public String getPackageName()
getPackageName in interface ClassDefpublic boolean isLoaded()
public String toString()
toString in class ObjectCopyright © 2003-2019 Serge Brisson. All Rights Reserved.