Skip to content

Instantly share code, notes, and snippets.

@chrismrgn
Created July 14, 2016 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismrgn/2f6af1bd665b9d723fc1474016bdfff4 to your computer and use it in GitHub Desktop.
Save chrismrgn/2f6af1bd665b9d723fc1474016bdfff4 to your computer and use it in GitHub Desktop.
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 () {
LOG.info("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