On Tue, 2014-09-09 at 13:39 +0100, sebb wrote:
> Would it not be simpler to use the IODH idiom for the lazy init?
>
> For example:
>
> public class IgnoreSpecProvider implements CookieSpecProvider {
>
> public IgnoreSpecProvider() {
> super();
> }
>
> @Override
> public CookieSpec create(final HttpContext context) {
> return IgnoreSpec.getInstance();
> }
>
> }
>
> public class IgnoreSpec extends CookieSpecBase {
>
> private static class SpecHolder {
> private static final IgnoreSpec INSTANCE = new IgnoreSpec();
> }
>
> public static IgnoreSpec getInstance() {
> return SpecHolder.INSTANCE;
> }
>
> private IgnoreSpec() { // prevent external init (not strictly necessary)
> super();
> }
>
> .... rest of class
> }
>
> Just a thought.
>
IODH would be clearly preferred but it works well with default
constructors. IODH would suit IgnoreSpecProvider but not
DefaultCookieSpecProvider due to rather complex construction logic in
the latter.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]