Permalink
Browse files

#2 renamed @InvokeUsing to @ImplementedBy

  • Loading branch information...
DirkMahler committed Nov 15, 2013
1 parent 715f4fe commit 863a0a88bad030962f499d00ab39123afc34b2a6
@@ -97,7 +97,7 @@ Apache License
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
(b) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
@@ -9,7 +9,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface InvokeUsing {
public @interface ImplementedBy {
Class<? extends ProxyMethod> value();
@@ -2,11 +2,11 @@
import com.buschmais.cdo.neo4j.api.proxy.ProxyMethod;
public class InvokeUsingMethodMetadata extends AbstractMethodMetadata<BeanMethod> {
public class ImplementedByMethodMetadata extends AbstractMethodMetadata<BeanMethod> {
private Class<? extends ProxyMethod> proxyMethodType;
public InvokeUsingMethodMetadata(BeanMethod beanMethod, Class<? extends ProxyMethod> proxyMethodType) {
public ImplementedByMethodMetadata(BeanMethod beanMethod, Class<? extends ProxyMethod> proxyMethodType) {
super(beanMethod);
this.proxyMethodType = proxyMethodType;
}
@@ -77,9 +77,9 @@ private void createMetadata(Class<?> type, Collection<BeanMethod> beanMethods, S
PrimitivePropertyMethodMetadata indexedProperty = null;
for (BeanMethod beanMethod : beanMethods) {
AbstractMethodMetadata propertyMetadata;
InvokeUsing invokeUsing = beanMethod.getMethod().getAnnotation(InvokeUsing.class);
if (invokeUsing != null) {
propertyMetadata = new InvokeUsingMethodMetadata(beanMethod, invokeUsing.value());
ImplementedBy implementedBy = beanMethod.getMethod().getAnnotation(ImplementedBy.class);
if (implementedBy != null) {
propertyMetadata = new ImplementedByMethodMetadata(beanMethod, implementedBy.value());
} else if (beanMethod instanceof BeanPropertyMethod) {
BeanPropertyMethod beanPropertyMethod = (BeanPropertyMethod) beanMethod;
if (Collection.class.isAssignableFrom(beanPropertyMethod.getType())) {
@@ -27,9 +27,9 @@ public ProxyMethodService(NodeMetadataProvider nodeMetadataProvider, InstanceMan
for (AbstractMethodMetadata methodMetadata : nodeMetadata.getProperties()) {
BeanMethod beanMethod = methodMetadata.getBeanMethod();
ProxyMethod proxyMethod = null;
if (methodMetadata instanceof InvokeUsingMethodMetadata) {
InvokeUsingMethodMetadata invokeUsingMethodMetadata = (InvokeUsingMethodMetadata) methodMetadata;
Class<? extends ProxyMethod> proxyMethodType = invokeUsingMethodMetadata.getProxyMethodType();
if (methodMetadata instanceof ImplementedByMethodMetadata) {
ImplementedByMethodMetadata implementedByMethodMetadata = (ImplementedByMethodMetadata) methodMetadata;
Class<? extends ProxyMethod> proxyMethodType = implementedByMethodMetadata.getProxyMethodType();
try {
proxyMethod = proxyMethodType.newInstance();
} catch (InstantiationException e) {
@@ -3,13 +3,12 @@
import com.buschmais.cdo.api.CdoManager;
import com.buschmais.cdo.neo4j.test.AbstractCdoManagerTest;
import com.buschmais.cdo.neo4j.test.invokeusing.composite.A;
import org.junit.Ignore;
import org.junit.Test;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
public class InvokeUsingTest extends AbstractCdoManagerTest {
public class ImplementedByTest extends AbstractCdoManagerTest {
@Override
protected Class<?>[] getTypes() {
@@ -33,8 +32,8 @@ public void propertyMethods() {
CdoManager cdoManager = getCdoManagerFactory().createCdoManager();
cdoManager.begin();
A a = cdoManager.create(A.class);
a.setUsingHandler("VALUE");
String value = a.getUsingHandler();
a.setCustomValue("VALUE");
String value = a.getCustomValue();
assertThat(value, equalTo("set_VALUE_get"));
cdoManager.commit();
cdoManager.close();
@@ -1,6 +1,6 @@
package com.buschmais.cdo.neo4j.test.invokeusing.composite;
import com.buschmais.cdo.neo4j.api.annotation.InvokeUsing;
import com.buschmais.cdo.neo4j.api.annotation.ImplementedBy;
import com.buschmais.cdo.neo4j.api.annotation.Label;
@Label("A")
@@ -10,13 +10,13 @@
void setValue(int i);
@InvokeUsing(SetMethod.class)
void setUsingHandler(String usingHandler);
@ImplementedBy(SetMethod.class)
void setCustomValue(String usingHandler);
@InvokeUsing(GetMethod.class)
String getUsingHandler();
@ImplementedBy(GetMethod.class)
String getCustomValue();
@InvokeUsing(IncrementValueMethod.class)
@ImplementedBy(IncrementValueMethod.class)
int incrementValue();
}

0 comments on commit 863a0a8

Please sign in to comment.