private void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { return; } EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } else if (constructor.isPrivate()) { throw BeanLogger.LOG .decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } }
public EnhancedAnnotatedConstructor<T> getNoArgsEnhancedConstructor() { return delegate().getNoArgsEnhancedConstructor(); }
public EnhancedAnnotatedConstructor<T> getNoArgsEnhancedConstructor() { return delegate().getNoArgsEnhancedConstructor(); }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(ObservesAsync.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@ObservesAsync", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(ObservesAsync.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@ObservesAsync", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(ObservesAsync.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@ObservesAsync", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(ObservesAsync.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@ObservesAsync", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
public static <T> EnhancedAnnotatedConstructor<T> getBeanConstructor(EnhancedAnnotatedType<T> type) { Collection<EnhancedAnnotatedConstructor<T>> initializerAnnotatedConstructors = type .getEnhancedConstructors(Inject.class); BeanLogger.LOG.foundInjectableConstructors(initializerAnnotatedConstructors, type); EnhancedAnnotatedConstructor<T> constructor = null; if (initializerAnnotatedConstructors.size() > 1) { throw UtilLogger.LOG.ambiguousConstructor(type, initializerAnnotatedConstructors); } else if (initializerAnnotatedConstructors.size() == 1) { constructor = initializerAnnotatedConstructors.iterator().next(); BeanLogger.LOG.foundOneInjectableConstructor(constructor, type); } else if (type.getNoArgsEnhancedConstructor() != null) { constructor = type.getNoArgsEnhancedConstructor(); BeanLogger.LOG.foundDefaultConstructor(constructor, type); } if (constructor != null) { if (!constructor.getEnhancedParameters(Disposes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Disposes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(Observes.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@Observes", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } if (!constructor.getEnhancedParameters(ObservesAsync.class).isEmpty()) { throw BeanLogger.LOG.parameterAnnotationNotAllowedOnConstructor("@ObservesAsync", constructor, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } return constructor; }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }
protected void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { // Relaxed construction allows us to bypass non-existent no-arg constructor return; } else { // Without relaxed contruction, CDI enforces existence of no-arg constructor throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } } else { if (constructor.isPrivate()) { // Private no-arg constructor is a problem while creating the decorator and we have to blow up throw BeanLogger.LOG.decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } } }