diff --git a/impl/pom.xml b/impl/pom.xml index ccb6bbbf9..e540bad98 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -75,10 +75,6 @@ com.buschmais.xo xo.spi - - commons-lang - commons-lang - com.google.guava guava diff --git a/impl/src/main/java/com/buschmais/xo/impl/reflection/BeanMethodProvider.java b/impl/src/main/java/com/buschmais/xo/impl/reflection/BeanMethodProvider.java index d69201625..5adbec3df 100644 --- a/impl/src/main/java/com/buschmais/xo/impl/reflection/BeanMethodProvider.java +++ b/impl/src/main/java/com/buschmais/xo/impl/reflection/BeanMethodProvider.java @@ -1,15 +1,15 @@ package com.buschmais.xo.impl.reflection; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.util.*; + import com.buschmais.xo.api.XOException; import com.buschmais.xo.spi.reflection.AnnotatedMethod; import com.buschmais.xo.spi.reflection.GetPropertyMethod; import com.buschmais.xo.spi.reflection.SetPropertyMethod; import com.buschmais.xo.spi.reflection.UserMethod; -import org.apache.commons.lang.StringUtils; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.*; +import com.google.common.base.CaseFormat; public final class BeanMethodProvider { @@ -34,15 +34,15 @@ public Collection getMethods(Class type) { Class[] parameterTypes = method.getParameterTypes(); Type[] genericParameterTypes = method.getGenericParameterTypes(); if (methodName.startsWith("get") && parameterTypes.length == 0 && !void.class.equals(returnType)) { - String name = StringUtils.uncapitalize(methodName.substring(3)); + String name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName.substring(3)); getters.put(name, method); addType(type, name, returnType, genericReturnType); } else if (methodName.startsWith("is") && parameterTypes.length == 0 && !void.class.equals(returnType)) { - String name = StringUtils.uncapitalize(methodName.substring(2)); + String name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName.substring(2)); getters.put(name, method); addType(type, name, returnType, genericReturnType); } else if (methodName.startsWith("set") && parameterTypes.length == 1 && void.class.equals(returnType) && methodName.startsWith("set")) { - String name = StringUtils.uncapitalize(methodName.substring(3)); + String name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName.substring(3)); setters.put(name, method); addType(type, name, parameterTypes[0], genericParameterTypes[0]); } else { @@ -78,11 +78,13 @@ public Collection getMethods(Class type) { private void addType(Class declaringType, String name, Class type, Type genericType) { Class existingType = types.put(name, type); if (existingType != null && !existingType.equals(type)) { - throw new XOException("Get and set methods for property '" + name + "' of type '" + declaringType.getName() + "' do not declare the same type: " + existingType.getName() + " <> " + type.getName()); + throw new XOException("Get and set methods for property '" + name + "' of type '" + declaringType.getName() + "' do not declare the same type: " + + existingType.getName() + " <> " + type.getName()); } Type existingGenericType = genericTypes.put(name, genericType); if (existingGenericType != null && !existingGenericType.equals(genericType)) { - throw new XOException("Get and set methods for property '" + name + "' of type '" + declaringType.getName() + "' do not declare the same generic type: " + existingGenericType + " <> " + type.getName()); + throw new XOException("Get and set methods for property '" + name + "' of type '" + declaringType.getName() + + "' do not declare the same generic type: " + existingGenericType + " <> " + type.getName()); } } } diff --git a/impl/src/test/java/com/buschmais/xo/impl/test/bootstrap/osgi/OSGiTestCase.java b/impl/src/test/java/com/buschmais/xo/impl/test/bootstrap/osgi/OSGiTestCase.java index 92db69786..2901d786a 100644 --- a/impl/src/test/java/com/buschmais/xo/impl/test/bootstrap/osgi/OSGiTestCase.java +++ b/impl/src/test/java/com/buschmais/xo/impl/test/bootstrap/osgi/OSGiTestCase.java @@ -24,7 +24,6 @@ public Option[] createConfiguration() { mavenBundle("com.buschmais.xo", "xo.api").versionAsInProject(), // mavenBundle("com.buschmais.xo", "xo.spi").versionAsInProject(), // mavenBundle("javax.validation", "validation-api", "1.1.0.Final"), // - mavenBundle("commons-lang", "commons-lang", "2.6"), // mavenBundle("org.osgi", "org.osgi.compendium", "4.3.1"), // mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.6.0").start(true), // mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"), // diff --git a/neo4j/src/main/java/com/buschmais/xo/neo4j/impl/datastore/Neo4jMetadataFactory.java b/neo4j/src/main/java/com/buschmais/xo/neo4j/impl/datastore/Neo4jMetadataFactory.java index c318b0300..b7fa52fdd 100644 --- a/neo4j/src/main/java/com/buschmais/xo/neo4j/impl/datastore/Neo4jMetadataFactory.java +++ b/neo4j/src/main/java/com/buschmais/xo/neo4j/impl/datastore/Neo4jMetadataFactory.java @@ -12,6 +12,7 @@ import com.buschmais.xo.spi.reflection.AnnotatedMethod; import com.buschmais.xo.spi.reflection.AnnotatedType; import com.buschmais.xo.spi.reflection.PropertyMethod; +import com.google.common.base.CaseFormat; import org.apache.commons.lang.StringUtils; import org.neo4j.graphdb.DynamicLabel; import org.neo4j.graphdb.DynamicRelationshipType; @@ -87,7 +88,7 @@ public RelationshipMetadata createRelationMetadata(AnnotatedElement annotated } } if (name == null) { - name = StringUtils.capitalize(annotatedElement.getName()); + name = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, annotatedElement.getName()); } RelationshipType relationshipType = new RelationshipType(DynamicRelationshipType.withName(name)); return new RelationshipMetadata(relationshipType); diff --git a/neo4j/src/test/java/com/buschmais/xo/neo4j/test/demo/composite/Group.java b/neo4j/src/test/java/com/buschmais/xo/neo4j/test/demo/composite/Group.java index 623863eeb..8cbcdfdca 100644 --- a/neo4j/src/test/java/com/buschmais/xo/neo4j/test/demo/composite/Group.java +++ b/neo4j/src/test/java/com/buschmais/xo/neo4j/test/demo/composite/Group.java @@ -16,7 +16,7 @@ public interface Group { @ResultOf MemberByName getMemberByName(@Parameter("name") String name); - @Cypher("match (g:Group)-[:Members]->(p:Person) where id(g)={this} and p.name={name} return p as member") + @Cypher("match (g:Group)-[:MEMBERS]->(p:Person) where id(g)={this} and p.name={name} return p as member") public interface MemberByName { Person getMember(); } diff --git a/neo4j/src/test/java/com/buschmais/xo/neo4j/test/relation/implicit/ImplicitRelationTest.java b/neo4j/src/test/java/com/buschmais/xo/neo4j/test/relation/implicit/ImplicitRelationTest.java index bea1ced7e..be93af4db 100644 --- a/neo4j/src/test/java/com/buschmais/xo/neo4j/test/relation/implicit/ImplicitRelationTest.java +++ b/neo4j/src/test/java/com/buschmais/xo/neo4j/test/relation/implicit/ImplicitRelationTest.java @@ -39,7 +39,7 @@ public void oneToOne() { xoManager.currentTransaction().begin(); assertThat(a.getOneToOne(), equalTo(b1)); assertThat(b1.getOneToOne(), equalTo(a)); - assertThat(executeQuery("MATCH (a:A)-[:ImplicitOneToOne]->(b:B) RETURN b").getColumn("b"), hasItem(b1)); + assertThat(executeQuery("MATCH (a:A)-[:IMPLICIT_ONE_TO_ONE]->(b:B) RETURN b").getColumn("b"), hasItem(b1)); B b2 = xoManager.create(B.class); a.setOneToOne(b2); xoManager.currentTransaction().commit(); @@ -47,7 +47,7 @@ public void oneToOne() { assertThat(a.getOneToOne(), equalTo(b2)); assertThat(b2.getOneToOne(), equalTo(a)); assertThat(b1.getOneToOne(), equalTo(null)); - assertThat(executeQuery("MATCH (a:A)-[:ImplicitOneToOne]->(b:B) RETURN b").getColumn("b"), hasItem(b2)); + assertThat(executeQuery("MATCH (a:A)-[:IMPLICIT_ONE_TO_ONE]->(b:B) RETURN b").getColumn("b"), hasItem(b2)); a.setOneToOne(null); xoManager.currentTransaction().commit(); xoManager.currentTransaction().begin(); diff --git a/pom.xml b/pom.xml index 99f66d052..8717c0390 100644 --- a/pom.xml +++ b/pom.xml @@ -475,11 +475,6 @@ slf4j-api 1.7.5 - - commons-lang - commons-lang - 2.4 - com.google.guava guava