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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:11:04+00:00 2026-06-05T02:11:04+00:00

I am using TDD, and have a very typical coding pattern, using Eclipse to

  • 0

I am using TDD, and have a very typical coding pattern, using Eclipse to autocreate methods and fields as I code the unit test. For example:

  1. type name of method that doesn’t exist, e.g:

    myObj.setValue(someValue);

  2. Click on the little red error mark in the IDE to create the “setValue” method.

  3. Type inside of setValue method:

    public void setValue(String value) {
    this.value = value;
    }

  4. Click the red error mark to auto-create a private field (called “value in this case”);

So at this point, I would like Eclipse to auto-create the getter method, without having to do it using the source -> generate getters and setters menu.

I saw this question: How do you force Eclipse to prompt you to create a getter and setter when it doesn’t do it automatically which seems to imply that Eclipse does this, but I couldn’t find where to configure that.

Is there some way to configure Eclipse to automatically add setter/getters when adding new private variable?

UPDATE:
To clarify further, I’m looking for something like I saw in the Spring Roo documentation. If you take a look at the “How It Works” section, it describes how the framework automatically adds additional methods to your class, whenever you add a private variable. (My preference is not to run another process like that, however, and also not to get all the cruft that it seems to add). I was hoping Eclipse had something similar.

  • 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-05T02:11:06+00:00Added an answer on June 5, 2026 at 2:11 am

    When you move your mouse above the name of the variable, you can select “Create getter and setter for varname” in the popup menu.

    Or you can create yourself a shortcut to do so. Preferences -> General -> Keys. In the search box you enter “getter” and then you´ll find it.

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

Sidebar

Related Questions

I have been doing TDD and was using it more as unit testing than
I am doing a TDD project using EF. I want to unit test the
I am very new to test-driven development (TDD), not yet started using it. But
i have been using NHibernate in TDD environment and found it very helpful to
Suppose I'm following TDD and using VS/ReSharper. I start out writing a test like
I have been learning about TDD (using JUnit) and I have a doubt about
I have a unit test for an Http handler. In it I create a
I am 'relatively new' to unit-testing and TDD. Only more recently have I completed
I have been trying to get the hang of TDD and unit testing (in
TDD is supposed to have 100% code coverage. Does this mean one is supposed

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.