Thread: A type-safe, concise wrapper for Java Reflection

Results 1 to 5 of 5
  1. #1 A type-safe, concise wrapper for Java Reflection 
    Registered Member
    Join Date
    Dec 2016
    Posts
    6
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Hey guys

    concise-reflector
    https://github.com/silk8192/concise-reflector

    A concise and easy-to-use wrapper for the Java Reflection API (java.lang.reflect) that allows for reflection operations in a very non-verbose manner. It also includes a class file manager that allows for you to quickly load and manage Class files from a jar or a directory. Open source under the MIT license.

    Examples:

    Code:
    import static com.github.silk8192.reflector.Reflector.*;
    
    ClassFileManager cfm = new ClassFileManager(classPath);
    
    //Creation
    String str = forClass(String.class).create("Hello, World!").get();
    
    //Calling a method
    forClass(String.class).create("Hello, World!").invoke("toString");
    
    //Setting a field
    //Person class
    String firstName = forClass(cfm.getClass("foo.Person")).create("Foo", "Bar").get("firstName");
    
    //Setting a field
    forClass(cfm.getClass("foo.Person")).create("Foo", "Bar").set("firstName", "Bar2");
    
    //Using the class file manager:
    
    //For a regular directory
    Path classPath = Paths.get("foo\\bar");
    ClassFileManager cfm = new ClassFileManager(classPath);
    
    //For a .jar
    ClassFileManager cfm = new ClassFileManager(Paths.get("foo\\bar.jar").toFile());
    
    //Accessing files
    cfm.getClass("foo.Bar");
    Dependencies:
    SLF4j Logging
    Commons-io
    Reply With Quote  
     

  2. Thankful user:

    Community VeteranSub

  3. #2  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    I'm guessing you're the author. I've added some functionality and created a pull request. Maybe you could review it, and if you like it, pull it! I even wrote a test for it.
    .
    Reply With Quote  
     

  4. Thankful user:

    Community VeteranSub

  5. #3  
    sυввч

    Sub's Avatar
    Join Date
    Aug 2007
    Age
    24
    Posts
    4,352
    Thanks given
    1,205
    Thanks received
    359
    Rep Power
    2845
    Very cool, good job.
    Reply With Quote  
     

  6. #4  
    Registered Member
    Join Date
    Nov 2016
    Posts
    4
    Thanks given
    0
    Thanks received
    2
    Rep Power
    0
    Reply With Quote  
     

  7. #5  
    Registered Member
    Join Date
    Dec 2016
    Posts
    6
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by funkE View Post
    I'm guessing you're the author. I've added some functionality and created a pull request. Maybe you could review it, and if you like it, pull it! I even wrote a test for it.
    Thank you for your contribution. I've merged the request.

    Quote Originally Posted by Sub View Post
    Very cool, good job.
    Thank you! Here is the downloads page if you wish to use it in a project. It's under the MIT license. I do think that there are improvements that can be made, especially when dealing with corner cases. I'll have to investigate them soon.

    Quote Originally Posted by Dx2 pw reset View Post
    Unfortunately that library hasn't been updated in years.
    In regards to the feature set, I believe that this library delivers all functionality in a less verbose manner while being easier to use.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Tons of mime types in the format needed for Java's native mime map
    By Mister Maggot in forum Application Development
    Replies: 3
    Last Post: 06-29-2012, 09:40 PM
  2. appeal for java (jadz core)
    By Enjoi in forum Forum Related Help
    Replies: 5
    Last Post: 06-14-2009, 05:50 AM
  3. Appeal for: Java`
    By Riedell in forum Forum Related Help
    Replies: 2
    Last Post: 05-07-2009, 10:32 PM
  4. Replies: 0
    Last Post: 01-04-2009, 02:26 PM
  5. Replies: 0
    Last Post: 01-04-2009, 01:22 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •