Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38921

Re: Java variable access

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Java variable access
Date Tue, 16 Apr 2019 16:46:22 -0400
Organization A noiseless patient Spider
Lines 29
Message-ID <q95ev0$3s8$1@dont-email.me> (permalink)
References <109a7224-f392-46c3-bf56-7d8bf2bfb4bf@googlegroups.com> <13t97bxk9km7n$.ooqi8n8ocm7f$.dlg@40tude.net> <q8rfas$iti$1@gioia.aioe.org> <13ak6boysjgrh$.1h4x7tkjgs00q$.dlg@40tude.net> <q8tod9$kb9$1@gioia.aioe.org> <7ivllvz2ukra$.qlcrlm81adao.dlg@40tude.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Tue, 16 Apr 2019 20:46:24 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="47dea73e873ec118b4a2fe7e5e88069d"; logging-data="3976"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Cwdyk8xqVCpOAY7Bu/RMu"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
Cancel-Lock sha1:Th7J0xsBG7HEzn2003cCvJFSNpQ=
In-Reply-To <7ivllvz2ukra$.qlcrlm81adao.dlg@40tude.net>
Content-Language en-US
Xref csiph.com comp.lang.java.programmer:38921

Show key headers only | View raw


On 4/16/2019 4:08 PM, Joerg Meier wrote:
> On Sat, 13 Apr 2019 18:38:35 -0400, Arne Vajhøj wrote:
> 
>> The Java way is to write the getters and setters.
> 
> If you live in 1998, sure. In this day and age, if you manually write
> getters and setters, you are doing things wrong (tm). Either let your IDE
> or something like Lombok do it.

     What is wrong (tm) with

	public void setUnitPrice(double unitPrice) {
	    if (unitPrice <= 0 || !Double.isFinite(unitPrice)) {
	        throw new IllegalArgumentException(
	            "bad price: " + unitPrice);
	    }
	    if (unitPrice != this.unitPrice) {
	        this.unitPrice = unitPrice;
	        fireChangeEvent(this, PRICE_CHANGED);
	    }
	}

?  Is "something like Lombok" smart enough to auto-generate such code?
Smart enough to auto-generate without being prompted by annotations
bulkier than the code itself?

-- 
esosman@comcast-dot-net.invalid
Six hundred forty-five days to go.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 06:57 -0700
  Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 10:06 -0400
    Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 07:23 -0700
      Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 10:35 -0400
      Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 10:58 -0400
        Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 08:31 -0700
          Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 14:40 -0400
        Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 12:31 -0400
  Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 10:56 -0400
  Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-12 23:11 +0200
    Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 21:51 -0400
      Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-13 21:59 +0200
        Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-13 18:38 -0400
          Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-16 22:08 +0200
            Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-16 16:46 -0400
              Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-16 23:01 +0200
              Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-17 06:42 -0700
                Re: Java variable access Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-04-17 21:35 +0200
                Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-17 14:05 -0700
                Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-19 10:40 +0200
                Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-19 17:20 -0400

csiph-web