Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:24:23+00:00 2026-05-26T05:24:23+00:00

Have annotated Java class with several methods: @CustomAnnotation public class MyService { public List<MyObject>

  • 0

Have annotated Java class with several methods:

@CustomAnnotation
public class MyService {

public List<MyObject> getMyObjects(){
...
}

public SomeObject getSomeObject(){
...
}

}

I should to log field values of MyObject and SomeObject instances.

aspectj part,where MyService object got:

public void logg2(JoinPoint jp) {
    Object target = jp.getTarget();

}

target is MyService class,that holds methods.

How to get values of instance fields for MyObject and SomeObject,that are returned from methods in MyService class in Runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:24:24+00:00Added an answer on May 26, 2026 at 5:24 am
    @Around(value = "traceReturnedObjectsFields()")
    public Object traceAnotherOne(ProceedingJoinPoint jp) throws Throwable {
        Object res = null;
        res = jp.proceed();
        if (res == null)
            return res;
        Class<?> c1 = res.getClass();
        Field[] fields = c1.getDeclaredFields();
        AccessibleObject.setAccessible(fields, true);
        for (Field field : fields) {
            if (!Modifier.isStatic(field.getModifiers())) {
                System.out.println(field + " = " + field.get(res));
            }
        }
        return res;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test class in java and there are several methods annotated by
I have a MyBean annotated @XmlRootElement public class MyBean ... Marshalling/Unmarshalling MyBean w/o problems,
In JPA the Entities are nice annotated Plain Old Java Objects. But I have
I have a service class implemented in Java 6 / Spring 3 that needs
I have a single java bean, which is already annotated for JPA, that I
I have a Java project I am building with Maven. I am now trying
I have a domain object annotated like this for hibernate support. @Entity @Table(name =
I have written a java annotation that looks like this: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) // can
I have a simple Class Hierarchy that I am trying to get to work
What I have is a set of Java classes (close to 25) representing message

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.