Class AutoRegisterInfo
java.lang.Object
de.craftsblock.craftsnet.autoregister.meta.AutoRegisterInfo
The
AutoRegisterInfo holds information about a class to be processed in an auto registration
process. It contains the class name, the annotation associated with the class, the class loader,
and a list of parent types (superclasses and interfaces) of the class.
Optional it contains the addon that the source is located in. If no addons was set, the source is
not located inside an addon.- Since:
- 3.2.0-SNAPSHOT
-
Constructor Summary
ConstructorsConstructorDescriptionAutoRegisterInfo(@NotNull String className, @Nullable Collection<Addon> bounding, @NotNull Annotation annotation, @NotNull ClassLoader loader, @NotNull List<String> parentTypes) Constructs anAutoRegisterInfoobject with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean@NotNull AnnotationReturns the annotation associated with this class.@Nullable Collection<Addon>Returns theAddonassociated with this class, if any.@NotNull StringReturns the fully qualified class name of the target class.getInstantiated(CraftsNet craftsNet) Returns an instance of the target class.@NotNull ClassLoaderReturns the class loader used to load this class.Returns a list of parent types (superclasses and interfaces) of the class.booleanChecks whether this class is associated with anAddon.inthashCode()static AutoRegisterInfoof(@NotNull String className, @Nullable Collection<Addon> bounding, @NotNull Annotation annotation, @NotNull ClassLoader loader, @NotNull List<String> parentTypes) Creates a new instance ofAutoRegisterInfo.
-
Constructor Details
-
AutoRegisterInfo
public AutoRegisterInfo(@NotNull @NotNull String className, @Nullable @Nullable Collection<Addon> bounding, @NotNull @NotNull Annotation annotation, @NotNull @NotNull ClassLoader loader, @NotNull @NotNull List<String> parentTypes) Constructs anAutoRegisterInfoobject with the given parameters.- Parameters:
className- The fully qualified name of the class to be registered.bounding- The optionalAddonthat contains the class. Can benullif not inside an addon.annotation- The annotation associated with the class.loader- TheClassLoaderthat was used to load the class.parentTypes- A list of parent types (superclasses and interfaces) of the class.
-
-
Method Details
-
getInstantiated
Returns an instance of the target class. If the instance type requires a new object each time, a fresh instance is created. Otherwise, a cached instance is returned.- Parameters:
craftsNet- TheCraftsNetinstance used for dependency injection.- Returns:
- An instance of the target class.
- Since:
- 3.3.2-SNAPSHOT
-
getClassName
Returns the fully qualified class name of the target class.- Returns:
- The class name as a
String.
-
getBounding
Returns theAddonassociated with this class, if any.- Returns:
- The
Addoninstance ornullif no addon is associated.
-
hasBounding
public boolean hasBounding()Checks whether this class is associated with anAddon.- Returns:
trueif an addon is associated, otherwisefalse.- Since:
- 3.3.2-SNAPSHOT
-
getAnnotation
Returns the annotation associated with this class.- Returns:
- The associated
Annotation.
-
getLoader
Returns the class loader used to load this class.- Returns:
- The
ClassLoaderinstance.
-
getParentTypes
Returns a list of parent types (superclasses and interfaces) of the class.- Returns:
- An unmodifiable list of parent type names.
-
equals
Compares two
AutoRegisterInfoobjects for equality based on their class name and annotation. -
hashCode
public int hashCode()Calculates the hash code based on the class name and annotation.
-
of
public static AutoRegisterInfo of(@NotNull @NotNull String className, @Nullable @Nullable Collection<Addon> bounding, @NotNull @NotNull Annotation annotation, @NotNull @NotNull ClassLoader loader, @NotNull @NotNull List<String> parentTypes) Creates a new instance ofAutoRegisterInfo.- Parameters:
className- The name of the class.bounding- The list of addons that the auto register info is from. Nullable if the register info does not come from an addon.annotation- The annotation associated with the class.loader- The class loader that was used to load the class.parentTypes- A list of the names of the parent types (superclasses and interfaces) of the class.- Returns:
- A new instance of
AutoRegisterInfo.
-