Closed pragnagopa closed 5 years ago
Looks great - would be curious to know if IDEs will throw a fit if you have a custom attribute and additional properties like hubname = "mySignalRHub"
that aren't explicitly defined in the interface.
To add additional properties, users need to define an annotation as there annotations cannot be inherited. Will provide code samples on how to add additional properties.
@jeffhollan - Here is the example code for defining additional properties:
package com.microsoft.azure.functions.worker.broker.tests;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;
import com.microsoft.azure.functions.annotation.CustomBinding;
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@CustomBinding(direction = "in", name = "message", type = "customBinding")
public @interface TestCustomBinding {
String index();
String path();
}
public void CustomBinding_Valid(@HttpTrigger(name = "req", methods = { HttpMethod.GET,
HttpMethod.POST }, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage<String> request,
@TestCustomBinding(index = "testIndex", path = "testPath") String customInput) {
}
Users have to define an annotation. Does this look ok?
Sample code to use CustomBinding annotation
Fixes #75