All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tracee.contextlogger.builder.gson.MethodAnnotationPair Maven / Gradle / Ivy

The newest version!
package io.tracee.contextlogger.builder.gson;

import io.tracee.contextlogger.api.TraceeContextLogProviderMethod;
import io.tracee.contextlogger.profile.ProfileSettings;

import java.lang.reflect.Method;

/**
 * Wrapper class for methods and their {@link io.tracee.contextlogger.api.TraceeContextLogProviderMethod} annotations.
 * Used for sorting (by {@link io.tracee.contextlogger.builder.gson.MethodAnnotationPairComparator}) and other tasks.
 * 

* Created by Tobias Gindler, holisticon AG on 14.03.14. */ public class MethodAnnotationPair { private final TraceeContextLogProviderMethod annotation; private final Method method; public MethodAnnotationPair(final Method method, final TraceeContextLogProviderMethod annotation) { this.method = method; this.annotation = annotation; } /** * Determines if a method should be processed. This will either be if no * {@link io.tracee.contextlogger.api.TraceeContextLogProviderMethod} annotation * is present or if an empty property name is defined in the annotation or if passed profileSettings are null * or if the property name is disabled in the {@link io.tracee.contextlogger.profile.ProfileSettings}. * * @param profileSettings The profile sttings object which should be used to check against. * @return true if the result of the method should be processed, otherwise false. */ public boolean shouldBeProcessed(final ProfileSettings profileSettings) { return annotation == null || annotation.propertyName().isEmpty() || profileSettings == null || profileSettings.getPropertyValue(annotation.propertyName()); } public TraceeContextLogProviderMethod getAnnotation() { return annotation; } public final Method getMethod() { return method; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy