This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Bitwise operations with Enumerated types  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using COM4J to integrate my Java application with SDF (Autodesk) compoent toolkit in COM. COM4J generated wrapper interfaces or proxies for this COM object and one of the method signature is

@VTID(17)
void open(
java.lang.String sdfPath,
sdf.com.kit.SdfOpenFlags openFlags,
boolean useKif);

Where the openFlags argument is of type enum.
public enum SdfOpenFlags implements ComEnum {
sdfOpenRead(1),
sdfOpenUpdate(2),
sdfCreateNew(4),
sdfCreateAlways(8),
sdfOpenAlways(16),
sdfOpenExisting(32),
;

private final int value;
SdfOpenFlags(int value) { this.value=value; }
public int comEnumValue() { return value; }
}

The corresponding VB example to call this COM function is

Rem - Create a new SDF opened for write.
openFlags = sdfOpenUpdate Or sdfCreateAlways
toolkit.Open "c:\temp\TEST.SDF", openFlags, True

I would like to use Java the same way but got compilation errors.

toolkit.open("c:\\Temp\\test.sdf", SdfOpenFlags.sdfCreateAlways | SdfOpenFlags.sdfOpenUpdate, true);

This leads to compilation errors as "The operator | is undefined for argument type(s) sdf.com.kit.SdfOpenFlags, sdf.com.kit.SdfOpenFlags

I am not sure how I should use the OR operator in this case in Java.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

toolkit.open("c:\\Temp\\test.sdf", SdfOpenFlags.sdfCreateAlways | SdfOpenFlags.sdfOpenUpdate, true);



might have a better chance.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,

I am also using com4j to generate wrapper (*.java) from DLL, I successfully generated a set of *.java files, but I can not complie them.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$ javac Planet.java
Planet.java:3: 'class' or 'interface' expected
public enum Planet {
^
1 error
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"enum" type can not be identified. I use jdk1.5.0_08, com4j.dll and com4j.jar are also in lib path.

How do you compile the *.java file?

Thanks.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!