All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.itemis.maven.plugins.cdi.internal.beans.CdiBeanWrapper Maven / Gradle / Ivy

package com.itemis.maven.plugins.cdi.internal.beans;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Set;

import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;

public class CdiBeanWrapper implements Bean {

  private T instance;
  private Set qualifiers;
  private Type type;
  private Class instanceClass;

  public CdiBeanWrapper(T instance, Type type, Class instanceClass, Set qualifiers) {
    this.instance = instance;
    this.type = type;
    this.instanceClass = instanceClass;
    this.qualifiers = qualifiers;
  }

  @Override
  public T create(CreationalContext creationalContext) {
    return this.instance;
  }

  @Override
  public void destroy(T instance, CreationalContext creationalContext) {
  }

  @Override
  public Set getTypes() {
    return Collections.singleton(this.type);
  }

  @Override
  public Set getQualifiers() {
    return this.qualifiers;
  }

  @Override
  public Class getScope() {
    return Dependent.class;
  }

  @Override
  public String getName() {
    return null;
  }

  @Override
  public Set> getStereotypes() {
    return Collections.emptySet();
  }

  @Override
  public boolean isAlternative() {
    return false;
  }

  @Override
  public Class getBeanClass() {
    return this.instanceClass;
  }

  @Override
  public Set getInjectionPoints() {
    return Collections.emptySet();
  }

  @Override
  public boolean isNullable() {
    return true;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy