protected static void validateResourceInjectionPointType(Class<?> resourceType, InjectionPoint injectionPoint) { Class<?> injectionPointRawType = Reflections.getRawType(injectionPoint.getType()); HierarchyDiscovery discovery = new HierarchyDiscovery(resourceType); for (Type type : discovery.getTypeClosure()) { if (Reflections.getRawType(type).equals(injectionPointRawType)) { return; } } // type autoboxing if (resourceType.isPrimitive() && BOXED_TYPES.get(resourceType).equals(injectionPointRawType)) { return; } else if (injectionPointRawType.isPrimitive() && BOXED_TYPES.get(injectionPointRawType).equals(resourceType)) { return; } throw BeanLogger.LOG.invalidResourceProducerType(injectionPoint.getAnnotated(), resourceType.getName()); }
@SuppressWarnings("unchecked") private static <T> Class<T> getBound(Type[] bounds) { if (bounds.length == 0) { return (Class<T>) Object.class; } else { return getRawType(bounds[0]); } }
protected Set<Type> getDecoratedTypes(Set<Type> types) { Set<Type> decoratedTypes = new HashSet<Type>(); for (Type type : types) { Class<?> rawType = Reflections.getRawType(type); if (rawType.isInterface() && !Serializable.class.equals(rawType)) { decoratedTypes.add(type); } } return decoratedTypes; }
protected Set<Type> getDecoratedTypes(Set<Type> types) { Set<Type> decoratedTypes = new HashSet<Type>(); for (Type type : types) { Class<?> rawType = Reflections.getRawType(type); if (rawType.isInterface() && !Serializable.class.equals(rawType)) { decoratedTypes.add(type); } } return decoratedTypes; }
public ResolvableBuilder(Type type, final BeanManagerImpl beanManager) { this(beanManager); if (type != null) { this.rawType = Reflections.getRawType(type); if (rawType == null || type instanceof TypeVariable<?>) { throw ResolutionLogger.LOG.cannotExtractRawType(type); } this.types.add(type); } }
public Set<Type> getInterfaceClosure() { Set<Type> interfaces = new HashSet<Type>(); for (Type t : getTypeClosure()) { if (Reflections.getRawType(t).isInterface()) { interfaces.add(t); } } return Collections.unmodifiableSet(interfaces); }
@Override protected boolean accept(AnnotatedMember<?> member, PersistenceApiAbstraction apiAbstraction) { // ugly hack that allows application servers to support hibernate session injection while at the same time // the injection points are validated by Weld for invalid types (required by the TCK) return !apiAbstraction.SESSION_NAME.equals(getRawType(getResourceInjectionPointType(member)).getName()); } }
protected boolean isContainerLifecycleEvent(Resolvable resolvable) { for (Type type : resolvable.getTypes()) { if (Observers.CONTAINER_LIFECYCLE_EVENT_TYPES.contains(Reflections.getRawType(type))) { return true; } } return false; }
public ResolvableBuilder(Type type, final BeanManagerImpl beanManager) { this(beanManager); if (type != null) { this.rawType = Reflections.getRawType(type); if (rawType == null || type instanceof TypeVariable<?>) { throw ResolutionLogger.LOG.cannotExtractRawType(type); } this.types.add(type); } }
@Override protected boolean accept(AnnotatedMember<?> member, PersistenceApiAbstraction apiAbstraction) { // ugly hack that allows application servers to support hibernate session injection while at the same time // the injection points are validated by Weld for invalid types (required by the TCK) return !apiAbstraction.SESSION_FACTORY_NAME.equals(getRawType(getResourceInjectionPointType(member)).getName()); } }
@Override protected boolean accept(AnnotatedMember<?> member, PersistenceApiAbstraction apiAbstraction) { // ugly hack that allows application servers to support hibernate session injection while at the same time // the injection points are validated by Weld for invalid types (required by the TCK) return !apiAbstraction.SESSION_NAME.equals(getRawType(getResourceInjectionPointType(member)).getName()); } }
public Set<Type> getInterfaceClosure() { Set<Type> interfaces = new HashSet<Type>(); for (Type t : getTypeClosure()) { if (Reflections.getRawType(t).isInterface()) { interfaces.add(t); } } return WeldCollections.immutableSetView(interfaces); }
public Set<Type> getInterfaceClosure() { Set<Type> interfaces = new HashSet<Type>(); for (Type t : getTypeClosure()) { if (Reflections.getRawType(t).isInterface()) { interfaces.add(t); } } return WeldCollections.immutableSetView(interfaces); }
protected static boolean isCacheableInjectionPoint(WeldInjectionPointAttributes<?, ?> attributes) { if (attributes.isDelegate()) { return false; } Class<?> rawType = Reflections.getRawType(attributes.getType()); return !InjectionPoint.class.isAssignableFrom(rawType) && !Instance.class.isAssignableFrom(rawType); }
protected static boolean isCacheableInjectionPoint(WeldInjectionPointAttributes<?, ?> attributes) { if (attributes.isDelegate()) { return false; } Class<?> rawType = Reflections.getRawType(attributes.getType()); return !InjectionPoint.class.isAssignableFrom(rawType) && !Instance.class.isAssignableFrom(rawType); }
private static boolean isAssignableFrom(ParameterizedType type1, ParameterizedType type2) { // first, raw types have to be assignable if (!isAssignableFrom(Reflections.getRawType(type1), Reflections.getRawType(type2))) { return false; } if (matches(type1, type2)) { return true; } return matches(type1, new HierarchyDiscovery(type2)); }
private static boolean isAssignableFrom(ParameterizedType type1, ParameterizedType type2) { // first, raw types have to be assignable if (!isAssignableFrom(Reflections.getRawType(type1), Reflections.getRawType(type2))) { return false; } if (matches(type1, type2)) { return true; } return matches(type1, new HierarchyDiscovery(type2)); }
private static boolean isAssignableFrom(ParameterizedType type1, Class<?> type2) { Class<?> rawType1 = Reflections.getRawType(type1); // raw types have to be assignable if (!isAssignableFrom(rawType1, type2)) { return false; } // this is a raw type with missing type arguments if (!Types.getCanonicalType(type2).equals(type2)) { return true; } return matches(type1, new HierarchyDiscovery(type2)); }
private static boolean isAssignableFrom(ParameterizedType type1, Class<?> type2) { Class<?> rawType1 = Reflections.getRawType(type1); // raw types have to be assignable if (!isAssignableFrom(rawType1, type2)) { return false; } // this is a raw type with missing type arguments if (!Types.getCanonicalType(type2).equals(type2)) { return true; } return matches(type1, new HierarchyDiscovery(type2)); }
public void createNewBeans() { for (Type type : getEnvironment().getNewBeanTypes()) { Class<?> clazz = Reflections.getRawType(type); if (!ejbSupport.isEjb(clazz)) { createNewManagedBean(clazz, type); } } ejbSupport.createNewSessionBeans(getEnvironment(), getManager()); }