Skip to content

CKATEPTb-commons/Reflect

Repository files navigation

Reflect


Reflect is a lightweight Java library designed to simplify and enhance the use of reflection. It provides a fluent and intuitive API for accessing classes, methods, fields, constructors, and annotations.

License Discord Download


Versioning

We use Semantic Versioning 2.0.0 to manage our releases.

Features

  • Easy Class and Object Reflection: Access class and object properties effortlessly.
  • Method and Field Access: Invoke methods and manipulate fields dynamically.
  • Constructor Handling: Create new instances using constructors with or without parameters.
  • Annotation Inspection: Inspect methods, fields, and constructors for specific annotations.
  • Caching: Efficient reflection with caching of class information.

Installation

To use the Reflect library, include it in your project as a dependency.

repositories {
    maven("https://repo.jyraf.com/repository/maven-snapshots/")
}

dependencies {
    implementation("dev.ckateptb:Reflect:<version>")
}

Usage

import dev.ckateptb.reflection.Reflect;

// Reflecting on an object
MyClass instance = new MyClass();
Reflect<MyClass> reflect = Reflect.on(instance);

// Reflection on a class
Reflect<MyClass> reflect = Reflect.on(MyClass.class);

// Accessing fields
String fieldValue = reflect.field("fieldName").get(); // or set

// Invoking methods
reflect.method("methodName").call();

// Creating new instances
MyClass newInstance = reflect.constructor().newInstance().get();

License

This project is licensed under the GPL-3.0 license.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Acknowledgements

Special thanks to the developers and contributors of the open-source Java reflection libraries that inspired the creation of Reflect.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages