当前位置: 首页>>代码示例>>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;未经允许,请勿转载。