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 8218005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:38:26+00:00 2026-06-07T12:38:26+00:00

I have a class X which has say do method. I have another two

  • 0

I have a class X which has say do method.

I have another two classes A & B in which object of X is created.

Is there any way by which I can find out whether x’s do() is getting called by A or B.

I do not want to use parameter in do() method. Anything from call trace or something?

I am using struts2, Spring. So any help from frameworks???

I want to implement some logic in do() based on whether its called from A or B.

  • 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-06-07T12:38:28+00:00Added an answer on June 7, 2026 at 12:38 pm

    I understand this looks wired but existing logic will can be quickly tweeted to work for this.

    The scenario is,

    I have two actions A & B which calls the service X.

    X is intercepted by Spring AOP to add filters and passed to DAO’s.

    If A calls X then show all data i.e do not apply filter, if B calls X then show data only of logged in user.

    X is already intercepted for adding some other filters, so it will be easy to add one more filter. Also this filter is present centrally so all A’s or B’s call X and thus X will do the work accordingly.

    I found much better way here, have a instance variable inside X and A’s instance of X will have value ‘a’ and so on.

    So now I will be able to distinguish between A’s call of X and B’s call of X.

    Does it make sense?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class which has two HashSet<String> collections as private members. Other classes
I have a class, lets say CAppPath which has a static method: public: static
Say I have a class Customer which has a property FirstName . Then I
Let's say we have a class foo which has a private instance variable bar
Let's say I have a Size class which has height and width properties (in
Let's say I have an class called Star which has an attribute color .
I have a public class which has the following method and instance variable: public
Let's say I have a class which has a property hiding it's base property
So, I have a base class which has a private locking object like so:
I have created two classes, class A that uses a Linked List and class

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.