Hamilton Verissimo de Oliveira (Engenharia - SPO) wrote:

-----Mensagem original-----
De: Leo Sutic [mailto:[EMAIL PROTECTED]



Well, *I* think this one is a winner. (Whether it is realized via
XStream
or attributes is not that relevant.)


Which could be rewritten as


<snip/>


Or addressed with this:


public class Radar { private int minRange = Integer.MIN_VALUE;

private int maxRange = Integer.MAX_VALUE;

       public void setMaxRange (int _maxRange) {
           if ( _maxRange < minRange ) throw IllegalArgumentException
           maxRange = _maxRange;
       }

       public void setMinRange (int _minRange) {
           if ( _minRange > maxRange ) throw IllegalArgumentException
           minRange = _minRange;
       }
   }
}

Which does not address the issue of letting tools know what are valid
constraints.  It does keep the Radar object in a valid state, but it
does not tell the tool that there is a relationship between the two
methods.

Either way, there are a dozen different ways to configure things, each
of them will have merit one way or another.  And each of them will have
drawbacks one way or another.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to