Package io.microsphere.reflect
Class ClassDefinition
- java.lang.Object
-
- io.microsphere.reflect.ReflectiveDefinition
-
- io.microsphere.reflect.ClassDefinition
-
- All Implemented Interfaces:
java.io.Serializable
@Immutable public final class ClassDefinition extends ReflectiveDefinition
A concrete implementation ofReflectiveDefinition
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
-
-
Field Summary
-
Fields inherited from class io.microsphere.reflect.ReflectiveDefinition
className, deprecation, since
-
-
Constructor Summary
Constructors Constructor Description ClassDefinition(Version since, Deprecation deprecation, java.lang.String className)
ClassDefinition(Version since, java.lang.String className)
ClassDefinition(java.lang.String since, Deprecation deprecation, java.lang.String className)
ClassDefinition(java.lang.String since, java.lang.String className)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isPresent()
Whether the member is present-
Methods inherited from class io.microsphere.reflect.ReflectiveDefinition
equals, getClassName, getDeprecation, getResolvedClass, getSince, hashCode, isDeprecated, toString
-
-
-
-
Constructor Detail
-
ClassDefinition
public ClassDefinition(@Nonnull java.lang.String since, @Nonnull java.lang.String className)
- Parameters:
since
- the 'since' versionclassName
- the name of class
-
ClassDefinition
public ClassDefinition(@Nonnull java.lang.String since, @Nullable Deprecation deprecation, @Nonnull java.lang.String className)
- Parameters:
since
- the 'since' versiondeprecation
- the deprecationclassName
- the name of class
-
ClassDefinition
public ClassDefinition(@Nonnull Version since, @Nonnull java.lang.String className)
- Parameters:
since
- the 'since' versionclassName
- the name of class
-
ClassDefinition
public ClassDefinition(@Nonnull Version since, @Nullable Deprecation deprecation, @Nonnull java.lang.String className)
- Parameters:
since
- the 'since' versiondeprecation
- the deprecationclassName
- the name of class
-
-
Method Detail
-
isPresent
public final boolean isPresent()
Description copied from class:ReflectiveDefinition
Whether the member is present- Specified by:
isPresent
in classReflectiveDefinition
- Returns:
true
if present
-
-