Class Deprecation

  • All Implemented Interfaces:
    java.io.Serializable

    public final class Deprecation
    extends java.lang.Object
    implements java.io.Serializable
    A serializable class that provides detailed information about deprecation.

    This class is used to indicate that a specific API or component is deprecated, and optionally provides details such as:

    • The version since when it became deprecated
    • A suggested replacement (if available)
    • The reason for deprecation
    • A link to further documentation or migration guide
    • The deprecation level, e.g., whether it's marked for removal

    Example Usage

    
     // Create a simple deprecation notice with the version string
     Deprecation deprecation = Deprecation.of("1.2.0");
    
     // Create a deprecation notice with replacement and reason
     Deprecation deprecation = Deprecation.of("1.5.0", "NewClass", "Use NewClass instead for better performance");
    
     // Create a full deprecation notice with all fields
     Deprecation deprecation = Deprecation.of("2.0.0", "NewApi", "OldApi is inefficient", "https://example.com/docs/migration", Deprecation.Level.REMOVAL);
    
     // Using the Builder API for more flexibility
     Deprecation deprecation = Deprecation.builder()
         .since("2.1.0")
         .replacement("ImprovedUtil")
         .reason("LegacyUtil has known issues and will be removed in future versions.")
         .link("https://docs.example.com/legacyutil-removal")
         .level(Deprecation.Level.REMOVAL)
         .build();
     
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    Serializable, Version, Serialized Form
    • Method Detail

      • getReplacement

        @Nullable
        public java.lang.String getReplacement()
      • getReason

        @Nullable
        public java.lang.String getReason()
      • getLink

        @Nullable
        public java.lang.String getLink()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • of

        public static Deprecation of​(java.lang.String since)
      • of

        public static Deprecation of​(java.lang.String since,
                                     java.lang.String replacement)
      • of

        public static Deprecation of​(java.lang.String since,
                                     java.lang.String replacement,
                                     java.lang.String reason)
      • of

        public static Deprecation of​(java.lang.String since,
                                     java.lang.String replacement,
                                     java.lang.String reason,
                                     java.lang.String link)
      • of

        public static Deprecation of​(java.lang.String since,
                                     java.lang.String replacement,
                                     java.lang.String reason,
                                     java.lang.String link,
                                     Deprecation.Level level)