Re: [DESIGN] Why is enum a class...

2013-07-24 Thread Daan Hoogland
;> > >> private static final long b = 1; > >>private static final long k = b * 1024; > >>private static final long m = k * 1024; > >>private static final long g = m * 1024; > >>private static final long t = g * 1024; > >> > >

Re: [DESIGN] Why is enum a class...

2013-07-24 Thread John Burwell
lementation of behavior on values. In addition to simplifying code, it >> greatly increases cohesion by defining all of the uses of the value in one >> place and using the compiler to validate coverage. Finally, it makes unit >> testing of this conditional functionality much more st

Re: [DESIGN] Why is enum a class...

2013-07-24 Thread Daan Hoogland
actMethodError(); > } > public long toTeraByte(long s) { > throw new AbstractMethodError(); > } > } > > This may explain some of my views on java enum. It does have lots of > advantages like compiler check, native == operator. Just like > Alex mentioned,

RE: [DESIGN] Why is enum a class...

2013-07-23 Thread Frank Zhang
stick to enum. But for types that plugin may extend, we'd better to use own defined classes. From: John Burwell [mailto:jburw...@basho.com] Sent: Tuesday, July 23, 2013 6:25 AM To: dev@cloudstack.apache.org Subject: Re: [DESIGN] Why is enum a class... All, +1 to Alex's design suggest

RE: [DESIGN] Why is enum a class...

2013-07-23 Thread Frank Zhang
Emm, it's not intended as a pun, but now I learned this pun :) > -Original Message- > From: Mike Tutkowski [mailto:mike.tutkow...@solidfire.com] > Sent: Tuesday, July 23, 2013 8:43 AM > To: dev@cloudstack.apache.org > Subject: Re: [DESIGN] Why is enum a class... &g

Re: [DESIGN] Why is enum a class...

2013-07-23 Thread Mike Tutkowski
Type, it simply > does: > > class MagicVmManagerImpl { > public static final VmType type = new VmType("MagicVm"); > } > > > > -Original Message- > > From: Alex Huang [mailto:alex.hu...@citrix.com] > > Sent: Monday, July 22, 2013 5:23

Re: [DESIGN] Why is enum a class...

2013-07-23 Thread John Burwell
s >> regard. Another way would be to use Spring to gather them and inject them >> into a holding class. >> >> --Alex >> >>> -Original Message- >>> From: Frank Zhang [mailto:frank.zh...@citrix.com] >>> Sent: Monday, July 22, 2013 5:45 PM

Re: [DESIGN] Why is enum a class...

2013-07-23 Thread Daan Hoogland
ather them and inject them > into a holding class. > > --Alex > > > -Original Message- > > From: Frank Zhang [mailto:frank.zh...@citrix.com] > > Sent: Monday, July 22, 2013 5:45 PM > > To: dev@cloudstack.apache.org > > Subject: RE: [DESIGN] Why is

RE: [DESIGN] Why is enum a class...

2013-07-22 Thread Alex Huang
uly 22, 2013 5:45 PM > To: dev@cloudstack.apache.org > Subject: RE: [DESIGN] Why is enum a class... > > Frankly speaking, if we are going to change enum, I would suggest not using > enmu anymore, instead, defining our own class like: > > public class VmType

RE: [DESIGN] Why is enum a class...

2013-07-22 Thread Frank Zhang
g [mailto:alex.hu...@citrix.com] > Sent: Monday, July 22, 2013 5:23 PM > To: dev@cloudstack.apache.org > Subject: RE: [DESIGN] Why is enum a class... > > BTW, this code already shows a bug that stems from the static method usage. > It says ElasticIpVm is not a system vm (which I

RE: [DESIGN] Why is enum a class...

2013-07-22 Thread Alex Huang
BTW, this code already shows a bug that stems from the static method usage. It says ElasticIpVm is not a system vm (which I don't believe is true). Probably because whoever added elastic ip vm didn't see the static method and so didn't add the vm into the method. --Alex > -Original Messa