Committed by
Gerrit Code Review
Change IntentUpdate and CompletedIntentUpdate to be interface
Instead of abstract class, defined as interface by using default method Change-Id: I23135da32db3e1bf3b161edca4db8a61f392eb78
Showing
1 changed file
with
25 additions
and
25 deletions
| ... | @@ -483,7 +483,7 @@ public class IntentManager | ... | @@ -483,7 +483,7 @@ public class IntentManager |
| 483 | } | 483 | } |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | - private abstract class IntentUpdate { | 486 | + private interface IntentUpdate { |
| 487 | 487 | ||
| 488 | /** | 488 | /** |
| 489 | * Execute the procedure represented by the instance | 489 | * Execute the procedure represented by the instance |
| ... | @@ -491,7 +491,7 @@ public class IntentManager | ... | @@ -491,7 +491,7 @@ public class IntentManager |
| 491 | * | 491 | * |
| 492 | * @return next update | 492 | * @return next update |
| 493 | */ | 493 | */ |
| 494 | - public Optional<IntentUpdate> execute() { | 494 | + default Optional<IntentUpdate> execute() { |
| 495 | return Optional.empty(); | 495 | return Optional.empty(); |
| 496 | } | 496 | } |
| 497 | 497 | ||
| ... | @@ -500,28 +500,28 @@ public class IntentManager | ... | @@ -500,28 +500,28 @@ public class IntentManager |
| 500 | * | 500 | * |
| 501 | * @param batchWrite batchWrite | 501 | * @param batchWrite batchWrite |
| 502 | */ | 502 | */ |
| 503 | - public void writeBeforeExecution(BatchWrite batchWrite) {} | 503 | + default void writeBeforeExecution(BatchWrite batchWrite) {} |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | - private abstract class CompletedIntentUpdate extends IntentUpdate { | 506 | + private interface CompletedIntentUpdate extends IntentUpdate { |
| 507 | 507 | ||
| 508 | /** | 508 | /** |
| 509 | * Write data to the specified BatchWrite after execution() is called. | 509 | * Write data to the specified BatchWrite after execution() is called. |
| 510 | * | 510 | * |
| 511 | * @param batchWrite batchWrite | 511 | * @param batchWrite batchWrite |
| 512 | */ | 512 | */ |
| 513 | - public void writeAfterExecution(BatchWrite batchWrite) {} | 513 | + default void writeAfterExecution(BatchWrite batchWrite) {} |
| 514 | 514 | ||
| 515 | - public void batchSuccess() {} | 515 | + default void batchSuccess() {} |
| 516 | 516 | ||
| 517 | - public void batchFailed() {} | 517 | + default void batchFailed() {} |
| 518 | 518 | ||
| 519 | /** | 519 | /** |
| 520 | * Returns the current FlowRuleBatchOperation. | 520 | * Returns the current FlowRuleBatchOperation. |
| 521 | * | 521 | * |
| 522 | * @return current FlowRuleBatchOperation | 522 | * @return current FlowRuleBatchOperation |
| 523 | */ | 523 | */ |
| 524 | - public FlowRuleBatchOperation currentBatch() { | 524 | + default FlowRuleBatchOperation currentBatch() { |
| 525 | return null; | 525 | return null; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| ... | @@ -530,12 +530,12 @@ public class IntentManager | ... | @@ -530,12 +530,12 @@ public class IntentManager |
| 530 | * | 530 | * |
| 531 | * @return all of installable intents | 531 | * @return all of installable intents |
| 532 | */ | 532 | */ |
| 533 | - public List<Intent> allInstallables() { | 533 | + default List<Intent> allInstallables() { |
| 534 | return Collections.emptyList(); | 534 | return Collections.emptyList(); |
| 535 | } | 535 | } |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | - private class InstallRequest extends IntentUpdate { | 538 | + private class InstallRequest implements IntentUpdate { |
| 539 | 539 | ||
| 540 | private final Intent intent; | 540 | private final Intent intent; |
| 541 | 541 | ||
| ... | @@ -556,7 +556,7 @@ public class IntentManager | ... | @@ -556,7 +556,7 @@ public class IntentManager |
| 556 | } | 556 | } |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | - private class WithdrawRequest extends IntentUpdate { | 559 | + private class WithdrawRequest implements IntentUpdate { |
| 560 | 560 | ||
| 561 | private final Intent intent; | 561 | private final Intent intent; |
| 562 | private final List<Intent> installables; | 562 | private final List<Intent> installables; |
| ... | @@ -577,7 +577,7 @@ public class IntentManager | ... | @@ -577,7 +577,7 @@ public class IntentManager |
| 577 | } | 577 | } |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | - private class ReplaceRequest extends IntentUpdate { | 580 | + private class ReplaceRequest implements IntentUpdate { |
| 581 | 581 | ||
| 582 | private final Intent newIntent; | 582 | private final Intent newIntent; |
| 583 | private final Intent oldIntent; | 583 | private final Intent oldIntent; |
| ... | @@ -611,11 +611,11 @@ public class IntentManager | ... | @@ -611,11 +611,11 @@ public class IntentManager |
| 611 | } | 611 | } |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | - private class DoNothing extends CompletedIntentUpdate { | 614 | + private class DoNothing implements CompletedIntentUpdate { |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | // TODO: better naming | 617 | // TODO: better naming |
| 618 | - private class WithdrawStateChange1 extends CompletedIntentUpdate { | 618 | + private class WithdrawStateChange1 implements CompletedIntentUpdate { |
| 619 | 619 | ||
| 620 | private final Intent intent; | 620 | private final Intent intent; |
| 621 | 621 | ||
| ... | @@ -637,7 +637,7 @@ public class IntentManager | ... | @@ -637,7 +637,7 @@ public class IntentManager |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | // TODO: better naming | 639 | // TODO: better naming |
| 640 | - private class WithdrawStateChange2 extends CompletedIntentUpdate { | 640 | + private class WithdrawStateChange2 implements CompletedIntentUpdate { |
| 641 | 641 | ||
| 642 | private final Intent intent; | 642 | private final Intent intent; |
| 643 | 643 | ||
| ... | @@ -660,7 +660,7 @@ public class IntentManager | ... | @@ -660,7 +660,7 @@ public class IntentManager |
| 660 | } | 660 | } |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | - private class Compiling extends IntentUpdate { | 663 | + private class Compiling implements IntentUpdate { |
| 664 | 664 | ||
| 665 | private final Intent intent; | 665 | private final Intent intent; |
| 666 | 666 | ||
| ... | @@ -684,7 +684,7 @@ public class IntentManager | ... | @@ -684,7 +684,7 @@ public class IntentManager |
| 684 | } | 684 | } |
| 685 | 685 | ||
| 686 | // TODO: better naming because install() method actually generate FlowRuleBatchOperations | 686 | // TODO: better naming because install() method actually generate FlowRuleBatchOperations |
| 687 | - private class Installing extends IntentUpdate { | 687 | + private class Installing implements IntentUpdate { |
| 688 | 688 | ||
| 689 | private final Intent intent; | 689 | private final Intent intent; |
| 690 | private final List<Intent> installables; | 690 | private final List<Intent> installables; |
| ... | @@ -721,7 +721,7 @@ public class IntentManager | ... | @@ -721,7 +721,7 @@ public class IntentManager |
| 721 | } | 721 | } |
| 722 | } | 722 | } |
| 723 | 723 | ||
| 724 | - private class Withdrawing extends IntentUpdate { | 724 | + private class Withdrawing implements IntentUpdate { |
| 725 | 725 | ||
| 726 | private final Intent intent; | 726 | private final Intent intent; |
| 727 | private final List<Intent> installables; | 727 | private final List<Intent> installables; |
| ... | @@ -739,7 +739,7 @@ public class IntentManager | ... | @@ -739,7 +739,7 @@ public class IntentManager |
| 739 | } | 739 | } |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | - private class Replacing extends IntentUpdate { | 742 | + private class Replacing implements IntentUpdate { |
| 743 | 743 | ||
| 744 | private final Intent newIntent; | 744 | private final Intent newIntent; |
| 745 | private final Intent oldIntent; | 745 | private final Intent oldIntent; |
| ... | @@ -799,7 +799,7 @@ public class IntentManager | ... | @@ -799,7 +799,7 @@ public class IntentManager |
| 799 | } | 799 | } |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | - private class Installed extends CompletedIntentUpdate { | 802 | + private class Installed implements CompletedIntentUpdate { |
| 803 | 803 | ||
| 804 | private final Intent intent; | 804 | private final Intent intent; |
| 805 | private final List<Intent> installables; | 805 | private final List<Intent> installables; |
| ... | @@ -859,7 +859,7 @@ public class IntentManager | ... | @@ -859,7 +859,7 @@ public class IntentManager |
| 859 | } | 859 | } |
| 860 | } | 860 | } |
| 861 | 861 | ||
| 862 | - private class Withdrawn extends CompletedIntentUpdate { | 862 | + private class Withdrawn implements CompletedIntentUpdate { |
| 863 | 863 | ||
| 864 | private final Intent intent; | 864 | private final Intent intent; |
| 865 | private final List<Intent> installables; | 865 | private final List<Intent> installables; |
| ... | @@ -906,7 +906,7 @@ public class IntentManager | ... | @@ -906,7 +906,7 @@ public class IntentManager |
| 906 | } | 906 | } |
| 907 | } | 907 | } |
| 908 | 908 | ||
| 909 | - private class Replaced extends CompletedIntentUpdate { | 909 | + private class Replaced implements CompletedIntentUpdate { |
| 910 | 910 | ||
| 911 | private final Intent newIntent; | 911 | private final Intent newIntent; |
| 912 | private final Intent oldIntent; | 912 | private final Intent oldIntent; |
| ... | @@ -971,7 +971,7 @@ public class IntentManager | ... | @@ -971,7 +971,7 @@ public class IntentManager |
| 971 | } | 971 | } |
| 972 | } | 972 | } |
| 973 | 973 | ||
| 974 | - private class CompilingFailed extends CompletedIntentUpdate { | 974 | + private class CompilingFailed implements CompletedIntentUpdate { |
| 975 | 975 | ||
| 976 | private final Intent intent; | 976 | private final Intent intent; |
| 977 | private final IntentException exception; | 977 | private final IntentException exception; |
| ... | @@ -999,7 +999,7 @@ public class IntentManager | ... | @@ -999,7 +999,7 @@ public class IntentManager |
| 999 | } | 999 | } |
| 1000 | } | 1000 | } |
| 1001 | 1001 | ||
| 1002 | - private class InstallingFailed extends CompletedIntentUpdate { | 1002 | + private class InstallingFailed implements CompletedIntentUpdate { |
| 1003 | 1003 | ||
| 1004 | private final Intent intent; | 1004 | private final Intent intent; |
| 1005 | private final List<Intent> installables; | 1005 | private final List<Intent> installables; |
| ... | @@ -1046,7 +1046,7 @@ public class IntentManager | ... | @@ -1046,7 +1046,7 @@ public class IntentManager |
| 1046 | } | 1046 | } |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | - private class ReplacingFailed extends CompletedIntentUpdate { | 1049 | + private class ReplacingFailed implements CompletedIntentUpdate { |
| 1050 | 1050 | ||
| 1051 | private final Intent newIntent; | 1051 | private final Intent newIntent; |
| 1052 | private final Intent oldIntent; | 1052 | private final Intent oldIntent; | ... | ... |
-
Please register or login to post a comment