Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.batchoperation; |
| 2 | |
| 3 | public class TestBatchOperation extends |
| 4 | BatchOperation<BatchOperationEntry<TestBatchOperation.Operator, ?>> { |
| 5 | |
| 6 | public enum Operator { |
| 7 | STRING, |
| 8 | INTEGER, |
| 9 | } |
| 10 | |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 11 | public static class StringTarget implements BatchOperationTarget { |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 12 | private String string; |
| 13 | |
| 14 | public StringTarget(String string) { |
| 15 | this.string = string; |
| 16 | } |
| 17 | |
| 18 | public String getString() { |
| 19 | return string; |
| 20 | } |
| 21 | } |
| 22 | |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 23 | public static class IntegerTarget implements BatchOperationTarget { |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 24 | private Integer integer; |
| 25 | |
| 26 | public IntegerTarget(Integer integer) { |
| 27 | this.integer = integer; |
| 28 | } |
| 29 | |
| 30 | public Integer getInteger() { |
| 31 | return integer; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | public TestBatchOperation addStringOperation(String string) { |
| 36 | return (super.addOperation(new BatchOperationEntry<Operator, StringTarget>( |
| 37 | Operator.STRING, new StringTarget(string))) == null) |
| 38 | ? null : this; |
| 39 | } |
| 40 | |
| 41 | public TestBatchOperation addIntegerOperation(Integer integer) { |
| 42 | return (super.addOperation(new BatchOperationEntry<Operator, IntegerTarget>( |
| 43 | Operator.INTEGER, new IntegerTarget(integer))) == null) |
| 44 | ? null : this; |
| 45 | } |
| 46 | } |