Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Enumset

Thread Tools


Lasse Reichstein Nielsen
Posts: n/a
Roedy Green <(E-Mail Removed)> writes:

> The other option is to provide a classic bitmap interface, rather than
> an EnumSet for my Windows attribute get/setter.

Another option is to encapsulate the data and just provide methods, e.g.,
boolean isArchived()
boolean isReadOnly()
boolean isDirectory()
boolean isHidden()
The fact that these are in some ways stored in a number is an implementation
detail that need not be exposed.

If you really want an enum representing capabilities, you can make
one that works on these:
enum FileCapability {
public boolean isAllowed(RGFile file) {
return file.isAllowed();
// ...
public abstract boolean isAllowed(RGFile file);

You can the build an EnumSet only when you need it for something, using
EnumSet<FileCapability> getCapabilties();
You can cache it in a transient field to avoid recreating.

Lasse Reichstein Nielsen - Removed)
DHTML Death Colors: <URL:>
'Faith without judgement merely degrades the spirit divine.'
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subclassing EnumSet to add an interface? Eric Smith Java 19 05-17-2007 02:42 AM
EnumSet + contains: strange behavior Ulrich Scholz Java 10 06-04-2006 10:56 AM
EnumSet Generics puzzle Roedy Green Java 11 08-22-2005 02:27 PM
EnumSet--what the...? George Cherry Java 0 07-09-2005 08:05 PM
EnumSet, what the ? Roedy Green Java 6 07-09-2005 07:18 PM