summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl/src
diff options
context:
space:
mode:
Diffstat (limited to 'infra/translate-impl/src')
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java31
1 files changed, 5 insertions, 26 deletions
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
index 5121eb793..ff683b810 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
@@ -85,30 +85,14 @@ public final class GenericListWriter<D extends DataObject & Identifiable<K>, K e
}
@Override
- protected void writeCurrent(final InstanceIdentifier<D> id, final D data, final WriteContext ctx)
- throws WriteFailedException {
- super.writeCurrent(getManagedId(id, data), data, ctx);
- }
-
- @Override
- protected void updateCurrent(final InstanceIdentifier<D> id, final D dataBefore, final D dataAfter,
- final WriteContext ctx) throws WriteFailedException {
- super.updateCurrent(getManagedId(id, dataBefore), dataBefore, dataAfter, ctx);
- }
-
- @Override
- protected void deleteCurrent(final InstanceIdentifier<D> id, final D dataBefore, final WriteContext ctx)
- throws WriteFailedException {
- super.deleteCurrent(getManagedId(id, dataBefore), dataBefore, ctx);
- }
-
- @Override
- protected InstanceIdentifier<D> getManagedId(@Nonnull final InstanceIdentifier<? extends DataObject> currentId,
- @Nonnull final D current) {
+ @SuppressWarnings("unchecked")
+ protected InstanceIdentifier<D> getSpecificId(@Nonnull final InstanceIdentifier<? extends DataObject> currentId,
+ @Nonnull final D current) {
final InstanceIdentifier<D> id = (InstanceIdentifier<D>) currentId;
// Make sure the key is present
if (isWildcarded(id)) {
- return getSpecificId(id, current);
+ return RWUtils.replaceLastInId(id,
+ new InstanceIdentifier.IdentifiableItem<>(id.getTargetType(), current.getKey()));
} else {
return id;
}
@@ -117,9 +101,4 @@ public final class GenericListWriter<D extends DataObject & Identifiable<K>, K e
private boolean isWildcarded(final InstanceIdentifier<D> id) {
return id.firstIdentifierOf(getManagedDataObjectType().getTargetType()).isWildcarded();
}
-
- private InstanceIdentifier<D> getSpecificId(final InstanceIdentifier<D> currentId, final D current) {
- return RWUtils.replaceLastInId(currentId,
- new InstanceIdentifier.IdentifiableItem<>(currentId.getTargetType(), current.getKey()));
- }
}