Class ZenClassRegistry
- All Implemented Interfaces:
IZenClassRegistry
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.zencode.IZenClassRegistry
IZenClassRegistry.IClassData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidfillLoaderData(Collection<IScriptLoader> loaders) getClassData(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> checkFor) 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<?> cls) 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.voidregisterNativeType(IScriptLoader loader, NativeTypeInfo info) voidregisterZenType(IScriptLoader loader, Class<?> clazz, ZenTypeInfo info, boolean globals)
-
Constructor Details
-
ZenClassRegistry
public ZenClassRegistry()
-
-
Method Details
-
isRegistered
Description copied from interface:IZenClassRegistryVerifies whether the given class is registered and thus exposed to the given loader.- Specified by:
isRegisteredin interfaceIZenClassRegistry- 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.
-
getNameFor
Description copied from interface:IZenClassRegistryAttempts to identify the name under which the target class is exposed to ZenCode in the given loader.- Specified by:
getNameForin interfaceIZenClassRegistry- 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.
-
getImplementationsOf
Description copied from interface:IZenClassRegistryGets all non-abstract classes that extend or implement the given target for the specified loader.- Specified by:
getImplementationsOfin interfaceIZenClassRegistry- Type Parameters:
T- The type the returned classes should be implementing or extending.- Parameters:
loader- TheIScriptLoaderfor which implementations should be found.checkFor- 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.
-
getClassData
Description copied from interface:IZenClassRegistryGets 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.
- Specified by:
getClassDatain interfaceIZenClassRegistry- 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.
-
getClassesInPackage
Description copied from interface:IZenClassRegistryGets 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.
- Specified by:
getClassesInPackagein interfaceIZenClassRegistry- 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.
-
getGlobalsInPackage
Description copied from interface:IZenClassRegistryGets 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.
- Specified by:
getGlobalsInPackagein interfaceIZenClassRegistry- 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.
-
getRootPackages
Description copied from interface:IZenClassRegistryGets the set of all the packages that act as root for the given loader.- Specified by:
getRootPackagesin interfaceIZenClassRegistry- Parameters:
loader- TheIScriptLoaderfor which root packages should be gathered.- Returns:
- A
Setcontaining all root packages.
-
getNativeTypeRegistry
Description copied from interface:IZenClassRegistryObtains theINativeTypeRegistryfor the given loader.- Specified by:
getNativeTypeRegistryin interfaceIZenClassRegistry- Parameters:
loader- TheIScriptLoaderfor which the native type registry should be obtained.- Returns:
- The loader's corresponding
INativeTypeRegistry.
-
isBlacklisted
Description copied from interface:IZenClassRegistryChecks 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.
- Specified by:
isBlacklistedin interfaceIZenClassRegistry- Parameters:
cls- The class to check for blacklisting.
-
fillLoaderData
-
registerNativeType
-
registerZenType
public void registerZenType(IScriptLoader loader, Class<?> clazz, ZenTypeInfo info, boolean globals) -
applyInheritanceRules
public void applyInheritanceRules()
-