wnameless / factor-extractor

Extract the return values from any specified annotated methods of Java beans into a Java Map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maven Central

factor-extractor

Extract the return values from any specified annotated methods of Java beans into a Java Map.

Installation with Maven:

<dependency>
  <groupId>com.github.wnameless</groupId>
  <artifactId>factor-extractor</artifactId>
  <version>${latest.version}</version>
</dependency>

An annotated class

public class FactorBean {
  @Factor("id")
  public String id() {
    return "id";
  }

  @Factor("num")
  public int num() {
    return 123;
  }
}

FactorExtrator example:

Map<String, Object> factors = FactorExtractor.extract(new FactorBean());
System.out.println(factors.get("id"));
// Output: id
System.out.println(factors.get("num"));
// Output: 123

About

Extract the return values from any specified annotated methods of Java beans into a Java Map


Languages

Language:Java 100.0%