use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry.Property in project azure-maven-plugins by microsoft.
the class AzureTelemeter method getParameterProperties.
private static Map<String, String> getParameterProperties(AzureOperationRef ref) {
final HashMap<String, String> properties = new HashMap<>();
final Object[] paramValues = ref.getParamValues();
final Parameter[] parameters = ref.getMethod().getParameters();
for (int i = 0; i < parameters.length; i++) {
final Parameter param = parameters[i];
final Object value = paramValues[i];
Optional.ofNullable(param.getAnnotation(Property.class)).map(Property::value).map(n -> Property.PARAM_NAME.equals(n) ? param.getName() : n).ifPresent((name) -> properties.put(name, Optional.ofNullable(value).map(Object::toString).orElse("")));
Optional.ofNullable(param.getAnnotation(Properties.class)).map(Properties::value).map(AzureTelemeter::instantiate).map(converter -> converter.convert(value)).ifPresent(properties::putAll);
}
return properties;
}
Aggregations