Refine search
@SuppressWarnings("unchecked") public static <T> Set<T> copyOf(Iterable<? extends T> iterable) { Preconditions.checkNotNull(iterable); if (iterable instanceof AbstractImmutableSet<?>) { return (Set<T>) iterable; } if (!iterable.iterator().hasNext()) { return Collections.emptySet(); } return ImmutableSet.<T> builder().addAll(iterable).build(); }
/** * * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ static Set<Type> getLegalBeanTypes(Set<Type> types, EnhancedAnnotated<?, ?> annotated, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, annotated).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, annotated).build(); } } return types; }
/** * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ public static Set<Type> getLegalBeanTypes(Set<Type> types, Object baseType, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, baseType).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, baseType).build(); } } return types; }
/** * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ public static Set<Type> getLegalBeanTypes(Set<Type> types, Object baseType, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, baseType).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, baseType).build(); } } return types; }
/** * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ public static Set<Type> getLegalBeanTypes(Set<Type> types, Object baseType, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, baseType).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, baseType).build(); } } return types; }
/** * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ public static Set<Type> getLegalBeanTypes(Set<Type> types, Object baseType, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, baseType).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, baseType).build(); } } return types; }
/** * @param types The initial set of types * @param annotated * @param additionalTypes Types to add to the initial set * @return the set of legal bean types */ public static Set<Type> getLegalBeanTypes(Set<Type> types, Object baseType, Type... additionalTypes) { if (additionalTypes != null && additionalTypes.length > 0) { // Micro-optimization is not possible return omitIllegalBeanTypes(types, baseType).addAll(additionalTypes).build(); } for (Type type : types) { if (Types.isIllegalBeanType(type)) { return omitIllegalBeanTypes(types, baseType).build(); } } return types; }
private Set<Annotation> initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { return Bindings.DEFAULT_QUALIFIERS; } Set<Annotation> normalized = new HashSet<Annotation>(qualifiers); normalized.remove(Any.Literal.INSTANCE); normalized.remove(Default.Literal.INSTANCE); if (normalized.isEmpty()) { normalized = Bindings.DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> builder = ImmutableSet.builder(); if (normalized.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { builder.add(Default.Literal.INSTANCE); } } builder.add(Any.Literal.INSTANCE); builder.addAll(qualifiers); normalized = builder.build(); } return normalized; }
private Set<Annotation> initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { return Bindings.DEFAULT_QUALIFIERS; } Set<Annotation> normalized = new HashSet<Annotation>(qualifiers); normalized.remove(Any.Literal.INSTANCE); normalized.remove(Default.Literal.INSTANCE); if (normalized.isEmpty()) { normalized = Bindings.DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> builder = ImmutableSet.builder(); if (normalized.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { builder.add(Default.Literal.INSTANCE); } } builder.add(Any.Literal.INSTANCE); builder.addAll(qualifiers); normalized = builder.build(); } return normalized; }
private Set<Annotation> initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { return Bindings.DEFAULT_QUALIFIERS; } Set<Annotation> normalized = new HashSet<Annotation>(qualifiers); normalized.remove(Any.Literal.INSTANCE); normalized.remove(Default.Literal.INSTANCE); if (normalized.isEmpty()) { normalized = Bindings.DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> builder = ImmutableSet.builder(); if (normalized.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { builder.add(Default.Literal.INSTANCE); } } builder.add(Any.Literal.INSTANCE); builder.addAll(qualifiers); normalized = builder.build(); } return normalized; }
private Set<Annotation> initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { return Bindings.DEFAULT_QUALIFIERS; } Set<Annotation> normalized = new HashSet<Annotation>(qualifiers); normalized.remove(Any.Literal.INSTANCE); normalized.remove(Default.Literal.INSTANCE); if (normalized.isEmpty()) { normalized = Bindings.DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> builder = ImmutableSet.builder(); if (normalized.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { builder.add(Default.Literal.INSTANCE); } } builder.add(Any.Literal.INSTANCE); builder.addAll(qualifiers); normalized = builder.build(); } return normalized; }
private Set<Annotation> initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { return Bindings.DEFAULT_QUALIFIERS; } Set<Annotation> normalized = new HashSet<Annotation>(qualifiers); normalized.remove(Any.Literal.INSTANCE); normalized.remove(Default.Literal.INSTANCE); if (normalized.isEmpty()) { normalized = Bindings.DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> builder = ImmutableSet.builder(); if (normalized.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { builder.add(Default.Literal.INSTANCE); } } builder.add(Any.Literal.INSTANCE); builder.addAll(qualifiers); normalized = builder.build(); } return normalized; }