/** * Method that returns the adapter associated with the given object. It * may be a singleton or not ... depending on the needs of the * INodeAdapter ... but in general it is recommended for an adapter to be * stateless, so the efficiencies of a singleton can be gained. * * The implementation of this method should call addAdapter on the adapted * object with the correct instance of the adapter. */ public INodeAdapter adapt(INodeNotifier notifier) { INodeAdapter adapter = null; if (notifier != null) { if (notifier instanceof IDOMDocument) { adapter = notifier.getExistingAdapter(ModelParserAdapter.class); if (adapter == null) { adapter = new HTMLModelParserAdapter(); notifier.addAdapter(adapter); } } } return adapter; }