Skip to content

io microsphere reflect ReflectiveDefinition

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

ReflectiveDefinition

Type: Class | Module: microsphere-java-core | Package: io.microsphere.reflect | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/reflect/ReflectiveDefinition.java

Overview

The abstract definition class for Java Reflection.

This class serves as a base for defining reflective constructs such as classes, methods, fields, etc., providing common metadata and functionality including:

- The version since which the construct was introduced
- Deprecation information (if applicable)
- Class name resolution capabilities

Example Usage

`// Example implementation: ClassDefinition extending ReflectiveDefinition
public class ClassDefinition extends ReflectiveDefinition {
    public ClassDefinition(@Nonnull String since, @Nonnull String className) {
        super(since, className);
    `

    public ClassDefinition(@Nonnull Version since, @Nonnull String className) {
        super(since, className);
    }

    public ClassDefinition(@Nonnull String since, @Nullable Deprecation deprecation, @Nonnull String className) {
        super(since, deprecation, className);
    }

    public ClassDefinition(@Nonnull Version since, @Nullable Deprecation deprecation, @Nonnull String className) {
        super(since, deprecation, className);
    }

    // Implementing abstract method

### Declaration

```java
public abstract class ReflectiveDefinition implements Serializable
```

**Author:** Mercy

## Version Information

- **Introduced in:** `1.0.0`
- **Current Project Version:** `0.1.10-SNAPSHOT`

## Version Compatibility

This component is tested and compatible with the following Java versions:

| Java Version | Status |
|:---:|:---:|
| Java 8 | ✅ Compatible |
| Java 11 | ✅ Compatible |
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |

## Examples

```java
// Example implementation: ClassDefinition extending ReflectiveDefinition
public class ClassDefinition extends ReflectiveDefinition {
    public ClassDefinition(@Nonnull String since, @Nonnull String className) {
        super(since, className);
    }

    public ClassDefinition(@Nonnull Version since, @Nonnull String className) {
        super(since, className);
    }

    public ClassDefinition(@Nonnull String since, @Nullable Deprecation deprecation, @Nonnull String className) {
        super(since, deprecation, className);
    }

    public ClassDefinition(@Nonnull Version since, @Nullable Deprecation deprecation, @Nonnull String className) {
        super(since, deprecation, className);
    }

    // Implementing abstract method
    @Override
    public boolean isPresent() {
        return getResolvedClass() != null;
    }
}
```

## Usage

### Maven Dependency

Add the following dependency to your `pom.xml`:

```xml

    io.github.microsphere-projects
    microsphere-java-core
    ${microsphere-java.version}

```

> **Tip:** Use the BOM (`microsphere-java-dependencies`) for consistent version management. See the [Getting Started](https://github.com/microsphere-projects/microsphere-java#getting-started) guide.

### Import

```java
import io.microsphere.reflect.ReflectiveDefinition;
```

## API Reference

### Public Methods

| Method | Description |
|--------|-------------|
| `getSince` |  |
| `getDeprecation` | Get the deprecation |
| `getClassName` | Get the name of class |
| `getResolvedClass` | Get the resolved class |
| `isDeprecated` | Whether the member is deprecated |

## See Also

- `ClassDefinition`
- `MemberDefinition`

---

*This documentation was auto-generated from the source code of [microsphere-java](https://github.com/microsphere-projects/microsphere-java).*

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally