enums

Are there plans for ImmutableEnumSet in Java 7?

I want to have all the efficiencies of EnumSet and pass it around without worrying that somebody would modify it. ...

Control sort order of Hibernate EnumType.STRING properties

Currently, my project uses @Enumerated(EnumType.ORDINAL), so when I sort by this column, it is ordering based on the order in the enum, which works fine. But I need to add some additional values to the enum, which need to be inserted at different locations in the list of enum values and can't be just added to the bottom to maintain the c...

How to handle Enum with Generics in JAXB?

JAXB runtime is failing to create JAXBContext for a Class whose member variable is defined as @XmlElement(name = "EnumeraatioArvo") private Enum<?> eenum; How to handle such scenario in JAXB? ...

Why is myEnum.ONE not equal to myEnum.ONE.toString() ?

I've got the following enum: public enum myEnum { ONE("ONE"), TWO("TWO"); private String name; private myEnum(String name) { this.name = name; } @Override public String toString() { return name; } }; My question is why does the following evaluate to false? I suspect it has something to do...

What to use besides enum for c#

So currently have an enumeration used on the status of an application. However, something feels off when using it against the ui. To many conversions between integer and string when populating drop downs. I could use an extension method or the type converter and continue to use the enum which will be helpful if an enum has multiple words...

Importing enums in GWT

I have following code import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.LayoutPanel; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.user.cl...

Cycling through enums in MySQL

Hey guys, I have a table in my database with an enum column with 3 values: ('Offline', 'Online', 'Expired') I want to be able to do an update that cycles the value of the this column to the next value in the list... and wrap back to the start. i.e. 'Offline' will change to 'Online' 'Online' will change to 'Expired' 'Expired' w...

Why does Phobos use enum for constants?

Why does Phobos use enum to define constants? For example, in std.math: enum real E = 2.7182818284590452354L; Why not use a global immutable? What are the advantages/disadvantages of enum over immutable? ...

PDO cannot compare mysql ENUM using integers in prepared statements

I am using PDO and prepared statements, but i cannot seem to get any results when comparing an ENUM field with an integer. Example: $db = new PDO('mysql:host=localhost;dbname=****', '***', '***'); $s = $db->prepare('SELECT id FROM t2 WHERE lang = ?'); $s->execute(array('en')); // Works print_r($s->fetchAll()); $s->exec...

Enums with jQuery?

$("#bc [id$=_dropdownID]").change(function() { if (this.value == '2' || this.value == '3') { $("#bc .pnl").show(); } else { $("#bc .pnl").hide(); } I have the following code in jQuery. Is there any way I can replace the hard coded constants 2 and 3 in the above code with a c# enum? Does jQuery support en...

How do I change the type of an enum?

By default, C# enums are stored as integers. I'd like to make it a short instead. Is there a way to do this? ...

iPhone SDK << meaning?

Hi another silly simple question. I have noticed that in certain typedefs in Apple's frameworks use the symbols "<<" can anyone tell me what that means?: enum { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizin...

SINGLE_TABLE inheritance strategy using enums as discriminator value

Is it possible to use an enum as a discriminator value when using SINGLE_TABLE inheritance strategy? ...

Iterate through Enums in C++

C++ enum question. So I have a list of files, and their IDs that I need to iterate over, and do stuff to. Most of the stuff is the same, but there are a few file-specific things that need to be done. I tried putting the file IDs in an enum, and iterating over that. Howver, the fileIDs are non contiguous, and jump around. Currently, I ...

Better pattern for construction of this object?

I am constructing enum values that have a data structure like the following: enum MetaType { HUMAN( new MetaTypeAttribute(AttributeType.BODY, 1, 6), new MetaTypeAttribute(AttributeType.AGILITY, 1, 6), new MetaTypeAttribute(AttributeType.REACTION, 1, 6) ), ORK( new MetaTypeAttribute(AttributeType.BODY, 4, 9), new MetaTypeAtt...

enum flags with name

Hi! I'm going to use enum flags for options to initialize my class. The enum is: namespace MCXJS { enum VARPARAM { STATIC = 1, CONST = 2 } //other things } If I'm right, in this case, to check for STATIC I need to do this: if (param & MCXJS::VARPARAM::STATIC) //... I know to do it this way: if (par...

Hibernate Mapping: Class having more than one possible value from an enum

I am doing a simple web page and I have a NurseForm entity. When the nurse sees a patient he/she fills this form. One of this form field is "Actions done" which is basically an enum with: public enum NurseAction { GIVE_MEDICINE, PERFORM_SUTURE, SPRAY_THERAPY, NEBULIZATIONS; } A nurse can perform more than one action so I have a p...

Entity Framework 4 - How To Map Lookup Table To Enum?

Hi Guys, Suppose i have the following 2 SQL tables: Foo Column DataType --------------------------- Title NVARCHAR(20) Body NVARCHAR(MAX) FooTypeId TINYINT FooType Column DataType -------------------------- FooTypeId TINYINT Name NVARCHAR(10) Now, im using Entity Framework 4.0 with...

MySQL Tri-state field

I need to create a good/neutral/bad field. which one would be the more understandable/correct way. A binary field with null (1=good, null=neutral, 0=bad) An int (1=good, 2=neutral, 3=bad) An enum (good, neutral, bad) Any other It's only and informative field and I will not need to search by this. ...

Enumerations in Delphi with custom values

Hi! It is possible to declare enums with custom values in Delphi 5 like this?: type MyEnum = (meVal1 = 1, meVal2 = 3); // compiler error Thanks! ...