本文整理汇总了Java中javax.enterprise.inject.Stereotype类的典型用法代码示例。如果您正苦于以下问题:Java Stereotype类的具体用法?Java Stereotype怎么用?Java Stereotype使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Stereotype类属于javax.enterprise.inject包,在下文中一共展示了Stereotype类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addViewMetaData
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
protected void addViewMetaData(Annotation currentAnnotation, List<Annotation> metaDataList)
{
Class<? extends Annotation> annotationClass = currentAnnotation.annotationType();
if (annotationClass.isAnnotationPresent(ViewMetaData.class))
{
metaDataList.add(currentAnnotation);
}
if (annotationClass.isAnnotationPresent(Stereotype.class))
{
for (Annotation inheritedViaStereotype : annotationClass.getAnnotations())
{
if (inheritedViaStereotype.annotationType().isAnnotationPresent(ViewMetaData.class))
{
metaDataList.add(inheritedViaStereotype);
}
}
}
}
示例2: findQualifiers
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
static Set<Annotation> findQualifiers(Set<Annotation> annotations) {
Set<Annotation> results = new LinkedHashSet<>();
for(Annotation annotation : annotations) {
Class<? extends Annotation> annotationClass = annotation.getClass();
if(annotation instanceof Default) {
continue;
} else if(annotationClass.getAnnotation(Qualifier.class) != null) {
results.add(annotation);
} else if(annotationClass.getAnnotation(Stereotype.class) != null) {
Set<Annotation> parentAnnotations = new LinkedHashSet<>(asList(annotationClass.getAnnotations()));
results.addAll(findQualifiers(parentAnnotations));
}
}
return results;
}
示例3: getStereotypes
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
@Override
public Set<Class<? extends Annotation>> getStereotypes() {
Set<Class<? extends Annotation>> stereotypes = new HashSet<>();
Arrays.stream(javaType.getAnnotations())
.map(a -> a.getClass())
.filter(a -> a.getAnnotation(Stereotype.class) != null)
.forEach(stereotypes::add);
return stereotypes;
}
示例4: isStereotype
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
public static boolean isStereotype(Class<? extends Annotation> candidate) {
for (Annotation annotation : candidate.getAnnotations()) {
if (annotation.annotationType().equals(Stereotype.class)) {
return true;
}
}
return false;
}
示例5: hasAnnotationInStereotypes
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
private static <T extends Annotation> T hasAnnotationInStereotypes(Annotation[] declaredAnnotations,
Class<T> expectedAnnotationType) {
for (Annotation declaredAnnotation : declaredAnnotations) {
Class<? extends Annotation> declaredAnnotationType = declaredAnnotation.annotationType();
if (declaredAnnotationType == expectedAnnotationType) {
return expectedAnnotationType.cast(declaredAnnotation);
} else if (declaredAnnotationType.isAnnotationPresent(Stereotype.class)) {
T ann = hasAnnotationInStereotypes(declaredAnnotationType.getAnnotations(), expectedAnnotationType);
if (ann != null) {
return expectedAnnotationType.cast(ann);
}
}
}
return null;
}
示例6: getStereotypes
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
@Override
public Set<Class<? extends Annotation>> getStereotypes() {
Set<Class<? extends Annotation>> stereotypes = new HashSet<>();
for (Annotation annotation : getQualifiers()) {
Class<? extends Annotation> annotationType = annotation.annotationType();
if (annotationType.isAnnotationPresent(Stereotype.class)) {
stereotypes.add(annotationType);
}
}
return stereotypes;
}
示例7: resolveSecurityBindingType
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
public static Annotation resolveSecurityBindingType(Annotation annotation)
{
List<Annotation> result = getAllAnnotations(annotation.annotationType().getAnnotations(),
new HashSet<Integer>());
for (Annotation foundAnnotation : result)
{
if (foundAnnotation.annotationType().isAnnotationPresent(SecurityBindingType.class))
{
return foundAnnotation;
}
}
throw new IllegalStateException(annotation.annotationType().getName() + " is a " + Stereotype.class.getName() +
" but it isn't annotated with " + SecurityBindingType.class.getName());
}
示例8: mergeMetaData
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
private List<Annotation> mergeMetaData(Set<Annotation> metaData, List<Annotation> inheritedMetaData)
{
//TODO add qualifier support
List<Annotation> nodeViewMetaData = new ArrayList<Annotation>();
List<Annotation> viewMetaDataFromStereotype = new ArrayList<Annotation>();
for (Annotation annotation : metaData)
{
if (annotation.annotationType().isAnnotationPresent(ViewMetaData.class))
{
nodeViewMetaData.add(annotation);
}
//TODO move to stereotype-util, improve it and merge it with DefaultViewConfigInheritanceStrategy
if (annotation.annotationType().isAnnotationPresent(Stereotype.class))
{
for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
{
if (metaAnnotation.annotationType().isAnnotationPresent(ViewMetaData.class))
{
viewMetaDataFromStereotype.add(metaAnnotation);
}
}
}
}
//merge meta-data of same level
List<Annotation> result = mergeAnnotationInstances(viewMetaDataFromStereotype, nodeViewMetaData);
if (inheritedMetaData != null && !inheritedMetaData.isEmpty())
{
//merge meta-data with levels above
result = mergeAnnotationInstances(inheritedMetaData, result);
}
return result;
}
示例9: getStereotypes
import javax.enterprise.inject.Stereotype; //导入依赖的package包/类
public Set<Class<? extends Annotation>> getStereotypes() {
return Stream.of(repositoryType.getAnnotations())
.map(a -> a.annotationType())
.filter(a -> a.isAnnotationPresent(Stereotype.class))
.collect(Collectors.toSet());
}