Package io.microsphere.lang
Class Deprecation
- java.lang.Object
-
- io.microsphere.lang.Deprecation
-
- All Implemented Interfaces:
java.io.Serializable
@Immutable 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 classDeprecation.BuilderThe Builder class forDeprecationstatic classDeprecation.LevelDeprecation Level
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deprecation.Builderbuilder()Create a new instance ofDeprecation.Builderbooleanequals(java.lang.Object o)Deprecation.LevelgetLevel()java.lang.StringgetLink()java.lang.StringgetReason()java.lang.StringgetReplacement()VersiongetSince()inthashCode()static Deprecationof(java.lang.String since)static Deprecationof(java.lang.String since, java.lang.String replacement)static Deprecationof(java.lang.String since, java.lang.String replacement, java.lang.String reason)static Deprecationof(java.lang.String since, java.lang.String replacement, java.lang.String reason, java.lang.String link)static Deprecationof(java.lang.String since, java.lang.String replacement, java.lang.String reason, java.lang.String link, Deprecation.Level level)java.lang.StringtoString()
-
-
-
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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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)
-
-