Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manoelcampos/java-reflection-example
A simple Java Reflection example
https://github.com/manoelcampos/java-reflection-example
demo example java java-17 reflection sample
Last synced: 11 days ago
JSON representation
A simple Java Reflection example
- Host: GitHub
- URL: https://github.com/manoelcampos/java-reflection-example
- Owner: manoelcampos
- Created: 2023-08-24T15:06:01.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-24T18:11:33.000Z (about 1 year ago)
- Last Synced: 2023-08-24T19:39:56.756Z (about 1 year ago)
- Topics: demo, example, java, java-17, reflection, sample
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java Reflection Example [![build](https://github.com/manoelcampos/java-reflection-example/actions/workflows/build.yml/badge.svg)](https://github.com/manoelcampos/java-reflection-example/actions/workflows/build.yml)
Shows how to dynamically discover object fields, values, methods and constructors.
Below is the result of running the project's [Main.java](src/main/java/io/github/manoelcampos/reflection/Main.java) class,
which discovers information about any object you provide.
The sample below prints data about a `Customer` object.```log
Customer Fields
id: null
name: Manoel
phone: 99999-9999
city: Palmas - TO
gender: MCustomer Constructors
Customer()
Customer(String, char, String, City)Customer Methods
String getName()
Customer of(Customer)
void setName(String)
Long getId()
void setGender(char)
String getPhone()
void setPhone(String)
City getCity()
void setCity(City)
char getGender()
boolean isMale()
boolean isFemale()
void setId(Long)
```## Requirements
The project was built using JDK 17.
## Running
Open the project on you IDE and run the [Main.java](src/main/java/io/github/manoelcampos/reflection/Main.java) class.