[libvirt] [libvirt-java] [PATCH 40/65] Add constants for enum virDomainEventID

Claudio Bley cbley at av-test.de
Tue Mar 4 13:29:08 UTC 2014


At Mon, 03 Mar 2014 13:06:50 -0700,
Eric Blake wrote:
> 
> [1  <text/plain; UTF-8 (quoted-printable)>]
> On 02/13/2014 08:22 AM, Claudio Bley wrote:
> > Note: these are only used internally.
> > 
> > Signed-off-by: Claudio Bley <cbley at av-test.de>
> > ---
> 
> > +        static final int CONTROL_ERROR = 7;
> > +        static final int BLOCK_JOB = 8;
> > +        static final int DISK_CHANGE = 9;
> > +        static final int TRAY_CHANGE = 10;
> > +        static final int PMWAKEUP = 11;
> > +        static final int PMSUSPEND = 12;
> 
> Up to here, I can understand.
> 
> > +        static final int LAST = 13;
> 
> But you probably do NOT want this value, as we explicitly document that
> our _LAST C enums are not constant (we reserve the right to add more
> events), but merely aids for compilation to ensure that all cases are
> covered compared to the current state of the libvirt.h header.

Trust me, I want this constant. ;-)

Note, that all those constants are private.

This constant is used in patch #41 to define the length of an array:

+    // registered event listeners by DomainEventID
+    private Map<EventListener, Integer>[] eventListeners = makeHashMapArray(DomainEventID.LAST);

Claudio




More information about the libvir-list mailing list