Java Action

Hello  I wanted to create a Java Action in Mendix, so I created a java action named ConvertIntToByte with the parameter Integer and the return type Boolean. I found the Java file according to the doc entry under javasource>myfirstmodule>actions>ConvertIntToByte. There is the following code in it:   // This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments.   package myfirstmodule.actions;   import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction;   public class ConvertIntToByte extends CustomJavaAction<java.lang.Boolean> {     private java.lang.Long Parameter;       public ConvertIntToByte(IContext context, java.lang.Long Parameter)     {         super(context);         this.Parameter = Parameter;     }       @java.lang.Override     public java.lang.Boolean executeAction() throws Exception     {         // BEGIN USER CODE         throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented");         // END USER CODE     }       /**      * Returns a string representation of this action      * @return a string representation of this action      */     @java.lang.Override     public java.lang.String toString()     {         return "ConvertIntToByte";     }       // BEGIN EXTRA CODE     // END EXTRA CODE } I want to execute the following code:   int intvalue = 123456789; // Where is the integervalue??? boolean bit24 = ((intvalue >> 23) & 0x1) == 1; // extract 24 bit   I think I need to use the parameter value as the intvalue but where is it located in the above code?
1 answers

The actual action you can implement in executeAction() between the comments.


int.x = this.parameter



Note that the executeAction() expects a boolean return. You might want to change that in the Mendix Studio so that you can give the 24bit back (seeing your coment about //extract 24bit). 


All in all I recommend just looking at some CommunityCommons java actions to get an idea of how Java actions work with Mendix. Or follow this tutorial to get started: .