/** * The name of the table to be used for persisting entities having the type passed as an argument. The default * implementation takes the {@code type.getSimpleName()} and separates camel case parts with '_'. */ default String getTableName(Class<?> type) { Assert.notNull(type, "Type must not be null."); return ParsingUtils.reconcatenateCamelCase(type.getSimpleName(), "_"); }
/** * Splits up the given camel-case {@link String}. * * @param source must not be {@literal null}. * @return */ public static List<String> splitCamelCase(String source) { return split(source, false); }
/** * Reconcatenates the given camel-case source {@link String} using the given delimiter. Will split up the camel-case * {@link String} and use an uncapitalized version of the parts. * * @param source must not be {@literal null}. * @param delimiter must not be {@literal null}. * @return */ public static String reconcatenateCamelCase(String source, String delimiter) { Assert.notNull(source, "Source string must not be null!"); Assert.notNull(delimiter, "Delimiter must not be null!"); return StringUtils.collectionToDelimitedString(splitCamelCaseToLower(source), delimiter); }
@Override public String getFieldName(PersistentProperty<?> property) { List<String> parts = ParsingUtils.splitCamelCaseToLower(property.getName()); List<String> result = new ArrayList<>(); for (String part : parts) { String candidate = preparePart(part); if (StringUtils.hasText(candidate)) { result.add(candidate); } } return StringUtils.collectionToDelimitedString(result, delimiter); }
/** * The name of the table to be used for persisting entities having the type passed as an argument. The default * implementation takes the {@code type.getSimpleName()} and separates camel case parts with '_'. */ default String getTableName(Class<?> type) { Assert.notNull(type, "Type must not be null."); return ParsingUtils.reconcatenateCamelCase(type.getSimpleName(), "_"); }
/** * Splits up the given camel-case {@link String} and returns the parts in lower case. * * @param source must not be {@literal null}. * @return */ public static List<String> splitCamelCaseToLower(String source) { return split(source, true); }
/** * The name of the table to be used for persisting entities having the type passed as an argument. The default * implementation takes the {@code type.getSimpleName()} and separates camel case parts with '_'. */ default String getTableName(Class<?> type) { Assert.notNull(type, "Type must not be null."); return ParsingUtils.reconcatenateCamelCase(type.getSimpleName(), "_"); }
@Override public Optional<String> getAttribute(String name) { String xmlAttributeName = ParsingUtils.reconcatenateCamelCase(name, "-"); String attribute = element.getAttribute(xmlAttributeName); return StringUtils.hasText(attribute) ? Optional.of(attribute) : Optional.empty(); }
/** * Defaults to return the given {@link RelationalPersistentProperty}'s name with the parts of a camel case name separated by * '_'; */ default String getColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); return ParsingUtils.reconcatenateCamelCase(property.getName(), "_"); }
/** * Defaults to return the given {@link RelationalPersistentProperty}'s name with the parts of a camel case name * separated by '_'; */ default String getColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); return ParsingUtils.reconcatenateCamelCase(property.getName(), "_"); }
/** * Defaults to return the given {@link RelationalPersistentProperty}'s name with the parts of a camel case name * separated by '_'; */ default String getColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); return ParsingUtils.reconcatenateCamelCase(property.getName(), "_"); }