Reflection Utils

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Reflection Utils

Timo
Hello everyone,

I was wondering if there is a utility somewhere in Commons with which
I can get all fields of a class with a given Annotation. Something
similar to Spring's (internal) ReflectionUtils.doWithFields(). I
couldn't find anything in Lang or BeanUtils. Anywhere else I should
take a look?

Thanks
Timo

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Reflection Utils

garydgregory
Those are the first places I would look.

Gary

On Thu, May 28, 2015 at 1:55 PM, Timo <[hidden email]> wrote:

> Hello everyone,
>
> I was wondering if there is a utility somewhere in Commons with which
> I can get all fields of a class with a given Annotation. Something
> similar to Spring's (internal) ReflectionUtils.doWithFields(). I
> couldn't find anything in Lang or BeanUtils. Anywhere else I should
> take a look?
>
> Thanks
> Timo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
E-Mail: [hidden email] | [hidden email]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Reply | Threaded
Open this post in threaded view
|

Re: Reflection Utils

Steve Siebert
In reply to this post by Timo
also take a look at the weaver project...
https://commons.apache.org/proper/commons-weaver/



On Thu, May 28, 2015 at 4:55 PM, Timo <[hidden email]> wrote:

> Hello everyone,
>
> I was wondering if there is a utility somewhere in Commons with which
> I can get all fields of a class with a given Annotation. Something
> similar to Spring's (internal) ReflectionUtils.doWithFields(). I
> couldn't find anything in Lang or BeanUtils. Anywhere else I should
> take a look?
>
> Thanks
> Timo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Reflection Utils

Timo-2
Thank you for the suggestions!

Commons Weaver kind of has a way to do what I want, but it's... ehm...
woven with the rest of the project (e.g. WeavableField). So I ended up
implementing my own method and then using Lang's FieldUtils to read
and write the fields.


2015-05-28 23:20 GMT+02:00 Steven Siebert <[hidden email]>:

> also take a look at the weaver project...
> https://commons.apache.org/proper/commons-weaver/
>
>
>
> On Thu, May 28, 2015 at 4:55 PM, Timo <[hidden email]> wrote:
>
>> Hello everyone,
>>
>> I was wondering if there is a utility somewhere in Commons with which
>> I can get all fields of a class with a given Annotation. Something
>> similar to Spring's (internal) ReflectionUtils.doWithFields(). I
>> couldn't find anything in Lang or BeanUtils. Anywhere else I should
>> take a look?
>>
>> Thanks
>> Timo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Reflection Utils

Matt Benson-2
The recent release of Lang does provide a method to get fields with a
particular annotation.

Matt
On May 30, 2015 7:27 AM, "Timo" <[hidden email]> wrote:

> Thank you for the suggestions!
>
> Commons Weaver kind of has a way to do what I want, but it's... ehm...
> woven with the rest of the project (e.g. WeavableField). So I ended up
> implementing my own method and then using Lang's FieldUtils to read
> and write the fields.
>
>
> 2015-05-28 23:20 GMT+02:00 Steven Siebert <[hidden email]>:
> > also take a look at the weaver project...
> > https://commons.apache.org/proper/commons-weaver/
> >
> >
> >
> > On Thu, May 28, 2015 at 4:55 PM, Timo <[hidden email]> wrote:
> >
> >> Hello everyone,
> >>
> >> I was wondering if there is a utility somewhere in Commons with which
> >> I can get all fields of a class with a given Annotation. Something
> >> similar to Spring's (internal) ReflectionUtils.doWithFields(). I
> >> couldn't find anything in Lang or BeanUtils. Anywhere else I should
> >> take a look?
> >>
> >> Thanks
> >> Timo
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Reflection Utils

Timo-2
Thank you very much for the tip! I just realized that I was using the
rather old commons-lang version 3.0. After updating to 3.4 I am now
able to get rid of my own implementation.

2015-05-30 16:33 GMT+02:00 Matt Benson <[hidden email]>:

> The recent release of Lang does provide a method to get fields with a
> particular annotation.
>
> Matt
> On May 30, 2015 7:27 AM, "Timo" <[hidden email]> wrote:
>
>> Thank you for the suggestions!
>>
>> Commons Weaver kind of has a way to do what I want, but it's... ehm...
>> woven with the rest of the project (e.g. WeavableField). So I ended up
>> implementing my own method and then using Lang's FieldUtils to read
>> and write the fields.
>>
>>
>> 2015-05-28 23:20 GMT+02:00 Steven Siebert <[hidden email]>:
>> > also take a look at the weaver project...
>> > https://commons.apache.org/proper/commons-weaver/
>> >
>> >
>> >
>> > On Thu, May 28, 2015 at 4:55 PM, Timo <[hidden email]> wrote:
>> >
>> >> Hello everyone,
>> >>
>> >> I was wondering if there is a utility somewhere in Commons with which
>> >> I can get all fields of a class with a given Annotation. Something
>> >> similar to Spring's (internal) ReflectionUtils.doWithFields(). I
>> >> couldn't find anything in Lang or BeanUtils. Anywhere else I should
>> >> take a look?
>> >>
>> >> Thanks
>> >> Timo
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [hidden email]
>> >> For additional commands, e-mail: [hidden email]
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]