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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:30:32+00:00 2026-06-06T03:30:32+00:00

I have a custom object ExportType : public class ExportType{ protected String name; protected

  • 0

I have a custom object ExportType:

public class ExportType{

    protected String name;      
    protected FetchingStrategy fetchStg;
    protected ExportStrategy exportStg;

    public ExportType(String name, FetchingStrategy fetch, ExportStrategy export) {
            this.name = name;
        this.fetchStg = fetch;
        this.exportStg = export;
    }

    // ...
}

In my application I have to create a list of Export types that have different FetchingStrategy and ExportStrategy. New Export types can be created in the future, by implementing new FetchingStrategy and ExportStrategy, so I’d like to design my application to be as flexible as possible.

Is there a design pattern I should apply to obtain what I need?
Create a different TypeFactory for each ExportType particular instance is the correct approach?

UPDATE

I try to summarize my problem: I’m working on a web application for the export of data from a db. I have several ways to extract data from DB (ExportTypes), these types are obtained by different combinations of FetchingStrategy and ExportStrategy. Now I need to create a list of these “combinations” to recall them when necessary. I could create constants like:

public static final ExportType TYPE_1 = new ExportType(..., ...);

but I’d like to implement it in a way so I can add in the future new combinations / types.

  • 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-06T03:30:33+00:00Added an answer on June 6, 2026 at 3:30 am

    To be as flexible as possible, don’t use concrete class. Use Interface.

    I would recommend Spring IoC to inject your different implementation of FetchingStrategy and ExportStrategy inside your ExportType.

    public class SomeExportType implements IExportType{
    
        protected String name;
        @Autowired(@Qualifier="SomeFetchingStrategy")      
        protected IFetchingStrategy fetchStg;
        @Autowired(@Qualifier="SomeExportStrategy")      
        protected IExportStrategy exportStg;
    
    
    
        // ...
    }
    
    public interface IExportType {
         public void doSomething();  //
    }
    
    public interface IFetchingStrategy {
       public void fetch();
    }
    
    public class SomeFetchingStrategy implements IFetchingStrategy {
    
        public void fetch() {
            //implement this strategy
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom object whose structure is public String name; public int type;
In my Site.Master.vb file, I have a custom User object: Public Class Site Inherits
So let's say I have a custom object in java: public class TestObject {
I have a custom class declared as follows (in vb.net) <Serializable()> Public Class NumInfo
I have a custom object like: #import <Foundation/Foundation.h> @interface Store : NSObject{ NSString *name;
Suppose I have a custom object set up in a class similar to this.
I have a custom Javascript object that has a few string and float members.
I have created a custom object Assure__c and a custom apex class insEnfant like
I have a custom class object in PHP named product : final class product
In my program I have a custom view object. Inside the view class is

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.