You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/07/18 02:15:41 UTC
svn commit: r422926 - in
/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model:
Content.java Text.java
Author: jmsnell
Date: Mon Jul 17 17:15:41 2006
New Revision: 422926
URL: http://svn.apache.org/viewvc?rev=422926&view=rev
Log:
It's a mystery to me why enum does not automatically expose the ordinal value for it's members
Modified:
incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java
Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java?rev=422926&r1=422925&r2=422926&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java Mon Jul 17 17:15:41 2006
@@ -100,6 +100,12 @@
*/
public interface Content extends Element {
+ public static final int TYPE_TEXT = 0;
+ public static final int TYPE_HTML = 1;
+ public static final int TYPE_XHTML = 2;
+ public static final int TYPE_XML = 3;
+ public static final int TYPE_MEDIA = 4;
+
public enum Type {
TEXT, HTML, XHTML, XML, MEDIA;
Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java?rev=422926&r1=422925&r2=422926&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java Mon Jul 17 17:15:41 2006
@@ -57,6 +57,10 @@
public interface Text
extends Element {
+ public static final int TYPE_TEXT = 0;
+ public static final int TYPE_HTML = 1;
+ public static final int TYPE_XHTML = 2;
+
public static enum Type {
TEXT, HTML, XHTML;
Re: svn commit: r422926 - in /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model:
Content.java Text.java
Posted by James M Snell <ja...@gmail.com>.
I might be missing something, but switching on the enum just doesn't
want to seem to want to compile in Eclipse. I'll keep digging and will
pull these back out if I can figure out exactly why the switching on the
enum doesn't work.
- James
Stephen Duncan wrote:
> Is there a reason you can't just switch on the enum itself? (A
> retroweaver limitation?)
>
> - Stephen
>
> On 7/17/06, James M Snell <ja...@gmail.com> wrote:
>> e.g.,
>>
>> switch(entry.getContentType().ordinal()) {
>> case Content.TYPE_TEXT:
>> ...
>> case Content.TYPE_HTML:
>> ...
>> case Content.TYPE_XHTML:
>> ...
>> }
>>
>> Garrett Rooney wrote:
>> > On 7/17/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> >> Author: jmsnell
>> >> Date: Mon Jul 17 17:15:41 2006
>> >> New Revision: 422926
>> >>
>> >> URL: http://svn.apache.org/viewvc?rev=422926&view=rev
>> >> Log:
>> >> It's a mystery to me why enum does not automatically expose the
>> >> ordinal value for it's members
>> >
>> > Uhh, I kinda wonder too, but just out of curiosity what are you
>> > actually using these values for?
>> >
>> > -garrett
>> >
>>
>
>
Re: svn commit: r422926 - in /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model:
Content.java Text.java
Posted by James M Snell <ja...@gmail.com>.
Heh... teach me to jump back and forth across multiple JVM versions and
programming languages. I completely forgot about the fact that in a
switch with enums, you're only supposed to include the label... e.g.,
switch(type) {
case XHTML:
case HTML:
case TEXT:
}
Now I'm feeling quite silly......
- James
Stephen Duncan wrote:
> Is there a reason you can't just switch on the enum itself? (A
> retroweaver limitation?)
>
> - Stephen
>
> On 7/17/06, James M Snell <ja...@gmail.com> wrote:
>> e.g.,
>>
>> switch(entry.getContentType().ordinal()) {
>> case Content.TYPE_TEXT:
>> ...
>> case Content.TYPE_HTML:
>> ...
>> case Content.TYPE_XHTML:
>> ...
>> }
>>
>> Garrett Rooney wrote:
>> > On 7/17/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> >> Author: jmsnell
>> >> Date: Mon Jul 17 17:15:41 2006
>> >> New Revision: 422926
>> >>
>> >> URL: http://svn.apache.org/viewvc?rev=422926&view=rev
>> >> Log:
>> >> It's a mystery to me why enum does not automatically expose the
>> >> ordinal value for it's members
>> >
>> > Uhh, I kinda wonder too, but just out of curiosity what are you
>> > actually using these values for?
>> >
>> > -garrett
>> >
>>
>
>
Re: svn commit: r422926 - in /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model: Content.java Text.java
Posted by Stephen Duncan <st...@gmail.com>.
Is there a reason you can't just switch on the enum itself? (A
retroweaver limitation?)
- Stephen
On 7/17/06, James M Snell <ja...@gmail.com> wrote:
> e.g.,
>
> switch(entry.getContentType().ordinal()) {
> case Content.TYPE_TEXT:
> ...
> case Content.TYPE_HTML:
> ...
> case Content.TYPE_XHTML:
> ...
> }
>
> Garrett Rooney wrote:
> > On 7/17/06, jmsnell@apache.org <jm...@apache.org> wrote:
> >> Author: jmsnell
> >> Date: Mon Jul 17 17:15:41 2006
> >> New Revision: 422926
> >>
> >> URL: http://svn.apache.org/viewvc?rev=422926&view=rev
> >> Log:
> >> It's a mystery to me why enum does not automatically expose the
> >> ordinal value for it's members
> >
> > Uhh, I kinda wonder too, but just out of curiosity what are you
> > actually using these values for?
> >
> > -garrett
> >
>
--
Stephen Duncan Jr
www.stephenduncanjr.com
Re: svn commit: r422926 - in /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model:
Content.java Text.java
Posted by James M Snell <ja...@gmail.com>.
e.g.,
switch(entry.getContentType().ordinal()) {
case Content.TYPE_TEXT:
...
case Content.TYPE_HTML:
...
case Content.TYPE_XHTML:
...
}
Garrett Rooney wrote:
> On 7/17/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> Author: jmsnell
>> Date: Mon Jul 17 17:15:41 2006
>> New Revision: 422926
>>
>> URL: http://svn.apache.org/viewvc?rev=422926&view=rev
>> Log:
>> It's a mystery to me why enum does not automatically expose the
>> ordinal value for it's members
>
> Uhh, I kinda wonder too, but just out of curiosity what are you
> actually using these values for?
>
> -garrett
>
Re: svn commit: r422926 - in /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model: Content.java Text.java
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/17/06, jmsnell@apache.org <jm...@apache.org> wrote:
> Author: jmsnell
> Date: Mon Jul 17 17:15:41 2006
> New Revision: 422926
>
> URL: http://svn.apache.org/viewvc?rev=422926&view=rev
> Log:
> It's a mystery to me why enum does not automatically expose the ordinal value for it's members
Uhh, I kinda wonder too, but just out of curiosity what are you
actually using these values for?
-garrett