close

Filter

loading table of contents...

Content Application Developer Manual / Version 2204

Table Of Contents

4.1.1.3 Programmatic Access to Content Beans

In order to "bootstrap" yourself into the world of content beans from the CoreMedia Unified API, you need to use the content bean factory programmatically, for example from within a Controller. The factory API is simple, the most relevant method is ContentBeanFactory#createBeanFor(Content). For example:

Content content = ... // for example through a query
Article article =
  (Article)contentBeanFactory.createBeanFor(content);

The controller needs access to the content bean factory. Since the controller itself typically is a bean defined in the application context, you can inject the factory reference into the controller object:

<bean id="myController" class="...">
  <property name="contentBeanFactory" ref="contentBeanFactory"/>
  ...
</bean>

This fragment will invoke #setContentBeanFactory on the controller supplying an instance of the referenced factory.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.