@Test public void testRelationshipName_UpperCase_Underscores() { DbRelationship r1 = makeRelationship("PAINTING", "ARTIST_ID", "ARTIST", "ARTIST_ID", false); assertEquals("artist", generator.relationshipName(r1)); DbRelationship r2 = makeRelationship("ARTIST", "ARTIST_ID", "PAINTING", "ARTIST_ID", true); assertEquals("paintings", generator.relationshipName(r2)); DbRelationship r3 = makeRelationship("PERSON", "MOTHER_ID", "PERSON", "PERSON_ID", false); assertEquals("mother", generator.relationshipName(r3)); DbRelationship r4 = makeRelationship("PERSON", "PERSON_ID", "PERSON", "MOTHER_ID", true); assertEquals("people", generator.relationshipName(r4)); DbRelationship r5 = makeRelationship("PERSON", "SHIPPING_ADDRESS_ID", "ADDRESS", "ID", false); assertEquals("shippingAddress", generator.relationshipName(r5)); DbRelationship r6 = makeRelationship("PERSON", "ID", "ADDRESS", "PERSON_ID", true); assertEquals("addresses", generator.relationshipName(r6)); }
@Override public String relationshipName(DbRelationship... relationshipChain) { if (relationshipChain == null || relationshipChain.length < 1) { throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain); } String name = isToMany(relationshipChain) ? toManyRelationshipName(relationshipChain) : toOneRelationshipName(relationshipChain); return Util.underscoredToJava(name, false); }
DefaultObjectNameGenerator implements ObjectNameGenerator { @Override public String relationshipName(DbRelationship... relationshipChain) { if (relationshipChain == null || relationshipChain.length < 1) { throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain); } String name = isToMany(relationshipChain) ? toManyRelationshipName(relationshipChain) : toOneRelationshipName(relationshipChain); return Util.underscoredToJava(name, false); } }
DefaultObjectNameGenerator implements ObjectNameGenerator { @Override public String relationshipName(DbRelationship... relationshipChain) { if (relationshipChain == null || relationshipChain.length < 1) { throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain); } String name = isToMany(relationshipChain) ? toManyRelationshipName(relationshipChain) : toOneRelationshipName(relationshipChain); return Util.underscoredToJava(name, false); } DefaultObjectNameGenerator();  DefaultObjectNameGenerator(DbEntityNameStemmer dbEntityNameStemmer); }
DefaultObjectNameGenerator implements ObjectNameGenerator { @Override public String relationshipName(DbRelationship... relationshipChain) { if (relationshipChain == null || relationshipChain.length < 1) { throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain); } String name = isToMany(relationshipChain) ? toManyRelationshipName(relationshipChain) : toOneRelationshipName(relationshipChain); return Util.underscoredToJava(name, false); } DefaultObjectNameGenerator();  DefaultObjectNameGenerator(DbEntityNameStemmer dbEntityNameStemmer); @Override String relationshipName(DbRelationship... relationshipChain); @Override String objEntityName(DbEntity dbEntity); @Override String objAttributeName(DbAttribute attr); }
DefaultObjectNameGenerator implements ObjectNameGenerator { @Override public String relationshipName(DbRelationship... relationshipChain) { if (relationshipChain == null || relationshipChain.length < 1) { throw new IllegalArgumentException("At least on relationship is expected: " + relationshipChain); } String name = isToMany(relationshipChain) ? toManyRelationshipName(relationshipChain) : toOneRelationshipName(relationshipChain); return Util.underscoredToJava(name, false); } DefaultObjectNameGenerator();  DefaultObjectNameGenerator(DbEntityNameStemmer dbEntityNameStemmer); @Override String relationshipName(DbRelationship... relationshipChain); @Override String objEntityName(DbEntity dbEntity); @Override String objAttributeName(DbAttribute attr);  }