You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

1

Sunday, October 12th 2014, 6:35pm

How to implement an enum?

Hi,

I'm building a sample of using Neo4J with Jabaco, to share with the community. One of the parameters of the Neo4J method createRelationshipTo - is usually illustrated as an enum that implements the RelationshipType.

E.g.,


public static enum RelTypes implements RelationshipType
{
RELATE_TO;
}


I have no problem implementing interfaces in Jabaco (thanks to the forum), but cannot figure out how to make it an enum type, as above.

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

2

Monday, October 13th 2014, 4:25pm

This is the way Jabaco handles enums:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Enum WithValues
  First = 1
  Second = 2
  Third = 3
  Fourth = 4
  Seventh = 7
End Enum

Enum WithoutValues
  Zero
  One
  Two
  Three
  Four
End Enum

Public Sub Command1_Click()
   MsgBox WithValues.Third
   MsgBox WithoutValues.Two
End Sub

Java Enums and Jabaco Enums are incompatible, because Java implemented Enums in Java 7 - a lot later, then Jabaco have implemented it.

Greatings
theuserbl

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

3

Monday, October 13th 2014, 5:37pm

This is the way Jabaco handles enums:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Enum WithValues
  First = 1
  Second = 2
  Third = 3
  Fourth = 4
  Seventh = 7
End Enum

Enum WithoutValues
  Zero
  One
  Two
  Three
  Four
End Enum

Public Sub Command1_Click()
   MsgBox WithValues.Third
   MsgBox WithoutValues.Two
End Sub

Java Enums and Jabaco Enums are incompatible, because Java implemented Enums in Java 7 - a lot later, then Jabaco have implemented it.

Greatings
theuserbl

This is the way Jabaco handles enums:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Enum WithValues
  First = 1
  Second = 2
  Third = 3
  Fourth = 4
  Seventh = 7
End Enum

Enum WithoutValues
  Zero
  One
  Two
  Three
  Four
End Enum

Public Sub Command1_Click()
   MsgBox WithValues.Third
   MsgBox WithoutValues.Two
End Sub

Java Enums and Jabaco Enums are incompatible, because Java implemented Enums in Java 7 - a lot later, then Jabaco have implemented it.

Greatings
theuserbl


theuserbl,

Thanks, I know how to write enums in Jabaco. I'm just not clear on the structure of an enum type, which implements an interface. How would

public static enum RelTypes implements RelationshipType
{
RELATE_TO;
}


be implemented in Java, after creating a class and specifying RelationshipType as the superclass?

Rate this thread
WoltLab Burning Board