List of usage examples for com.liferay.portal.kernel.util TextFormatter formatPlural
public static String formatPlural(String s)
From source file:com.liferay.alloy.mvc.AlloyServiceInvoker.java
License:Open Source License
public AlloyServiceInvoker(String className) { Class<?> clazz = getClass(); ClassLoader classLoader = clazz.getClassLoader(); int pos = className.indexOf(".model."); String simpleClassName = className.substring(pos + 7); String serviceClassName = className.substring(0, pos) + ".service." + simpleClassName + "LocalServiceUtil"; try {//ww w. jav a 2s. co m Class<?> serviceClass = classLoader.loadClass(serviceClassName); dynamicQueryCountMethod = serviceClass.getMethod("dynamicQueryCount", new Class[] { DynamicQuery.class }); dynamicQueryMethod1 = serviceClass.getMethod("dynamicQuery", new Class[0]); dynamicQueryMethod2 = serviceClass.getMethod("dynamicQuery", new Class[] { DynamicQuery.class }); dynamicQueryMethod3 = serviceClass.getMethod("dynamicQuery", new Class[] { DynamicQuery.class, int.class, int.class }); dynamicQueryMethod4 = serviceClass.getMethod("dynamicQuery", new Class[] { DynamicQuery.class, int.class, int.class, OrderByComparator.class }); fetchModelMethod = serviceClass.getMethod("fetch" + simpleClassName, new Class[] { long.class }); getModelsCountMethod = serviceClass .getMethod("get" + TextFormatter.formatPlural(simpleClassName) + "Count", new Class[0]); getModelsMethod = serviceClass.getMethod("get" + TextFormatter.formatPlural(simpleClassName), new Class[] { int.class, int.class }); } catch (Exception e) { throw new RuntimeException(e); } }