Class ClassDefinition

  • All Implemented Interfaces:
    java.io.Serializable

    public class ClassDefinition
    extends ReflectiveDefinition
    A concrete implementation of ReflectiveDefinition representing the definition of a Java class.

    This class provides reflection-based access to information about a class, including its name, version since introduction, deprecation status, and whether it is currently present in the runtime environment.

    Example Usage

    
     // Create a ClassDefinition for a class introduced in version "1.0.0"
     ClassDefinition definition = new ClassDefinition("1.0.0", "java.util.ArrayList");
    
     // Check if the class is available in the current runtime
     boolean isPresent = definition.isPresent(); // returns true if 'ArrayList' is found
    
     // Get the version since the class was introduced
     Version sinceVersion = definition.getSince(); // e.g., version "1.0.0"
    
     // Get the resolved Class object (may be null if not found)
     Class<?> resolvedClass = definition.getResolvedClass();
     

    If the class is marked as deprecated, you can retrieve the deprecation details using ReflectiveDefinition.getDeprecation().

    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    ReflectiveDefinition, Serialized Form
    • Constructor Detail

      • ClassDefinition

        public ClassDefinition​(@Nonnull
                               java.lang.String since,
                               @Nonnull
                               java.lang.String className)
        Parameters:
        since - the 'since' version
        className - the name of class
      • ClassDefinition

        public ClassDefinition​(@Nonnull
                               java.lang.String since,
                               @Nullable
                               Deprecation deprecation,
                               @Nonnull
                               java.lang.String className)
        Parameters:
        since - the 'since' version
        deprecation - the deprecation
        className - the name of class
      • ClassDefinition

        public ClassDefinition​(@Nonnull
                               Version since,
                               @Nonnull
                               java.lang.String className)
        Parameters:
        since - the 'since' version
        className - the name of class
      • ClassDefinition

        public ClassDefinition​(@Nonnull
                               Version since,
                               @Nullable
                               Deprecation deprecation,
                               @Nonnull
                               java.lang.String className)
        Parameters:
        since - the 'since' version
        deprecation - the deprecation
        className - the name of class