summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-08-09 10:07:36 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-08-17 10:18:19 +0000
commite9d3785d0603bf6e024affafc735641ee312b675 (patch)
tree6e3346b7628497743ebfc986952b15edb7cc8b04 /infra/translate-impl
parentd1b102f6fafced3c7badb09ecc78fec590704c8a (diff)
AbstractGenericWriter: remove xxxCurrent methods
Use xxxCurrentAttributes instead to simplify call graph. Change-Id: I8201b115354dddd35ca0b63b2c72dfb4eac93646 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/translate-impl')
-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 5121eb7..ff683b8 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()));
- }
}