Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Custom data bind factory to plumb in the custom data binder to a DD4T 2 Java project
public class CustomDataBindFactory {
private static final Logger LOG = LoggerFactory.getLogger(DataBindFactory.class);
private static final CustomDataBindFactory INSTANCE = new CustomDataBindFactory();
private CustomDataBinder customDataBinder;
private CustomDataBindFactory () {"CustomDataBindFactory init.");
public static CustomDataBindFactory getInstance () {
if (null == INSTANCE) {
LOG.error("CustomDataBindFactory not properly instantiated!");
return INSTANCE;
public static <T extends Sitemap> T buildSitemap (final String source, final Class<T> aClass) throws SerializationException {
return INSTANCE.customDataBinder.buildSitemap(source, aClass);
public void setCustomDataBinder(final CustomDataBinder customDataBinder) {
this.customDataBinder = customDataBinder;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment