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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:09:07+00:00 2026-05-17T19:09:07+00:00

I have a class which is called TestPlan (to put it simple, let’s assume

  • 0

I have a class which is called TestPlan (to put it simple, let’s assume that it’s a usual java bean).

I need to store TestPlan instances in xml-files (1 instance per file). The most appropriate way to do it which I can see is using another class which should do only xml-related work.

It’ll have methods like:

public TestPlan parseTestPlanXml(InputStream xmlFile) {
    TestPlan testPlan = new TestPlan();
    //parse xmlFile and set testPlan fields via setters
    return testPlan;
}

public OutputStream writeTestPlanXml(TestPlan testPlan) {
    //the actual implementation just copies the original xmlFile, 
    //makes necessary modifications 
    //and writes it to ByteArrayOutputStream
    ...
}

Which name would you suggest for this class? (btw, if you can also suggest better names for these 2 methods then don’t hesitate to do that).

Thanks!

  • 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-17T19:09:08+00:00Added an answer on May 17, 2026 at 7:09 pm

    If the class is only responsible for loading/saving TestPlan objects, and it has no other similar methods to load/save objects of other classes, it could be

    class TestPlanXmlMarshaller {
        public TestPlan load(InputStream xmlFile) {
            ...
        }
    
        public OutputStream save(TestPlan testPlan) {
            ...
        }
    }
    

    This way, in accordance with the DRY principle, TestPlan and XML are not repeated unnecessarily in the method names.

    However, if the class is dealing with multiple types, the load methods need to have distinct names since a method can’t be overloaded on the return type only. save would be fine to overload with different type parameters, but for consistency the same naming convention should be used for both.

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

Sidebar

Related Questions

Let's say I have a class that has a member called data which is
Let's say you have a class called Customer, which contains the following fields: UserName
I have a class which has a method that is called by the main
I have a class called EventConsumer which defines an event EventConsumed and a method
Say I have a class called PermissionManager which should only exist once for my
I have a CSS class called grid which I place on my tables. I
I have a class named Page with a private property currently called _pageData which
I have a class called User with static function loginRequired(), which returns false if
I have an abstract base class called Shape from which both Circle and Rectangle
I have a class which is called a number of times. When the application

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.