Interface IZenClassRegistry
- All Known Implementing Classes:
ZenClassRegistry
An instance of this class can be obtained through IZenClassRegistry.
- Since:
- 9.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceIdentifies raw information on the classes registered to a specificIScriptLoader. -
Method Summary
Modifier and TypeMethodDescriptiongetClassData(IScriptLoader loader) Gets the raw class data for the given loader.getClassesInPackage(IScriptLoader loader, String packageName) Gets all classes that are located in the given package among the ones exposed to the targeted loader.getGlobalsInPackage(IScriptLoader loader, String packageName) Gets all classes that expose globals located in the given package among the ones exposed to the targeted loader.getImplementationsOf(IScriptLoader loader, Class<T> target) Gets all non-abstract classes that extend or implement the given target for the specified loader.getNameFor(IScriptLoader loader, Class<?> clazz) Attempts to identify the name under which the target class is exposed to ZenCode in the given loader.getNativeTypeRegistry(IScriptLoader loader) Obtains theINativeTypeRegistryfor the given loader.getRootPackages(IScriptLoader loader) Gets the set of all the packages that act as root for the given loader.booleanisBlacklisted(Class<?> clazz) Checks whether the given class has been blacklisted from registration.booleanisRegistered(IScriptLoader loader, Class<?> clazz) Verifies whether the given class is registered and thus exposed to the given loader.
-
Method Details
-
isRegistered
Verifies whether the given class is registered and thus exposed to the given loader.- Parameters:
loader- TheIScriptLoaderfor which exposure data should be checked for.clazz- The class whose exposure should be checked.- Returns:
- Whether the class is exposed to the loader or not.
- Since:
- 9.1.0
-
getNameFor
Attempts to identify the name under which the target class is exposed to ZenCode in the given loader.- Parameters:
loader- TheIScriptLoaderfor which the name should be identified.clazz- The class whose name should be identified.- Returns:
- An
Optionalwrapping the name of the class if it is exposed, an empty optional if the class is not exposed. - Since:
- 9.1.0
-
getImplementationsOf
Gets all non-abstract classes that extend or implement the given target for the specified loader.- Type Parameters:
T- The type the returned classes should be implementing or extending.- Parameters:
loader- TheIScriptLoaderfor which implementations should be found.target- The class or interface for which implementations should be identified.- Returns:
- A
Listof non-abstract classes that extend or implement the given target, if any. - Since:
- 9.1.0
-
getClassData
Gets the raw class data for the given loader.Access to the raw class data is discouraged, as other methods of querying classes should be preferred. Nevertheless, access is permitted as there might be some instances where the raw data needs to be used. Such data access is regardless provided as read-only, to avoid unwanted tampering.
- Parameters:
loader- TheIScriptLoaderfor which the raw class data should be obtained.- Returns:
- An instance of
IZenClassRegistry.IClassDatacontaining the raw class data for the target loader. - Since:
- 9.1.0
-
getClassesInPackage
Gets all classes that are located in the given package among the ones exposed to the targeted loader.The concept of package used in this context is the ZenCode concept, instead of the Java one. This means that subpackages of the given package are also queried.
- Parameters:
loader- TheIScriptLoaderfor which the data should be gathered.packageName- The name of the package the various classes should be located in.- Returns:
- A
Listof all the classes located in the target package. - Since:
- 9.1.0
-
getGlobalsInPackage
Gets all classes that expose globals located in the given package among the ones exposed to the targeted loader.The concept of package used in this context is the ZenCode concept, instead of the Java one. This means that subpackages of the given package are also queried.
- Parameters:
loader- TheIScriptLoaderfor which the data should be gathered.packageName- The name of the package the various global-exposing classes should be located in.- Returns:
- A
Listof all the global-exposing classes located in the target package. - Since:
- 9.1.0
-
getRootPackages
Gets the set of all the packages that act as root for the given loader.- Parameters:
loader- TheIScriptLoaderfor which root packages should be gathered.- Returns:
- A
Setcontaining all root packages. - Since:
- 9.1.0
-
getNativeTypeRegistry
Obtains theINativeTypeRegistryfor the given loader.- Parameters:
loader- TheIScriptLoaderfor which the native type registry should be obtained.- Returns:
- The loader's corresponding
INativeTypeRegistry. - Since:
- 9.1.0
-
isBlacklisted
Checks whether the given class has been blacklisted from registration.A blacklisted class will never be registered to any loader because its registration might fail due to unsatisfied requirements. A reason for the blacklist can be identified through the log.
- Parameters:
clazz- The class to check for blacklisting.- Since:
- 9.1.0
-