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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:41:16+00:00 2026-05-25T20:41:16+00:00

I’m trying to make a facade for a library I’m giving out. In my

  • 0

I’m trying to make a facade for a library I’m giving out. In my facade I use Guice to contruct the object graph. Deep in the object graph is a Proxy object, that has getURL/setURL methods.
In my facade, how do I get the Proxy instance used to create my root object? I want my facade to have url getter and setter.

I tried something like this:

public class SomeThingFacade() {

    private final SomeThing thing;
    private final HTTPProxy proxy;

    public SomeThingFacade() {
        MyModule module = new MyModule();
        Injector injector = Guice.createInjector(module);

        // this is the main class I'm making a facade for
        this.thing = injector.getInstance(SomeThing.class);

        // deep in the "thing" object graph is a Proxy implementation
        this.proxy = injector.getInstance(HTTPProxy.class);
    }


    public void setURL(URL url) {
        this.proxy.setURL(url);
    }
}

but the injector.getInstance created a new instance.

Binding in MyModule:

bind(Proxy.class).to(HTTPProxy.class).asEagerSingleton();

I had previously hardcoded the object graph in the facade constructor, but it got unwieldly with 30 objects.

Basically, I need to configure an instance deep in the object graph after creation, but I’m not sure how I get a hold of that instance.

  • 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-25T20:41:16+00:00Added an answer on May 25, 2026 at 8:41 pm

    This totally looks like a good serious question. However, I can’t figure out what’s being asked exactly.

    My answer, looking at the code and ignoring the fascaded object graph talk (so let me know if I misunderstood you completely), is:
    If thing‘s SomeThing depends somewhere on a deep internal proxy, the module should configure it to be bound to HTTPProxy for thing. The second getInstance does not affect the first. The only way you could somehow be doing something that makes proxy affect thing is if HTTPProxy were bound in(Singleton.class), then by calling methods on proxy that affect the members and behavior of HTTPProxy which would also be the same instance deep inside thing you might be doing what you’re looking for. I don’t see why you’d want to do it this way though. Consider instead writing a provider that configures HTTPProxy and/or making a special module just for the facade’s use.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.