Codota Logo
BeanProvider.injectFields
Code IndexAdd Codota to your IDE (free)

How to use
injectFields
method
in
org.apache.deltaspike.core.api.provider.BeanProvider

Best Java code snippets using org.apache.deltaspike.core.api.provider.BeanProvider.injectFields (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: com.blazebit/blaze-weblink-core-impl

  @Override
  public WeblinkMatcher createWeblinkMatcher(Map<String, ? extends Object> properties) {
    return BeanProvider.injectFields(new DefaultWeblinkMatcher());
  }
}
origin: com.blazebit/blaze-weblink-core-impl

@Override
public WeblinkKeyStrategy createWeblinkKeyStrategy(Map<String, ? extends Object> properties) {
  return BeanProvider.injectFields(new UuidWeblinkKeyStrategy());
}
origin: com.blazebit/blaze-storage-rest-impl

  public <T> T inject(T instance) {
    rc.initResource(instance);
    return BeanProvider.injectFields(instance);
  }
}
origin: com.blazebit/blaze-weblink-core-impl

@Override
public WeblinkKeyStrategy createWeblinkKeyStrategy(Map<String, ? extends Object> properties) {
  return BeanProvider.injectFields(new DefaultWeblinkKeyStrategy());
}
origin: be.c4j.ee.security.octopus/octopus-core

public NamedDomainPermission getPermission(String namedPermission) {
  // This is actually a hack to keep it working within tests.
  // It is better to do this in the constructor, although also not ideal.
  // But Within tests an instance of this is made to regsiter as CDI bean with BeanManagerFake thus we don't have the StringUtil available yet.
  if (stringUtil == null) {
    BeanProvider.injectFields(this);
  }
  if (stringUtil.isEmpty(namedPermission)) {
    throw new IllegalArgumentException("namedPermission value can't be null or empty.");
  }
  // namedPermission : a String indicating a named permission defined by the constructor, or a wildcardString
  String key = namedPermission.toUpperCase(Locale.ENGLISH);
  NamedDomainPermission result;
  if (map.containsKey(key)) {
    result = map.get(key);
  } else {
    result = new NamedDomainPermission(createNameForPermission(namedPermission), namedPermission);
  }
  return result;
}
origin: Blazebit/blaze-persistence

public static void main(String[] args) {
  CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
  cdiContainer.boot();
  ContextControl contextControl = cdiContainer.getContextControl();
  contextControl.startContext(ApplicationScoped.class);
  ServiceLoader<Showcase> showcaseLoader = ServiceLoader.load(Showcase.class);
  Iterator<Showcase> showcaseIterator = showcaseLoader.iterator();
  if (!showcaseIterator.hasNext()) {
    throw new RuntimeException("No showcases found");
  }
  while (showcaseIterator.hasNext()) {
    BeanProvider.injectFields(showcaseIterator.next()).run();
  }
  cdiContainer.shutdown();
}
origin: com.blazebit/blaze-weblink-core-impl

@Override
public HttpBasicSecurityConstraint createConstraint(Map<String, ? extends Object> properties) {
  String user = getString(properties, HttpBasicConstraint.USER_PROPERTY);
  String password = getString(properties, HttpBasicConstraint.PASSWORD_PROPERTY);
  return BeanProvider.injectFields(new HttpBasicSecurityConstraint(user, password));
}
origin: apache/deltaspike

@Override
protected Object createTest() throws Exception
{
  BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
  Class<?> type = getTestClass().getJavaClass();
  Set<Bean<?>> beans = beanManager.getBeans(type);
  Object result;
  if (!USE_TEST_CLASS_AS_CDI_BEAN || beans == null || beans.isEmpty())
  {
    result = super.createTest();
    BeanProvider.injectFields(result); //fallback to simple injection
  }
  else
  {
    Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);
    CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);
    result = beanManager.getReference(bean, type, creationalContext);
  }
  return result;
}
origin: com.blazebit/blaze-weblink-core-impl

@Override
public IpRangeSecurityConstraint createConstraint(Map<String, ? extends Object> properties) {
  String networkAddress = getString(properties, IpRangeConstraint.NETWORK_ADDRESS_PROPERTY);
  String netmaskAddress = getString(properties, IpRangeConstraint.NETMASK_ADDRESS_PROPERTY);
  return BeanProvider.injectFields(IpRangeSecurityConstraint.create(networkAddress, netmaskAddress));
}
origin: com.vaadin/vaadin-cdi

@Override
public <T> T getOrCreate(Class<T> type) {
  return new BeanLookup<>(beanManager, type)
      .setUnsatisfiedHandler(() ->
          getLogger().debug("'{}' is not a CDI bean. "
              + FALLING_BACK_TO_DEFAULT_INSTANTIATION, type.getName()))
      .setAmbiguousHandler(e ->
          getLogger().debug("Multiple CDI beans found. "
              + FALLING_BACK_TO_DEFAULT_INSTANTIATION, e))
      .lookupOrElseGet(() -> {
        final T instance = delegate.getOrCreate(type);
        BeanProvider.injectFields(instance);
        return instance;
      });
}
origin: apache/deltaspike

