-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util-registry: Java-friendly API for Registry
Problem There is no Java-friendly API for `Registry.put`. The only way to put a value into a registry from Java is to use the following pattern. Solution Use `@varargs` annotation to provide a Java-friendly version of `put`. RB_ID=749845
- Loading branch information
1 parent
296e104
commit dad58d8
Showing
5 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
junit_tests(name='java', | ||
dependencies=[ | ||
'3rdparty/jvm/org/scala-lang:scala-library', | ||
'3rdparty/jvm/junit', | ||
'util/util-registry/src/main/scala', | ||
], | ||
sources=rglobs('*.java') | ||
) |
16 changes: 16 additions & 0 deletions
16
util-registry/src/test/java/com/twitter/util/registry/RegistryCompilationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.twitter.util.registry; | ||
|
||
import com.twitter.util.registry.GlobalRegistry; | ||
import com.twitter.util.registry.Registry; | ||
import org.junit.Test; | ||
|
||
public class RegistryCompilationTest { | ||
|
||
@Test | ||
public void testPut() { | ||
Registry registry = GlobalRegistry.get(); | ||
registry.put("foo", "bar", "baz"); | ||
registry.put("foo", "qux"); | ||
registry.put("baz"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters