當前位置: 首頁>>代碼示例>>Java>>正文


Java Nonbinding類代碼示例

本文整理匯總了Java中javax.enterprise.util.Nonbinding的典型用法代碼示例。如果您正苦於以下問題:Java Nonbinding類的具體用法?Java Nonbinding怎麽用?Java Nonbinding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Nonbinding類屬於javax.enterprise.util包,在下文中一共展示了Nonbinding類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAnnotationId

import javax.enterprise.util.Nonbinding; //導入依賴的package包/類
/**
 * Generates a unique signature for an {@link Annotation}.
 */
static String createAnnotationId(Annotation annotation) {
    Method[] methods = doPrivileged(
        (PrivilegedAction<Method[]>) () -> annotation.annotationType().getDeclaredMethods());

    return Stream.of(methods)
        .filter(method -> !method.isAnnotationPresent(Nonbinding.class))
        .sorted(comparing(Method::getName))
        .collect(() -> new StringJoiner(",", "@" + annotation.annotationType().getCanonicalName() + "(", ")"),
            (joiner, method) -> {
                try {
                    joiner.add(method.getName() + "=" + method.invoke(annotation).toString());
                } catch (NullPointerException | IllegalArgumentException | IllegalAccessException | InvocationTargetException cause) {
                    throw new RuntimeException(
                        "Error while accessing member [" + method.getName() + "]"
                            + " of annotation [" + annotation.annotationType().getName() + "]", cause);
                }
            },
            StringJoiner::merge)
        .toString();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:24,代碼來源:CdiSpiHelper.java

示例2: matchBindingTypeMembers

import javax.enterprise.util.Nonbinding; //導入依賴的package包/類
public static boolean matchBindingTypeMembers(Annotation beanAnnotation, Map<String, Object> beanAnnotationAttributes, Map<String, Object> interceptorAttributes) {
    for (Method method : beanAnnotation.annotationType().getDeclaredMethods()) {
        if (method.isAnnotationPresent(Nonbinding.class)) {
            beanAnnotationAttributes.remove(method.getName());
            interceptorAttributes.remove(method.getName());
        }
    }
    if (beanAnnotationAttributes.values().size() == interceptorAttributes.values().size()) {
        for (String key : beanAnnotationAttributes.keySet()) {
            if (!beanAnnotationAttributes.get(key).equals(interceptorAttributes.get(key)))
                return false;
        }
    } else {
        return false;
    }
    return true;
}
 
開發者ID:thma,項目名稱:fmek,代碼行數:18,代碼來源:InterceptorInfoVisitor.java

示例3: createAnnotationId

import javax.enterprise.util.Nonbinding; //導入依賴的package包/類
/**
 * Generates a unique signature for an {@link Annotation}.
 */
static String createAnnotationId(Annotation annotation) {
    Method[] methods = doPrivileged(
        (PrivilegedAction<Method[]>) () -> annotation.annotationType().getDeclaredMethods());

    return Stream.of(methods)
        .filter(method -> !method.isAnnotationPresent(Nonbinding.class))
        .sorted(comparing(Method::getName))
        .collect(() -> new StringJoiner(",", "@" + annotation.annotationType().getCanonicalName() + "(", ")"),
            (joiner, method) -> {
                try {
                    joiner.add(method.getName() + "=" + method.invoke(annotation).toString());
                } catch (NullPointerException | IllegalArgumentException | IllegalAccessException | InvocationTargetException cause) {
                    throw new RuntimeException(
                        "Error while accessing member [" + method.getName() + "]"
                        + " of annotation [" + annotation.annotationType().getName() + "]", cause);
                }
            },
            StringJoiner::merge)
        .toString();
}
 
開發者ID:astefanutti,項目名稱:camel-cdi,代碼行數:24,代碼來源:CdiSpiHelper.java

示例4: doesQualifierMatch

import javax.enterprise.util.Nonbinding; //導入依賴的package包/類
private boolean doesQualifierMatch(Annotation currentQualifier, Annotation qualifierConfiguredBean)
{
    if (!currentQualifier.annotationType().equals(qualifierConfiguredBean.annotationType()))
    {
        return false;
    }

    Object currentValue;
    Object valueOfQualifierConfiguredBean;
    for (Method currentMethod : currentQualifier.annotationType().getDeclaredMethods())
    {
        if (currentMethod.isAnnotationPresent(Nonbinding.class))
        {
            continue;
        }

        try
        {
            currentMethod.setAccessible(true);
            currentValue = currentMethod.invoke(currentQualifier);
            valueOfQualifierConfiguredBean = currentMethod.invoke(qualifierConfiguredBean);

            if (!currentValue.equals(valueOfQualifierConfiguredBean))
            {
                return false;
            }
        }
        catch (Exception e)
        {
            throw new IllegalStateException("Can't compare " + currentQualifier.annotationType().getName() +
                " with " + qualifierConfiguredBean.annotationType().getName(), e);
        }
    }
    return true;
}
 
開發者ID:apache,項目名稱:deltaspike,代碼行數:36,代碼來源:ExcludeExtension.java

示例5: getQualifierHashCode

import javax.enterprise.util.Nonbinding; //導入依賴的package包/類
public static int getQualifierHashCode(Annotation annotation)
{
    Class annotationClass = annotation.annotationType();

    int hashCode = getTypeHashCode(annotationClass);

    for (Method member : annotationClass.getDeclaredMethods())
    {
        if (member.isAnnotationPresent(Nonbinding.class))
        {
            continue;
        }

        final Object annotationMemberValue = ReflectionUtils.invokeMethod(annotation, member, Object.class, true);

        final int arrayValue;
        if (annotationMemberValue == null /*possible with literals*/)
        {
            arrayValue = 0;
        }
        else if (annotationMemberValue.getClass().isArray())
        {
            Class<?> annotationMemberType = annotationMemberValue.getClass().getComponentType();
            if (annotationMemberType.isPrimitive())
            {
                if (Long.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((long[]) annotationMemberValue);
                }
                else if (Integer.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((int[]) annotationMemberValue);
                }
                else if (Short.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((short[]) annotationMemberValue);
                }
                else if (Double.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((double[]) annotationMemberValue);
                }
                else if (Float.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((float[]) annotationMemberValue);
                }
                else if (Boolean.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((boolean[]) annotationMemberValue);
                }
                else if (Byte.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((byte[]) annotationMemberValue);
                }
                else if (Character.TYPE == annotationMemberType)
                {
                    arrayValue = Arrays.hashCode((char[]) annotationMemberValue);
                }
                else
                {
                    arrayValue = 0;
                }
            }
            else
            {
                arrayValue = Arrays.hashCode((Object[]) annotationMemberValue);
            }
        }
        else
        {
            arrayValue = annotationMemberValue.hashCode();
        }

        hashCode = 29 * hashCode + arrayValue;
        hashCode = 29 * hashCode + member.getName().hashCode();
    }

    return hashCode;
}
 
開發者ID:apache,項目名稱:deltaspike,代碼行數:79,代碼來源:AnnotationUtils.java


注:本文中的javax.enterprise.util.Nonbinding類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。