BeanProvider.injectFields(this.originalTarget); //fallback to simple injection
origin: vaadin/cdi

@Override
public <T> T getOrCreate(Class<T> type) {
  return new BeanLookup<>(beanManager, type)
      .setUnsatisfiedHandler(() ->
          getLogger().debug("'{}' is not a CDI bean. "
              + FALLING_BACK_TO_DEFAULT_INSTANTIATION, type.getName()))
      .setAmbiguousHandler(e ->
          getLogger().debug("Multiple CDI beans found. "
              + FALLING_BACK_TO_DEFAULT_INSTANTIATION, e))
      .lookupOrElseGet(() -> {
        final T instance = delegate.getOrCreate(type);
        BeanProvider.injectFields(instance);
        return instance;
      });
}
origin: org.apache.deltaspike.modules/deltaspike-scheduler-module-impl

context.getTrigger().getJobDataMap().put(ACTIVE_CRON_EXPRESSION_KEY, configuredValue);
BeanProvider.injectFields(this);
origin: org.apache.deltaspike.modules/deltaspike-jsf-module-impl

@Override
public void restoreState(FacesContext context, Object state)
{
  Object[] wrappedState = (Object[]) state;
  if (this.wrapped == null) //fallback for full state-saving
  {
    Class wrappedClass = ClassUtils.tryToLoadClassForName((String)wrappedState[0]);
    T resolvedInstance = resolveInstanceForClass(context, wrappedClass);
    //TODO re-visit logic for multiple (custom) wrappers
    if (resolvedInstance instanceof AbstractContextualReferenceWrapper)
    {
      resolvedInstance = ((AbstractContextualReferenceWrapper<T>)resolvedInstance).getWrapped();
    }
    this.wrapped = resolvedInstance;
  }
  if (this.wrapped == null)
  {
    this.wrapped = (T)ClassUtils.tryToInstantiateClassForName((String)wrappedState[0]);
    BeanProvider.injectFields(this.wrapped);
  }
  if (this.wrapped instanceof StateHolder)
  {
    ((StateHolder) this.wrapped).restoreState(context, wrappedState[1]);
  }
}
origin: org.apache.deltaspike.modules/deltaspike-jsf-module-impl-ee6

@Override
public void restoreState(FacesContext context, Object state)
{
  Object[] wrappedState = (Object[]) state;
  if (this.wrapped == null) //fallback for full state-saving
  {
    Class wrappedClass = ClassUtils.tryToLoadClassForName((String)wrappedState[0]);
    T resolvedInstance = resolveInstanceForClass(context, wrappedClass);
    //TODO re-visit logic for multiple (custom) wrappers
    if (resolvedInstance instanceof AbstractContextualReferenceWrapper)
    {
      resolvedInstance = ((AbstractContextualReferenceWrapper<T>)resolvedInstance).getWrapped();
    }
    this.wrapped = resolvedInstance;
  }
  if (this.wrapped == null)
  {
    this.wrapped = (T)ClassUtils.tryToInstantiateClassForName((String)wrappedState[0]);
    BeanProvider.injectFields(this.wrapped);
  }
  if (this.wrapped instanceof StateHolder)
  {
    ((StateHolder) this.wrapped).restoreState(context, wrappedState[1]);
  }
}
origin: apache/deltaspike

@Test
public void injectBeansInNonManagedInstance() throws Exception
{
  ManualBean manualBean = new ManualBean();
  Assert.assertNull(manualBean.getTestBean());
  BeanProvider.injectFields(manualBean);
  Assert.assertNotNull(manualBean.getTestBean());
  Assert.assertEquals(4711, manualBean.getTestBean().getI());
  int newValue = 14;
  manualBean.getTestBean().setI(newValue);
  Assert.assertEquals(newValue, manualBean.getTestBean().getI());
  TestBean testBean = BeanProvider.getContextualReference(TestBean.class);
  Assert.assertEquals(newValue, testBean.getI());
  testBean.setI(4711); // reset the value if this test is executed first
}
org.apache.deltaspike.core.api.providerBeanProviderinjectFields

Javadoc

Performs dependency injection on an instance. Useful for instances which aren't managed by CDI.

Attention:
The resulting instance isn't managed by CDI; only fields annotated with @Inject get initialized.

Popular methods of BeanProvider

  • getContextualReference
    Get a Contextual Reference by its EL Name. This only works for beans with the @Named annotation. At
  • getDependent
  • getBeanDefinitions
    Get a set of Bean definitions by type, regardless of qualifiers.
  • getContextualReferences
    Get a list of Contextual References by type, regardless of the qualifier. Further details are availa
  • createDependentProvider
  • filterDefaultScopedBeans
  • getBeanManager
    Internal method to resolve the BeanManager via the BeanManagerProvider.
  • logWarningIfDependent
    Log a warning if the given bean is of @Dependent scope as we cannot properly clean up the contextual

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now