Java 8 Executable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Executable class.

This code example shows how to use the following methods:getParameters, getParameterAnnotations
 */ 
public class JerseyParameterNameProvider extends ReflectionParameterNameProvider {
 
    @Override 
    public List<String> getParameterNames(Method method) {
        Parameter[] parameters = method.getParameters();
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        List<String> names = new ArrayList<>(parameterAnnotations.length);
        for (int i = 0; i < parameterAnnotations.length; i++) {
            Annotation[] annotations = parameterAnnotations[i];
            String name = getParameterNameFromAnnotations(annotations).orElse(parameters[i].getName());
            names.add(name);
        } 
        return names;
    } 
 
    /** 
     * Derives member's name and type from it's annotations 
     */ 
    public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) {
5
CodeRank
This code example shows how to use the following methods:hashCode
 
    @Override 
    public int hashCode() { 
        final int prime = 31;
        int result = 1;
        result = prime * result + ((executable == null) ? 0 : executable.hashCode());
        return result;
    } 
 
    @Override 
    public boolean equals(Object obj) { 
        if (this == obj) {
            return true; 
        } 
        if (obj == null) { 
            return false; 
        } 
        if (getClass() != obj.getClass()) {
            return false; 
        } 
5
CodeRank
This code example shows how to use the following methods:getParameters
                Member member = injectionPoint.getMember();
                if (member instanceof Executable) {
                    // Method or constructor injection 
                    Executable executable = (Executable) member;
                    AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) injectionPoint.getAnnotated();
                    Parameter parameter = executable.getParameters()[annotatedParameter.getPosition()];
                    named = new NamedLiteral(parameter.getName());
                } else { 
                    named = new NamedLiteral(injectionPoint.getMember().getName());
                } 
 
                qualifierInstance = QualifierInstance.of(named, store);
                qualifiers.add(named);
                qualifierInstances.add(qualifierInstance);
                mappedQualifiers.put(Named.class, named);
            } 
        } 
        setDeclaringBean(injectionPoint.getBean());
        this.delegate = injectionPoint.isDelegate();
    } 
5
CodeRank
See Code Examples for Java 8 Executable Methods: