Package io.microsphere.lang
Class Deprecation
- java.lang.Object
-
- io.microsphere.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Deprecation.Builder
The Builder class forDeprecation
static class
Deprecation.Level
Deprecation Level
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deprecation.Builder
builder()
Create a new instance ofDeprecation.Builder
boolean
equals(java.lang.Object o)
Deprecation.Level
getLevel()
java.lang.String
getLink()
java.lang.String
getReason()
java.lang.String
getReplacement()
Version
getSince()
int
hashCode()
static Deprecation
of(java.lang.String since)
static Deprecation
of(java.lang.String since, java.lang.String replacement)
static Deprecation
of(java.lang.String since, java.lang.String replacement, java.lang.String reason)
static Deprecation
of(java.lang.String since, java.lang.String replacement, java.lang.String reason, java.lang.String link)
static Deprecation
of(java.lang.String since, java.lang.String replacement, java.lang.String reason, java.lang.String link, Deprecation.Level level)
java.lang.String
toString()
-
-
-
Method Detail
-
getReplacement
@Nullable public java.lang.String getReplacement()
-
getReason
@Nullable public java.lang.String getReason()
-
getLink
@Nullable public java.lang.String getLink()
-
getLevel
@Nonnull public Deprecation.Level getLevel()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
builder
public static Deprecation.Builder builder()
Create a new instance ofDeprecation.Builder
- Returns:
- non-null
-
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)
-
-