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.