Java tutorial
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt public class Main { public static final int MENU_VALUE_TYPE = 1; public static final int MENU_VALID_TYPE = 2; public static final int MENU_INVALID_TYPE = 3; /** * * Judge current name of menu whether is same to menuType * * @param menuStr is the name of the menu * @param menuType is the type which we think it should be * @return return true if menuStr is adapt to menuType, else return false */ public static boolean judgeMenuType(String menuStr, int menuType) { if (menuStr == null) { return false; } switch (menuType) { case MENU_VALUE_TYPE: return menuStr.toLowerCase().indexOf("values") > -1;//$NON-NLS-1$ case MENU_VALID_TYPE: return menuStr.toLowerCase().indexOf("valid") > -1;//$NON-NLS-1$ case MENU_INVALID_TYPE: return menuStr.toLowerCase().indexOf("invalid") > -1;//$NON-NLS-1$ default: return false; } } }