/** * Returns the class name without the package prefix. * * @param targetClass The class to get a short name for * @return The short name of the class */ public static String getShortName(Class<?> targetClass) { return getShortName(targetClass.getName()); }
/** * Returns the property name equivalent for the specified class. * * @param targetClass The class to get the property name for * @return A property name reperesentation of the class name (eg. MyClass becomes myClass) */ public static String getPropertyNameRepresentation(Class<?> targetClass) { return getPropertyNameRepresentation(getShortName(targetClass)); }
/** * Retrieves the logical name of the class without the trailing name * @param name The name of the class * @param trailingName The trailing name * @return The logical name */ public static String getLogicalName(String name, String trailingName) { if (isBlank(trailingName)) { return name; } String shortName = getShortName(name); if (shortName.indexOf(trailingName) == - 1) { return name; } return shortName.substring(0, shortName.length() - trailingName.length()); }
name = getShortName(name); List<String> words = new ArrayList<String>(); int i = 0;
final String shortName = GrailsNameUtils.getShortName(clazz); if (!query.matches("(?i)from(?-i)\\s+[" + clazz.getName() + "|" + shortName + "].*")) { throw new GrailsQueryException("Invalid query [" + query + "] for domain class [" + clazz + "]");
final String shortName = GrailsNameUtils.getShortName(clazz); if (!query.matches("(?i)from(?-i)\\s+[" + clazz.getName() + "|" + shortName + "].*")) { throw new GrailsQueryException("Invalid query [" + query + "] for domain class [" + clazz + "]");