package org.skyscreamer.yoga.selector;

import java.util.Set;

public abstract class AbstractSelectable implements Selectable
{
    private Set<SelectorField> _selectorFields;

    public AbstractSelectable( Selector selector )
    {
        _selectorFields = selector.getFields();
    }

    public Set<SelectorField> getSelectorFields()
    {
        return _selectorFields;
    }
}


package org.skyscreamer.yoga.selector;

import java.util.Collections;
import java.util.Set;

public abstract class AbstractSelectable implements Selectable
{
    private Set<SelectorField> _selectorFields;

    public AbstractSelectable() {}

    public AbstractSelectable( Selector selector )
    {
        setSelector( selector );
    }

    public Set<SelectorField> getSelectorFields()
    {
        return _selectorFields;
    }

    public void setSelector( Selector selector ) {
        _selectorFields = selector != null ? selector.getFields() : Collections.<SelectorField>emptySet();
    }
}

Allow selector to be set after construction
Allow selector to be set after construction
