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

  • SEARCH
  • Home
  • 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 9170945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:05:47+00:00 2026-06-17T16:05:47+00:00

I am currently working on a project that uses a third party library to

  • 0

I am currently working on a project that uses a third party library to manage hardware.

I wish to create a substitute library that presents the same interface, but instead of controlling actual hardware just presents a nice fake GUI. Preferably this can be done just by replacing the jar.

The problem is that all of the third party code is in the namespace edu.edu.wpi.first.wpilibj, and of course the namespace for my library is going to be very different.

Is there any way of easily switching implementations between the two libraries providing the same interface in java?

  • 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-17T16:05:47+00:00Added an answer on June 17, 2026 at 4:05 pm

    Yes, there are design patterns to do that.

    You can look into Strategy pattern.

    Even better you can look into Dependency injection.

    You can use Google Guice as container and based on your configuration, at runtime, your implementation can switch between using N libraries.

    At the end of the day, you need to wrap those libraries around some abstraction.

    here is an example:

    interface ISomeOperation{
        void process();
    }
    
    class ThatUsesTheWPILIBJ implements ISomeOperation{
    
        void process(){
          //use library here
        }
    
    }
    
    class ThatUsesYourMock implements ISomeOperation{
        void process(){
          //use your mock here
        }
    }
    
    
    public YourUIClass{
    
        private ISomeOperation _operatingClass;
    
    
        public YourUIClass(ISomeOperation  operatingClass){
    
            _operatingClass = operatingClass;
        }
    
        public void render(){
            _operatingClass.process();
        }
    }
    

    Now all you need to do is wiring. Look at google guice configuraion.

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

Sidebar

Related Questions

Im currently working on a c# project that uses another .net library. This library
I am currently working on a project that uses a Google Earth API library
I'm currently working on a JavaScript project that uses the HTML5 canvas as a
I'm working on an embedded project that currently uses C in Linux and uClibc.
I am currently working on a project that uses CoreData and relations are using
I am currently working on a project that uses the Silverlight 3 SDK and
I am currently working on a project that uses JPA (Toplink, currently) for its
I'm currently working on an upgrade to a project that extensively uses COM /
I am currently working on a project that uses Manager.createPlayer(InputStream is, String mimeType) to
we are currently working on a rails project that uses i18n and we have

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.