/** * Converts a camel case to underscore and then pluralizes. * * Example: "GrayDuck" is converted to "gray_ducks". * * @param camelCase any CamelCase phrase. * @return pluralized version of underscored CamelCase. */ public static String tableize(String camelCase) { return pluralize(underscore(camelCase)); }
/** * Generates a XML document from content of this list. * * @param pretty pretty format (human readable), or one line text. * @param declaration true to include XML declaration at the top * @param attrs list of attributes to include. No arguments == include all attributes. * @return generated XML. */ public String toXml(boolean pretty, boolean declaration, String... attrs) { String topNode = Inflector.pluralize(Inflector.underscore(metaModel.getModelClass().getSimpleName())); hydrate(); StringBuilder sb = new StringBuilder(); if(declaration) { sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); if (pretty) sb.append('\n'); } sb.append('<').append(topNode).append('>'); if (pretty) { sb.append('\n'); } for (T t : delegate) { t.toXmlP(sb, pretty, pretty ? " " : "", attrs); } sb.append("</").append(topNode).append('>'); if (pretty) { sb.append('\n'); } return sb.toString(); }
String tag = pluralize(underscore(cachedChild.getKey().getSimpleName())); sb.append('<').append(tag).append('>'); if (pretty) { sb.append('\n'); }
private MetaModel inferTargetMetaModel(String targetTableName){ String targetTable = singularize(targetTableName); MetaModel targetMM = metaModelFor(targetTable); if(targetMM == null){ targetTable = pluralize(targetTableName); targetMM = metaModelFor(targetTable); } return targetMM != null? targetMM: null; }
if (i > 0) { sb.append(','); } Class parentClass = parentClasses.get(i); String name = pluralize(parentClasses.get(i).getSimpleName()).toLowerCase(); if (pretty) { sb.append("\n ").append(indent); } sb.append('"').append(name).append("\":["); if (i > 0) { sb.append(','); } Class childClass = childClasses.get(i); String name = pluralize(childClass.getSimpleName()).toLowerCase(); if (pretty) { sb.append("\n ").append(indent); } sb.append('"').append(name).append("\":[");
/** * Converts a camel case to underscore and then pluralizes. * * Example: "GrayDuck" is converted to "gray_ducks". * * @param camelCase any CamelCase phrase. * @return pluralized version of underscored CamelCase. */ public static String tableize(String camelCase) { return pluralize(underscore(camelCase)); }
/** * Converts a camel case to underscore and then pluralizes. * * Example: "GrayDuck" is converted to "gray_ducks". * * @param camelCase any CamelCase phrase. * @return pluralized version of underscored CamelCase. */ public static String tableize(String camelCase) { return pluralize(underscore(camelCase)); }
String tag = pluralize(underscore(childClass.getSimpleName())); sb.append('<').append(tag).append('>'); if (pretty) { sb.append('\n'); }
/** * Generates a XML document from content of this list. * * @param pretty pretty format (human readable), or one line text. * @param declaration true to include XML declaration at the top * @param attrs list of attributes to include. No arguments == include all attributes. * @return generated XML. */ public String toXml(boolean pretty, boolean declaration, String... attrs) { String topNode = Inflector.pluralize(Inflector.underscore(metaModel.getModelClass().getSimpleName())); hydrate(); StringBuilder sb = new StringBuilder(); if(declaration) { sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); if (pretty) sb.append('\n'); } sb.append('<').append(topNode).append('>'); if (pretty) { sb.append('\n'); } for (T t : delegate) { t.toXmlP(sb, pretty, pretty ? " " : "", attrs); } sb.append("</").append(topNode).append('>'); if (pretty) { sb.append('\n'); } return sb.toString(); }
/** * Generates a XML document from content of this list. * * @param pretty pretty format (human readable), or one line text. * @param declaration true to include XML declaration at the top * @param attrs list of attributes to include. No arguments == include all attributes. * @return generated XML. */ public String toXml(boolean pretty, boolean declaration, String... attrs) { String topNode = Inflector.pluralize(Inflector.underscore(metaModel.getModelClass().getSimpleName())); hydrate(); StringBuilder sb = new StringBuilder(); if(declaration) { sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); if (pretty) sb.append('\n'); } sb.append('<').append(topNode).append('>'); if (pretty) { sb.append('\n'); } for (T t : delegate) { t.toXmlP(sb, pretty, pretty ? " " : "", attrs); } sb.append("</").append(topNode).append('>'); if (pretty) { sb.append('\n'); } return sb.toString(); }
String tag = pluralize(underscore(cachedChild.getKey().getSimpleName())); sb.append('<').append(tag).append('>'); if (pretty) { sb.append('\n'); }
if (i > 0) { sb.append(','); } Class childClass = childClasses.get(i); String name = pluralize(childClass.getSimpleName()).toLowerCase(); if (pretty) { sb.append("\n ").append(indent); } sb.append('"').append(name).append("\":[");
private MetaModel inferTargetMetaModel(String targetTableName){ String targetTable = singularize(targetTableName); MetaModel targetMM = metaModelFor(targetTable); if(targetMM == null){ targetTable = pluralize(targetTableName); targetMM = metaModelFor(targetTable); } return targetMM != null? targetMM: null; }
if (i > 0) { sb.append(','); } Class parentClass = parentClasses.get(i); String name = pluralize(parentClasses.get(i).getSimpleName()).toLowerCase(); if (pretty) { sb.append("\n ").append(indent); } sb.append('"').append(name).append("\":["); if (i > 0) { sb.append(','); } Class childClass = childClasses.get(i); String name = pluralize(childClass.getSimpleName()).toLowerCase(); if (pretty) { sb.append("\n ").append(indent); } sb.append('"').append(name).append("\":[");
private MetaModel inferTargetMetaModel(String targetTableName){ String targetTable = singularize(targetTableName); MetaModel targetMM = Registry.instance().getMetaModel(targetTable); if(targetMM == null){ targetTable = pluralize(targetTableName); targetMM = Registry.instance().getMetaModel(targetTable); } return targetMM != null? targetMM: null; }