// We can't instantiate class with wildcard generic parameter directly, so we delegate it through parameter <T>
static <T> DronePoint<T> createInjectionPoint(DroneContext context, Class<T> droneType,
Annotation[] annotations,
DronePoint.Lifecycle defaultLifecycle) {
Class<? extends Annotation> scopeAnnotation = SecurityActions.getScope(annotations);
OperateOnDeployment operateOnDeployment = SecurityActions.findAnnotation(annotations,
OperateOnDeployment.class);
DronePoint.Lifecycle lifecycle = scopeForAnnotation(scopeAnnotation, operateOnDeployment, defaultLifecycle);
DronePoint<T> dronePoint = new DronePointImpl<T>(droneType, lifecycle, annotations);
// We register the drone point into context immediately
context.get(dronePoint);
if (lifecycle == DronePoint.Lifecycle.DEPLOYMENT) {
String deployment = operateOnDeployment.value();
context.get(dronePoint).setMetadata(DeploymentNameKey.class, deployment);
}
return dronePoint;
}