Noob java question, long and integer conversion

1
I have started writing java code with eclipse. Evertything is working except when using an Integer value. Everytime I want to change an Integer value I have the type mismatch between an integer and long value. Now I knowm that passing an Integer to Java it gets converted to a long. But the way back is still giving me problems. There is probably a java guru out there how inmediately sees my (probably very stupid) mistake. package myfirstmodule.actions; import com.mendix.systemwideinterfaces.core.UserAction; import com.mendix.systemwideinterfaces.core.IMendixObject; /** * */ public class ChangeEntity extends UserAction<boolean> { private IMendixObject __EntiteitObject; private myfirstmodule.proxies.Entiteit EntiteitObject; private String StringA; private String StringB; private Long Integer1; private Boolean Boolean1; private Boolean Boolean2; public ChangeEntity(IMendixObject EntiteitObject, String StringA, String StringB, Long Integer1, Boolean Boolean1, Boolean Boolean2) { super(); this.__EntiteitObject = EntiteitObject; this.StringA = StringA; this.StringB = StringB; this.Integer1 = Integer1; this.Boolean1 = Boolean1; this.Boolean2 = Boolean2; } @Override public Boolean executeAction() throws Exception { this.EntiteitObject = __EntiteitObject == null ? null : myfirstmodule.proxies.Entiteit.initialize(this.getContext(), __EntiteitObject); // BEGIN USER CODE StringA = "d"; StringB = "e"; Boolean1 = false; Boolean2 = false; Integer1 = (int)1000; EntiteitObject.setInteger1(Integer1); EntiteitObject.setStringA(StringA); EntiteitObject.setStringB(StringB); EntiteitObject.setBoolean1(Boolean1); EntiteitObject.setBoolean2(Boolean2); return true; // END USER CODE } /** * Returns a string representation of this action */ @Override public String toString() { return "ChangeEntity"; } // BEGIN EXTRA CODE // END EXTRA CODE }
asked
1 answers
0

probably one of these does the trick(no IDE at hand)

EntiteitObject.setInteger1((int)(long)Integer1);
EntiteitObject.setInteger1(Integer1.intValue());
EntiteitObject.setInteger1(Integer.valueOf(Integer1));
answered