import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.util.OptionalBoolean;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
private Collection<StmtContext<?, ?, ?>> effectOfStatement = ImmutableList.of();
private StatementMap substatements = StatementMap.empty();
- private Boolean supportedByFeatures = null;
private boolean isSupportedToBuildEffective = true;
private ModelProcessingPhase completedPhase = null;
private D declaredInstance;
private E effectiveInstance;
private int order = 0;
+ // BooleanFields value
+ private byte supportedByFeatures;
+
StatementContextBase(final StatementDefinitionContext<A, D, E> def, final StatementSourceReference ref,
final String rawArgument) {
this.definition = Preconditions.checkNotNull(def);
@Override
public boolean isSupportedByFeatures() {
- if (supportedByFeatures == null) {
- final Set<QName> supportedFeatures = getFromNamespace(SupportedFeaturesNamespace.class,
- SupportedFeatures.SUPPORTED_FEATURES);
- // If the set of supported features has not been provided, all features are supported by default.
- supportedByFeatures = supportedFeatures == null ? Boolean.TRUE
- : StmtContextUtils.checkFeatureSupport(this, supportedFeatures);
+ if (OptionalBoolean.isPresent(supportedByFeatures)) {
+ return OptionalBoolean.get(supportedByFeatures);
}
- return supportedByFeatures.booleanValue();
+ // If the set of supported features has not been provided, all features are supported by default.
+ final Set<QName> supportedFeatures = getFromNamespace(SupportedFeaturesNamespace.class,
+ SupportedFeatures.SUPPORTED_FEATURES);
+ final boolean ret = supportedFeatures == null ? true
+ : StmtContextUtils.checkFeatureSupport(this, supportedFeatures);
+
+ supportedByFeatures = OptionalBoolean.of(ret);
+ return ret;
+
}
@Override