-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
@ServiceId annotation currently supports only String as a return type.
I would be useful to support other types that can be represented as String such as URI or anything that implements CharSequence.
Current behavior:
@ServiceDefinition(quantifier = Quantifier.MULTIPLE)
public interface HashAlgorithm {
@ServiceId(pattern = ServiceId.SCREAMING_KEBAB_CASE)
String getName();
String hashToHex(byte[] input);
static void main(String[] args) {
HashAlgorithmLoader.load()
.stream()
.filter(algo -> algo.getName().equals("SHA-256"))
.findFirst()
.map(algo -> algo.hashToHex("hello".getBytes(UTF_8)))
.ifPresent(System.out::println);
}
}Expected possibility:
@ServiceDefinition(quantifier = Quantifier.MULTIPLE)
public interface HashAlgorithm {
@ServiceId(pattern = ServiceId.SCREAMING_KEBAB_CASE, formatMethodName = "toASCIIString")
URI getIdentifier();
String hashToHex(byte[] input);
static void main(String[] args) {
HashAlgorithmLoader.load()
.stream()
.filter(algo -> algo.getIdentifier().toASCIIString().equals("SHA-256"))
.findFirst()
.map(algo -> algo.hashToHex("hello".getBytes(UTF_8)))
.ifPresent(System.out::println);
}
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request