/** * Returns the {@link Gauge} matching the criteria from the injection point. * * @param <T> type of the {@code Gauge} * @param registry metric registry * @param ip injection point being resolved * @return requested gauge */ @Produces @VendorDefined @SuppressWarnings("unchecked") private <T> Gauge<T> produceGauge(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return (Gauge<T>) registry.getGauges().entrySet().stream() .filter(entry -> entry.getKey().equals(metric.name())) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Could not produce Gauge for injection point " + ip.toString())) .getValue(); }
protected String getResourceName(InjectionPoint injectionPoint) { Resource resource = getResourceAnnotated(injectionPoint).getAnnotation(Resource.class); String mappedName = resource.mappedName(); String lookup = resource.lookup(); if (!lookup.isEmpty()) { return lookup; } if (!mappedName.isEmpty()) { return mappedName; } String proposedName = ResourceInjectionUtilities.getResourceName(injectionPoint); return getEJBResourceName(injectionPoint, proposedName); }
@Produces @VendorDefined private Timer produceTimer(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.timer(newMetadata(ip, metric, MetricType.TIMER)); }
@Produces @VendorDefined private Histogram produceHistogram(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.histogram(newMetadata(ip, metric, MetricType.HISTOGRAM)); }
@Produces @VendorDefined private Meter produceMeter(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.meter(newMetadata(ip, metric, MetricType.METERED)); }
@Produces @VendorDefined private Counter produceCounter(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.counter(newMetadata(ip, metric, MetricType.COUNTER)); }
public static String getResourceName(InjectionPoint injectionPoint) { Resource resource = getResourceAnnotated(injectionPoint).getAnnotation(Resource.class); String mappedName = resource.mappedName(); if (!mappedName.equals("")) {
ConfigProperty configProperty = pip.getInjectionPoint().getAnnotated().getAnnotation(ConfigProperty.class); if (configProperty != null) { InjectionPoint ip = pip.getInjectionPoint();
Claim claim = pip.getInjectionPoint().getAnnotated().getAnnotation(Claim.class); if (claim != null) { if ((claim.standard() != Claims.UNKNOWN) && !claim.value().isEmpty()) {
protected String getVariableLocalTypedName(InjectionPoint ip) { String variableName = ip.getAnnotated().getAnnotation(ProcessVariableLocalTyped.class).value(); if (variableName.length() == 0) { variableName = ip.getMember().getName(); } return variableName; }
protected String getVariableTypedName(InjectionPoint ip) { String variableName = ip.getAnnotated().getAnnotation(ProcessVariableTyped.class).value(); if (variableName.length() == 0) { variableName = ip.getMember().getName(); } return variableName; }
protected String getVariableName(InjectionPoint ip) { String variableName = ip.getAnnotated().getAnnotation(ProcessVariable.class).value(); if (variableName.length() == 0) { variableName = ip.getMember().getName(); } return variableName; }
protected String getVariableLocalName(InjectionPoint ip) { String variableName = ip.getAnnotated().getAnnotation(ProcessVariableLocal.class).value(); if (variableName.length() == 0) { variableName = ip.getMember().getName(); } return variableName; }
@Produces @ProcessEngineName("") public ProcessEngine processEngine(InjectionPoint ip) { ProcessEngineName annotation = ip.getAnnotated().getAnnotation(ProcessEngineName.class); String processEngineName = annotation.value(); if(processEngineName == null || processEngineName.length() == 0) { throw new ProcessEngineException("Cannot determine which process engine to inject: @ProcessEngineName must specify the name of a process engine."); } try { ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService(); return processEngineService.getProcessEngine(processEngineName); }catch (Exception e) { throw new ProcessEngineException("Cannot find process engine named '"+processEngineName+"' specified using @ProcessEngineName: "+e.getMessage(), e); } }
publi class MyAnnotationIntrospector extends JacksonAnnotationIntrospector { @Override protected boolean _isIgnorable(Annotated a) { boolean isIgnorable = super._isIgnorable(a); if (!isIgnorable) { SomeAnnotation ann = a.getAnnotation(SomeAnnotation.class); isIgnorable = ann != null; } return isIgnorable; } }
public Class<?>[] extractInterceptorClasses(Annotated annotated) { Annotation annotation = annotated.getAnnotation(INTERCEPTORS_ANNOTATION_CLASS); if (annotation != null) { try { return (Class<?>[]) interceptorsValueMethod.invoke(annotation); } catch (Exception e) { throw UtilLogger.LOG.annotationValuesInaccessible(e); } } return null; }
public Class<?>[] extractInterceptorClasses(Annotated annotated) { Annotation annotation = annotated.getAnnotation(INTERCEPTORS_ANNOTATION_CLASS); if (annotation != null) { try { return (Class<?>[]) interceptorsValueMethod.invoke(annotation); } catch (Exception e) { throw UtilLogger.LOG.annotationValuesInaccessible(e); } } return null; }
public Class<?>[] extractInterceptorClasses(Annotated annotated) { Annotation annotation = annotated.getAnnotation(INTERCEPTORS_ANNOTATION_CLASS); if (annotation != null) { try { return (Class<?>[]) interceptorsValueMethod.invoke(annotation); } catch (Exception e) { throw UtilLogger.LOG.annotationValuesInaccessible(e); } } return null; }
protected Resource getResourceAnnotation(InjectionPoint injectionPoint) { Annotated annotated = injectionPoint.getAnnotated(); if (annotated instanceof AnnotatedParameter<?>) { annotated = ((AnnotatedParameter<?>) annotated).getDeclaringCallable(); } return annotated.getAnnotation(Resource.class); }
@Produces @ApimanLogger public static IApimanLogger provideLogger(ManagerApiMicroServiceConfig config, InjectionPoint injectionPoint) { try { ApimanLogger logger = injectionPoint.getAnnotated().getAnnotation(ApimanLogger.class); Class<?> klazz = logger.value(); return getDelegate(config).newInstance().createLogger(klazz); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(String.format( Messages.i18n.format("LoggerFactory.InstantiationFailed")), e); //$NON-NLS-1$ } }