This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Customization of selectors in Java

Customization of selectors in Java

    When IIZI doesn’t provide a predefined function that is suitable, you can write Java code to return a boolean.

    To do so, create a class implementing the interface com.iizix.api.ISelectorExpression. If you click on the editor link create a new Java class, a wizard will help you to create the class.

    Example expression:

    { Java: "myapp.MySelector" }
    

    Sample of such a Java Expression:

    import com.iizix.prop.EnvProps;
    import com.iizix.prop.ISelectorExpression;
    import com.iizix.server.gyro.AppSessionGyro;
    import com.iizix.server.gyro.ClientSessionGyro;
    
    public class MySelector implements ISelectorExpression {
    
      @Override
      public boolean isSelected (EnvProps envProps) {
        AppSessionGyro appGyro = AppSessionGyro.getSessionInstance();
        ClientSessionGyro clientGyro = ClientSessionGyro.getSessionInstance();
        return false;
      }
    }
    

    From the envProps, you can reach mostly everything. These environment properties come from the end-user device. You can also grab an instance of the AppSessionGyro or ClientSessionGyro as shown above to access e.g. client or application states for more advanced expressions