Skip to content

Commit

Permalink
remove ReferenceField from translators
Browse files Browse the repository at this point in the history
  • Loading branch information
dcrissman authored and Marek Paterczyk committed Jun 7, 2017
1 parent a545d98 commit e0fbb33
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.redhat.lightblue.metadata.MetadataConstants;
import com.redhat.lightblue.metadata.ObjectArrayElement;
import com.redhat.lightblue.metadata.ObjectField;
import com.redhat.lightblue.metadata.ReferenceField;
import com.redhat.lightblue.metadata.SimpleArrayElement;
import com.redhat.lightblue.metadata.SimpleField;
import com.redhat.lightblue.metadata.Type;
Expand Down Expand Up @@ -111,9 +110,6 @@ else if (fieldNode instanceof ObjectField) {
else if (fieldNode instanceof ArrayField) {
translate((ArrayField) fieldNode, cursor, target);
}
else if (fieldNode instanceof ReferenceField) {
translate((ReferenceField) fieldNode, node, target);
}
else{
throw Error.get(CrudConstants.ERR_UNSUPPORTED_FEATURE + fieldNode.getClass().getName(), fieldNode.getFullPath().toString());
}
Expand Down Expand Up @@ -177,10 +173,6 @@ protected void translate(final ObjectArrayElement objectArrayElement, JsonNode n
} while (cursor.nextSibling());
}

protected void translate(ReferenceField field, JsonNode node, Object target){
//Do nothing by default!
}

protected abstract void translate(SimpleField field, JsonNode node, Object target);

protected abstract void translate(ArrayField field, List<Object> items, Object target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.redhat.lightblue.metadata.FieldTreeNode;
import com.redhat.lightblue.metadata.ObjectArrayElement;
import com.redhat.lightblue.metadata.ObjectField;
import com.redhat.lightblue.metadata.ReferenceField;
import com.redhat.lightblue.metadata.SimpleArrayElement;
import com.redhat.lightblue.metadata.SimpleField;
import com.redhat.lightblue.metadata.Type;
Expand Down Expand Up @@ -114,9 +113,6 @@ else if((newValue = getValueFor(value, cursor.getCurrentPath())) != null){
else if (field instanceof ArrayField){
newJsonNode = translateToArrayNode((ArrayField) field, newValue, cursor);
}
else if (field instanceof ReferenceField) {
newJsonNode = translate((ReferenceField)field, newValue);
}
else{
throw new UnsupportedOperationException("Unknown Field type: " + field.getClass().getName());
}
Expand Down Expand Up @@ -195,7 +191,6 @@ else if (value.getClass().isArray()) {
}

protected abstract Object getValueFor(Object source, Path path);
protected abstract JsonNode translate(ReferenceField field, Object value);
protected abstract List<? extends Object> getSimpleArrayValues(Object value, SimpleArrayElement simpleArrayElement);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.redhat.lightblue.metadata.ArrayField;
import com.redhat.lightblue.metadata.EntityMetadata;
import com.redhat.lightblue.metadata.Field;
import com.redhat.lightblue.metadata.ObjectArrayElement;
import com.redhat.lightblue.metadata.ObjectField;
import com.redhat.lightblue.metadata.ReferenceField;
import com.redhat.lightblue.metadata.SimpleArrayElement;
import com.redhat.lightblue.metadata.SimpleField;
import com.redhat.lightblue.metadata.types.StringType;
Expand Down Expand Up @@ -182,11 +180,6 @@ public FakeTranslatorToJson(JsonNodeFactory factory, EntityMetadata entityMetada
super(factory, entityMetadata);
}

@Override
protected JsonNode translate(ReferenceField field, Object o) {
throw new RuntimeException("Method was not expected to be called");
}

@Override
protected List<? extends Object> getSimpleArrayValues(Object o, SimpleArrayElement simpleArrayElement) {
throw new RuntimeException("Method was not expected to be called");
Expand Down

0 comments on commit e0fbb33

Please sign in to comment.