return substatements.isEmpty() ? createFeature(argument) : new RegularFeatureStatement(argument, substatements);
}
- public static FractionDigitsStatement createFractionDigits(final Integer argument) {
- return new EmptyFractionDigitsStatement(argument);
+ public static FractionDigitsStatement createFractionDigits(final int argument) {
+ return EmptyFractionDigitsStatement.of(argument);
}
public static FractionDigitsStatement createFractionDigits(final Integer argument,
return new RefineStatementImpl(rawArgument, argument, substatements);
}
- public static RequireInstanceStatement createRequireInstance(final Boolean argument) {
- return new EmptyRequireInstanceStatement(argument);
+ public static RequireInstanceStatement createRequireInstance(final boolean argument) {
+ return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
}
public static RequireInstanceStatement createRequireInstance(final Boolean argument,
}
public static StatusStatement createStatus(final Status argument) {
- return new EmptyStatusStatement(argument);
+ switch (argument) {
+ case CURRENT:
+ return EmptyStatusStatement.CURRENT;
+ case DEPRECATED:
+ return EmptyStatusStatement.DEPRECATED;
+ case OBSOLETE:
+ return EmptyStatusStatement.OBSOLETE;
+ default:
+ throw new IllegalStateException("Unhandled argument " + argument);
+ }
}
public static StatusStatement createStatus(final Status argument,
}
public static YangVersionStatement createYangVersion(final YangVersion argument) {
- return new EmptyYangVersionStatement(argument);
+ switch (argument) {
+ case VERSION_1:
+ return EmptyYangVersionStatement.VERSION_1;
+ case VERSION_1_1:
+ return EmptyYangVersionStatement.VERSION_1_1;
+ default:
+ throw new IllegalStateException("Unhandled version " + argument);
+ }
}
public static YangVersionStatement createYangVersion(final YangVersion argument,
: new RegularYangVersionStatement(argument, substatements);
}
- public static YinElementStatement createYinElement(final Boolean argument) {
- return new EmptyYinElementStatement(argument);
+ public static YinElementStatement createYinElement(final boolean argument) {
+ return argument ? EmptyYinElementStatement.TRUE : EmptyYinElementStatement.FALSE;
}
public static YinElementStatement createYinElement(final Boolean argument,
import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BaseEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModifierEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModifierStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PresenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.UnitsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.WhenEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyRequireInstanceStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyStatusStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyYangVersionStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyArgumentEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyBaseEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyBelongsToEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyDescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyFractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyIfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyIncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMinElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyModifierEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyNamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyOrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyOrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPositionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPresenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyRequireInstanceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyRevisionDateEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyStatusEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyUnitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyValueEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyWhenEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyYangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyYinElementEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularArgumentEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularBaseEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularBelongsToEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularDescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularFractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularIfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularIncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMinElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularModifierEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularNamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularOrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularOrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPositionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPresenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularRequireInstanceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularRevisionDateEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularStatusEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularUnitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularValueEffectiveStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularWhenEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularYangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularYinElementEffectiveStatement;
/**
* Static entry point to instantiating {@link EffectiveStatement} covered in the {@code RFC7950} metamodel.
: new RegularBaseEffectiveStatement(declared, substatements);
}
+ public static BelongsToEffectiveStatement createBelongsTo(final BelongsToStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyBelongsToEffectiveStatement(declared)
+ : new RegularBelongsToEffectiveStatement(declared, substatements);
+ }
+
public static DescriptionEffectiveStatement createDescription(final DescriptionStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyDescriptionEffectiveStatement(declared)
: new RegularDescriptionEffectiveStatement(declared, substatements);
}
+ public static ErrorAppTagEffectiveStatement createErrorAppTag(final ErrorAppTagStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyErrorAppTagEffectiveStatement(declared)
+ : new RegularErrorAppTagEffectiveStatement(declared, substatements);
+ }
+
+ public static ErrorMessageEffectiveStatement createErrorMessage(final ErrorMessageStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyErrorMessageEffectiveStatement(declared)
+ : new RegularErrorMessageEffectiveStatement(declared, substatements);
+ }
+
+ public static FractionDigitsEffectiveStatement createFractionDigits(final FractionDigitsStatement declared) {
+ return new EmptyFractionDigitsEffectiveStatement(declared);
+ }
+
+ public static FractionDigitsEffectiveStatement createFractionDigits(final FractionDigitsStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createFractionDigits(declared)
+ : new RegularFractionDigitsEffectiveStatement(declared, substatements);
+ }
+
+ public static IfFeatureEffectiveStatement createIfFeature(final IfFeatureStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyIfFeatureEffectiveStatement(declared)
+ : new RegularIfFeatureEffectiveStatement(declared, substatements);
+ }
+
+ public static IncludeEffectiveStatement createInclude(final IncludeStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyIncludeEffectiveStatement(declared)
+ : new RegularIncludeEffectiveStatement(declared, substatements);
+ }
+
+ public static MandatoryEffectiveStatement createMandatory(final MandatoryStatement declared) {
+ return new EmptyMandatoryEffectiveStatement(declared);
+ }
+
+ public static MandatoryEffectiveStatement createMandatory(final MandatoryStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createMandatory(declared)
+ : new RegularMandatoryEffectiveStatement(declared, substatements);
+ }
+
+ public static MaxElementsEffectiveStatement createMaxElements(final MaxElementsStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyMaxElementsEffectiveStatement(declared)
+ : new RegularMaxElementsEffectiveStatement(declared, substatements);
+ }
+
+ public static MinElementsEffectiveStatement createMinElements(final MinElementsStatement declared) {
+ return new EmptyMinElementsEffectiveStatement(declared);
+ }
+
+ public static MinElementsEffectiveStatement createMinElements(final MinElementsStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createMinElements(declared)
+ : new RegularMinElementsEffectiveStatement(declared, substatements);
+ }
+
public static ModifierEffectiveStatement createModifier(final ModifierStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyModifierEffectiveStatement(declared)
: new RegularModifierEffectiveStatement(declared, substatements);
}
+ public static NamespaceEffectiveStatement createNamespace(final NamespaceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyNamespaceEffectiveStatement(declared)
+ : new RegularNamespaceEffectiveStatement(declared, substatements);
+ }
+
+ public static OrderedByEffectiveStatement createOrderedBy(final OrderedByStatement declared) {
+ return new EmptyOrderedByEffectiveStatement(declared);
+ }
+
+ public static OrderedByEffectiveStatement createOrderedBy(final OrderedByStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createOrderedBy(declared)
+ : new RegularOrderedByEffectiveStatement(declared, substatements);
+ }
+
+ public static OrganizationEffectiveStatement createOrganization(final OrganizationStatement declared) {
+ return new EmptyOrganizationEffectiveStatement(declared);
+ }
+
+ public static OrganizationEffectiveStatement createOrganization(final OrganizationStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createOrganization(declared)
+ : new RegularOrganizationEffectiveStatement(declared, substatements);
+ }
+
+ public static PathEffectiveStatement createPath(final PathStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? new EmptyPathEffectiveStatement(declared)
+ : new RegularPathEffectiveStatement(declared, substatements);
+ }
+
+ public static PositionEffectiveStatement createPosition(final PositionStatement declared) {
+ return new EmptyPositionEffectiveStatement(declared);
+ }
+
+ public static PositionEffectiveStatement createPosition(final PositionStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createPosition(declared)
+ : new RegularPositionEffectiveStatement(declared, substatements);
+ }
+
+ public static ReferenceEffectiveStatement createReference(final ReferenceStatement declared) {
+ return new EmptyReferenceEffectiveStatement(declared);
+ }
+
+ public static ReferenceEffectiveStatement createReference(final ReferenceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createReference(declared)
+ : new RegularReferenceEffectiveStatement(declared, substatements);
+ }
+
public static PresenceEffectiveStatement createPresence(final PresenceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyPresenceEffectiveStatement(declared)
: new RegularPresenceEffectiveStatement(declared, substatements);
}
+ public static RequireInstanceEffectiveStatement createRequireInstance(final boolean argument) {
+ return argument ? EmptyRequireInstanceEffectiveStatement.TRUE : EmptyRequireInstanceEffectiveStatement.FALSE;
+ }
+
+ public static RequireInstanceEffectiveStatement createRequireInstance(final RequireInstanceStatement declared) {
+ if (EmptyRequireInstanceStatement.TRUE.equals(declared)) {
+ return EmptyRequireInstanceEffectiveStatement.TRUE;
+ } else if (EmptyRequireInstanceStatement.FALSE.equals(declared)) {
+ return EmptyRequireInstanceEffectiveStatement.FALSE;
+ } else {
+ return new EmptyRequireInstanceEffectiveStatement(declared);
+ }
+ }
+
+ public static RequireInstanceEffectiveStatement createRequireInstance(final RequireInstanceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createRequireInstance(declared)
+ : new RegularRequireInstanceEffectiveStatement(declared, substatements);
+ }
+
public static RevisionDateEffectiveStatement createRevisionDate(final RevisionDateStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyRevisionDateEffectiveStatement(declared)
: new RegularRevisionDateEffectiveStatement(declared, substatements);
}
+ public static StatusEffectiveStatement createStatus(final StatusStatement declared) {
+ // Aggressively reuse effective instances which are backed by the corresponding empty declared instance, as this
+ // is the case unless there is a weird extension in use.
+ if (EmptyStatusStatement.DEPRECATED.equals(declared)) {
+ // Most likely to be seen (as current is the default)
+ return EmptyStatusEffectiveStatement.DEPRECATED;
+ } else if (EmptyStatusStatement.OBSOLETE.equals(declared)) {
+ // less likely
+ return EmptyStatusEffectiveStatement.OBSOLETE;
+ } else if (EmptyStatusStatement.CURRENT.equals(declared)) {
+ // ... okay, why is this there? :)
+ return EmptyStatusEffectiveStatement.CURRENT;
+ } else {
+ return new EmptyStatusEffectiveStatement(declared);
+ }
+ }
+
+ public static StatusEffectiveStatement createStatus(final StatusStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createStatus(declared)
+ : new RegularStatusEffectiveStatement(declared, substatements);
+ }
+
public static UnitsEffectiveStatement createUnits(final UnitsStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyUnitsEffectiveStatement(declared)
: new RegularUnitsEffectiveStatement(declared, substatements);
}
+ public static ValueEffectiveStatement createValue(final ValueStatement declared) {
+ return new EmptyValueEffectiveStatement(declared);
+ }
+
+ public static ValueEffectiveStatement createValue(final ValueStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createValue(declared)
+ : new RegularValueEffectiveStatement(declared, substatements);
+ }
+
public static WhenEffectiveStatement createWhen(final WhenStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? new EmptyWhenEffectiveStatement(declared)
: new RegularWhenEffectiveStatement(declared, substatements);
}
+
+ public static YangVersionEffectiveStatement createYangVersion(final YangVersionStatement declared) {
+ if (EmptyYangVersionStatement.VERSION_1.equals(declared)) {
+ return EmptyYangVersionEffectiveStatement.VERSION_1;
+ } else if (EmptyYangVersionStatement.VERSION_1_1.equals(declared)) {
+ return EmptyYangVersionEffectiveStatement.VERSION_1_1;
+ } else {
+ return new EmptyYangVersionEffectiveStatement(declared);
+ }
+ }
+
+ public static YangVersionEffectiveStatement createYangVersion(final YangVersionStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createYangVersion(declared)
+ : new RegularYangVersionEffectiveStatement(declared, substatements);
+ }
+
+ public static YinElementEffectiveStatement createYinElement(final YinElementStatement declared) {
+ return new EmptyYinElementEffectiveStatement(declared);
+ }
+
+ public static YinElementEffectiveStatement createYinElement(final YinElementStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return substatements.isEmpty() ? createYinElement(declared)
+ : new RegularYinElementEffectiveStatement(declared, substatements);
+ }
}
*/
package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
public final class EmptyFractionDigitsStatement extends ArgumentToString<Integer> implements FractionDigitsStatement {
- public EmptyFractionDigitsStatement(final Integer argument) {
+ private static final @NonNull EmptyFractionDigitsStatement[] INSTANCES;
+
+ static {
+ final EmptyFractionDigitsStatement[] inst = new EmptyFractionDigitsStatement[18];
+ for (int i = 0; i < 18; ++i) {
+ inst[i] = new EmptyFractionDigitsStatement(i + 1);
+ }
+ INSTANCES = inst;
+ }
+
+ private EmptyFractionDigitsStatement(final int argument) {
super(argument);
}
+
+ public static @NonNull EmptyFractionDigitsStatement of(final int argument) {
+ try {
+ return INSTANCES[argument - 1];
+ } catch (IndexOutOfBoundsException e) {
+ throw new IllegalArgumentException("Invalid fraction-digits argument " + argument, e);
+ }
+ }
}
*/
package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
public final class EmptyRequireInstanceStatement extends ArgumentToString<Boolean> implements RequireInstanceStatement {
- public EmptyRequireInstanceStatement(final Boolean argument) {
+ public static final @NonNull EmptyRequireInstanceStatement FALSE = new EmptyRequireInstanceStatement(false);
+ public static final @NonNull EmptyRequireInstanceStatement TRUE = new EmptyRequireInstanceStatement(true);
+
+ private EmptyRequireInstanceStatement(final boolean argument) {
super(argument);
}
}
*/
package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.Status;
public final class EmptyStatusStatement extends AbstractStatusStatement {
- public EmptyStatusStatement(final Status argument) {
+ public static final @NonNull EmptyStatusStatement CURRENT = new EmptyStatusStatement(Status.CURRENT);
+ public static final @NonNull EmptyStatusStatement DEPRECATED = new EmptyStatusStatement(Status.DEPRECATED);
+ public static final @NonNull EmptyStatusStatement OBSOLETE = new EmptyStatusStatement(Status.OBSOLETE);
+
+ private EmptyStatusStatement(final Status argument) {
super(argument);
}
}
*/
package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
public final class EmptyYangVersionStatement extends ArgumentToString<YangVersion> implements YangVersionStatement {
- public EmptyYangVersionStatement(final YangVersion argument) {
+ public static final @NonNull EmptyYangVersionStatement VERSION_1 =
+ new EmptyYangVersionStatement(YangVersion.VERSION_1);
+ public static final @NonNull EmptyYangVersionStatement VERSION_1_1 =
+ new EmptyYangVersionStatement(YangVersion.VERSION_1_1);
+
+ private EmptyYangVersionStatement(final @NonNull YangVersion argument) {
super(argument);
}
}
*/
package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
public final class EmptyYinElementStatement extends ArgumentToString<Boolean> implements YinElementStatement {
- public EmptyYinElementStatement(final Boolean argument) {
+ public static final @NonNull EmptyYinElementStatement FALSE = new EmptyYinElementStatement(false);
+ public static final @NonNull EmptyYinElementStatement TRUE = new EmptyYinElementStatement(true);
+
+ private EmptyYinElementStatement(final boolean argument) {
super(argument);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.belongs_to;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyBelongsToEffectiveStatement extends DefaultArgument<String, BelongsToStatement>
+public final class EmptyBelongsToEffectiveStatement extends DefaultArgument<String, BelongsToStatement>
implements BelongsToEffectiveStatement {
- EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
+ public EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyErrorAppTagEffectiveStatement extends DefaultArgument<String, ErrorAppTagStatement>
+public final class EmptyErrorAppTagEffectiveStatement extends DefaultArgument<String, ErrorAppTagStatement>
implements ErrorAppTagEffectiveStatement {
- EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
+ public EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyErrorMessageEffectiveStatement extends DefaultArgument<String, ErrorMessageStatement>
+public final class EmptyErrorMessageEffectiveStatement extends DefaultArgument<String, ErrorMessageStatement>
implements ErrorMessageEffectiveStatement {
- EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
+ public EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyFractionDigitsEffectiveStatement extends DefaultArgument<Integer, FractionDigitsStatement>
+public final class EmptyFractionDigitsEffectiveStatement extends DefaultArgument<Integer, FractionDigitsStatement>
implements FractionDigitsEffectiveStatement {
- EmptyFractionDigitsEffectiveStatement(final FractionDigitsStatement declared) {
+ public EmptyFractionDigitsEffectiveStatement(final FractionDigitsStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyIfFeatureEffectiveStatement extends DefaultArgument<IfFeatureExpr, IfFeatureStatement>
+public final class EmptyIfFeatureEffectiveStatement extends DefaultArgument<IfFeatureExpr, IfFeatureStatement>
implements IfFeatureEffectiveStatement {
- EmptyIfFeatureEffectiveStatement(final IfFeatureStatement declared) {
+ public EmptyIfFeatureEffectiveStatement(final IfFeatureStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.include;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyIncludeEffectiveStatement extends DefaultArgument<String, IncludeStatement>
+public final class EmptyIncludeEffectiveStatement extends DefaultArgument<String, IncludeStatement>
implements IncludeEffectiveStatement {
- EmptyIncludeEffectiveStatement(final IncludeStatement declared) {
+ public EmptyIncludeEffectiveStatement(final IncludeStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.mandatory;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyMandatoryEffectiveStatement extends DefaultArgument<Boolean, MandatoryStatement>
+public final class EmptyMandatoryEffectiveStatement extends DefaultArgument<Boolean, MandatoryStatement>
implements MandatoryEffectiveStatement {
- EmptyMandatoryEffectiveStatement(final MandatoryStatement declared) {
+ public EmptyMandatoryEffectiveStatement(final MandatoryStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.max_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyMaxElementsEffectiveStatement extends DefaultArgument<String, MaxElementsStatement>
+public final class EmptyMaxElementsEffectiveStatement extends DefaultArgument<String, MaxElementsStatement>
implements MaxElementsEffectiveStatement {
- EmptyMaxElementsEffectiveStatement(final MaxElementsStatement declared) {
+ public EmptyMaxElementsEffectiveStatement(final MaxElementsStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.min_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyMinElementsEffectiveStatement extends DefaultArgument<Integer, MinElementsStatement>
+public final class EmptyMinElementsEffectiveStatement extends DefaultArgument<Integer, MinElementsStatement>
implements MinElementsEffectiveStatement {
- EmptyMinElementsEffectiveStatement(final MinElementsStatement declared) {
+ public EmptyMinElementsEffectiveStatement(final MinElementsStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.namespace;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyNamespaceEffectiveStatement extends DefaultArgument<XMLNamespace, NamespaceStatement>
+public final class EmptyNamespaceEffectiveStatement extends DefaultArgument<XMLNamespace, NamespaceStatement>
implements NamespaceEffectiveStatement {
- EmptyNamespaceEffectiveStatement(final NamespaceStatement declared) {
+ public EmptyNamespaceEffectiveStatement(final NamespaceStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.common.Ordering;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyOrderedByEffectiveStatement extends DefaultArgument<Ordering, OrderedByStatement>
+public final class EmptyOrderedByEffectiveStatement extends DefaultArgument<Ordering, OrderedByStatement>
implements OrderedByEffectiveStatement {
- EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
+ public EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.organization;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyOrganizationEffectiveStatement extends DefaultArgument<String, OrganizationStatement>
+public final class EmptyOrganizationEffectiveStatement extends DefaultArgument<String, OrganizationStatement>
implements OrganizationEffectiveStatement {
- EmptyOrganizationEffectiveStatement(final OrganizationStatement declared) {
+ public EmptyOrganizationEffectiveStatement(final OrganizationStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.path;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.PathExpression;
import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyPathEffectiveStatement extends DefaultArgument<PathExpression, PathStatement>
+public final class EmptyPathEffectiveStatement extends DefaultArgument<PathExpression, PathStatement>
implements PathEffectiveStatement {
- EmptyPathEffectiveStatement(final PathStatement declared) {
+ public EmptyPathEffectiveStatement(final PathStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.position;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyPositionEffectiveStatement extends DefaultArgument<Uint32, PositionStatement>
+public final class EmptyPositionEffectiveStatement extends DefaultArgument<Uint32, PositionStatement>
implements PositionEffectiveStatement {
- EmptyPositionEffectiveStatement(final PositionStatement declared) {
+ public EmptyPositionEffectiveStatement(final PositionStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyReferenceEffectiveStatement extends DefaultArgument<String, ReferenceStatement>
+public final class EmptyReferenceEffectiveStatement extends DefaultArgument<String, ReferenceStatement>
implements ReferenceEffectiveStatement {
- EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
+ public EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
super(declared);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyRequireInstanceStatement;
+
+public final class EmptyRequireInstanceEffectiveStatement extends DefaultArgument<Boolean, RequireInstanceStatement>
+ implements RequireInstanceEffectiveStatement {
+ public static final @NonNull EmptyRequireInstanceEffectiveStatement FALSE =
+ new EmptyRequireInstanceEffectiveStatement(EmptyRequireInstanceStatement.FALSE);
+ public static final @NonNull EmptyRequireInstanceEffectiveStatement TRUE =
+ new EmptyRequireInstanceEffectiveStatement(EmptyRequireInstanceStatement.TRUE);
+
+ public EmptyRequireInstanceEffectiveStatement(final RequireInstanceStatement declared) {
+ super(declared);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyStatusStatement;
+
+public final class EmptyStatusEffectiveStatement extends DefaultArgument<Status, StatusStatement>
+ implements StatusEffectiveStatement {
+ /*
+ * status has low argument cardinality, hence we can reuse them in case declaration does not have any
+ * substatements (which is the usual case). Yeah, we could consider an EnumMap, but this is not too bad, either.
+ */
+ public static final @NonNull EmptyStatusEffectiveStatement CURRENT =
+ new EmptyStatusEffectiveStatement(EmptyStatusStatement.CURRENT);
+ public static final @NonNull EmptyStatusEffectiveStatement DEPRECATED =
+ new EmptyStatusEffectiveStatement(EmptyStatusStatement.DEPRECATED);
+ public static final @NonNull EmptyStatusEffectiveStatement OBSOLETE =
+ new EmptyStatusEffectiveStatement(EmptyStatusStatement.OBSOLETE);
+
+ public EmptyStatusEffectiveStatement(final StatusStatement declared) {
+ super(declared);
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.value;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyValueEffectiveStatement extends DefaultArgument<Integer, ValueStatement>
+public final class EmptyValueEffectiveStatement extends DefaultArgument<Integer, ValueStatement>
implements ValueEffectiveStatement {
- EmptyValueEffectiveStatement(final ValueStatement declared) {
+ public EmptyValueEffectiveStatement(final ValueStatement declared) {
super(declared);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.YangVersion;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyYangVersionStatement;
+
+public final class EmptyYangVersionEffectiveStatement extends DefaultArgument<YangVersion, YangVersionStatement>
+ implements YangVersionEffectiveStatement {
+ public static final @NonNull EmptyYangVersionEffectiveStatement VERSION_1 =
+ new EmptyYangVersionEffectiveStatement(EmptyYangVersionStatement.VERSION_1);
+ public static final @NonNull EmptyYangVersionEffectiveStatement VERSION_1_1 =
+ new EmptyYangVersionEffectiveStatement(EmptyYangVersionStatement.VERSION_1_1);
+
+ public EmptyYangVersionEffectiveStatement(final YangVersionStatement declared) {
+ super(declared);
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yin_element;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-final class EmptyYinElementEffectiveStatement extends DefaultArgument<Boolean, YinElementStatement>
+public final class EmptyYinElementEffectiveStatement extends DefaultArgument<Boolean, YinElementStatement>
implements YinElementEffectiveStatement {
- EmptyYinElementEffectiveStatement(final YinElementStatement declared) {
+ public EmptyYinElementEffectiveStatement(final YinElementStatement declared) {
super(declared);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.belongs_to;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularBelongsToEffectiveStatement extends WithSubstatements<String, BelongsToStatement>
+public final class RegularBelongsToEffectiveStatement extends WithSubstatements<String, BelongsToStatement>
implements BelongsToEffectiveStatement {
- RegularBelongsToEffectiveStatement(final BelongsToStatement declared,
+ public RegularBelongsToEffectiveStatement(final BelongsToStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularErrorAppTagEffectiveStatement extends WithSubstatements<String, ErrorAppTagStatement>
+public final class RegularErrorAppTagEffectiveStatement extends WithSubstatements<String, ErrorAppTagStatement>
implements ErrorAppTagEffectiveStatement {
- RegularErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared,
+ public RegularErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularErrorMessageEffectiveStatement extends WithSubstatements<String, ErrorMessageStatement>
+public final class RegularErrorMessageEffectiveStatement extends WithSubstatements<String, ErrorMessageStatement>
implements ErrorMessageEffectiveStatement {
- RegularErrorMessageEffectiveStatement(final ErrorMessageStatement declared,
+ public RegularErrorMessageEffectiveStatement(final ErrorMessageStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularFractionDigitsEffectiveStatement extends WithSubstatements<Integer, FractionDigitsStatement>
+public final class RegularFractionDigitsEffectiveStatement extends WithSubstatements<Integer, FractionDigitsStatement>
implements FractionDigitsEffectiveStatement {
- RegularFractionDigitsEffectiveStatement(final FractionDigitsStatement declared,
+ public RegularFractionDigitsEffectiveStatement(final FractionDigitsStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularIfFeatureEffectiveStatement extends WithSubstatements<IfFeatureExpr, IfFeatureStatement>
+public final class RegularIfFeatureEffectiveStatement extends WithSubstatements<IfFeatureExpr, IfFeatureStatement>
implements IfFeatureEffectiveStatement {
- RegularIfFeatureEffectiveStatement(final IfFeatureStatement declared,
+ public RegularIfFeatureEffectiveStatement(final IfFeatureStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.include;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularIncludeEffectiveStatement extends WithSubstatements<String, IncludeStatement>
+public final class RegularIncludeEffectiveStatement extends WithSubstatements<String, IncludeStatement>
implements IncludeEffectiveStatement {
- RegularIncludeEffectiveStatement(final IncludeStatement declared,
+ public RegularIncludeEffectiveStatement(final IncludeStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.mandatory;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularMandatoryEffectiveStatement extends WithSubstatements<Boolean, MandatoryStatement>
+public final class RegularMandatoryEffectiveStatement extends WithSubstatements<Boolean, MandatoryStatement>
implements MandatoryEffectiveStatement {
- RegularMandatoryEffectiveStatement(final MandatoryStatement declared,
+ public RegularMandatoryEffectiveStatement(final MandatoryStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.max_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularMaxElementsEffectiveStatement extends WithSubstatements<String, MaxElementsStatement>
+public final class RegularMaxElementsEffectiveStatement extends WithSubstatements<String, MaxElementsStatement>
implements MaxElementsEffectiveStatement {
- RegularMaxElementsEffectiveStatement(final MaxElementsStatement declared,
+ public RegularMaxElementsEffectiveStatement(final MaxElementsStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.min_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularMinElementsEffectiveStatement extends WithSubstatements<Integer, MinElementsStatement>
+public final class RegularMinElementsEffectiveStatement extends WithSubstatements<Integer, MinElementsStatement>
implements MinElementsEffectiveStatement {
- RegularMinElementsEffectiveStatement(final MinElementsStatement declared,
+ public RegularMinElementsEffectiveStatement(final MinElementsStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.namespace;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularNamespaceEffectiveStatement extends WithSubstatements<XMLNamespace, NamespaceStatement>
+public final class RegularNamespaceEffectiveStatement extends WithSubstatements<XMLNamespace, NamespaceStatement>
implements NamespaceEffectiveStatement {
- RegularNamespaceEffectiveStatement(final NamespaceStatement declared,
+ public RegularNamespaceEffectiveStatement(final NamespaceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.Ordering;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularOrderedByEffectiveStatement extends WithSubstatements<Ordering, OrderedByStatement>
+public final class RegularOrderedByEffectiveStatement extends WithSubstatements<Ordering, OrderedByStatement>
implements OrderedByEffectiveStatement {
- RegularOrderedByEffectiveStatement(final OrderedByStatement declared,
+ public RegularOrderedByEffectiveStatement(final OrderedByStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.organization;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularOrganizationEffectiveStatement extends WithSubstatements<String, OrganizationStatement>
+public final class RegularOrganizationEffectiveStatement extends WithSubstatements<String, OrganizationStatement>
implements OrganizationEffectiveStatement {
- RegularOrganizationEffectiveStatement(final OrganizationStatement declared,
+ public RegularOrganizationEffectiveStatement(final OrganizationStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.path;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.PathExpression;
import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularPathEffectiveStatement extends WithSubstatements<PathExpression, PathStatement>
+public final class RegularPathEffectiveStatement extends WithSubstatements<PathExpression, PathStatement>
implements PathEffectiveStatement {
- RegularPathEffectiveStatement(final PathStatement declared,
+ public RegularPathEffectiveStatement(final PathStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.position;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularPositionEffectiveStatement extends WithSubstatements<Uint32, PositionStatement>
+public final class RegularPositionEffectiveStatement extends WithSubstatements<Uint32, PositionStatement>
implements PositionEffectiveStatement {
- RegularPositionEffectiveStatement(final PositionStatement declared,
+ public RegularPositionEffectiveStatement(final PositionStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularReferenceEffectiveStatement extends WithSubstatements<String, ReferenceStatement>
+public final class RegularReferenceEffectiveStatement extends WithSubstatements<String, ReferenceStatement>
implements ReferenceEffectiveStatement {
- RegularReferenceEffectiveStatement(final ReferenceStatement declared,
+ public RegularReferenceEffectiveStatement(final ReferenceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.require_instance;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularRequireInstanceEffectiveStatement extends WithSubstatements<Boolean, RequireInstanceStatement>
+public final class RegularRequireInstanceEffectiveStatement extends WithSubstatements<Boolean, RequireInstanceStatement>
implements RequireInstanceEffectiveStatement {
- RegularRequireInstanceEffectiveStatement(final RequireInstanceStatement declared,
+ public RegularRequireInstanceEffectiveStatement(final RequireInstanceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularStatusEffectiveStatement extends WithSubstatements<Status, StatusStatement>
+public final class RegularStatusEffectiveStatement extends WithSubstatements<Status, StatusStatement>
implements StatusEffectiveStatement {
- RegularStatusEffectiveStatement(final StatusStatement declared,
+ public RegularStatusEffectiveStatement(final StatusStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.value;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularValueEffectiveStatement extends WithSubstatements<Integer, ValueStatement>
+public final class RegularValueEffectiveStatement extends WithSubstatements<Integer, ValueStatement>
implements ValueEffectiveStatement {
- RegularValueEffectiveStatement(final ValueStatement declared,
+ public RegularValueEffectiveStatement(final ValueStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularYangVersionEffectiveStatement extends WithSubstatements<YangVersion, YangVersionStatement>
+public final class RegularYangVersionEffectiveStatement extends WithSubstatements<YangVersion, YangVersionStatement>
implements YangVersionEffectiveStatement {
- RegularYangVersionEffectiveStatement(final YangVersionStatement declared,
+ public RegularYangVersionEffectiveStatement(final YangVersionStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yin_element;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
-final class RegularYinElementEffectiveStatement extends WithSubstatements<Boolean, YinElementStatement>
+public final class RegularYinElementEffectiveStatement extends WithSubstatements<Boolean, YinElementStatement>
implements YinElementEffectiveStatement {
- RegularYinElementEffectiveStatement(final YinElementStatement declared,
+ public RegularYinElementEffectiveStatement(final YinElementStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
super(declared, substatements);
}
*/
public interface EffectiveStatementWithFlags<A, D extends DeclaredStatement<A>> extends Mixin<A, D> {
/**
- * Return flags assicated with this statements. Flags can be built using {@link FlagsBuilder}.
+ * Return flags associated with this statements. Flags can be built using {@link FlagsBuilder}.
*
* @return Flag field value (32 bits).
*/
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
@Override
protected BelongsToEffectiveStatement createEffective(final Current<String, BelongsToStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyBelongsToEffectiveStatement(stmt.declared())
- : new RegularBelongsToEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createBelongsTo(stmt.declared(), substatements);
}
private static SourceIdentifier getSourceIdentifier(final StmtContext<String, BelongsToStatement,
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Override
protected ErrorAppTagEffectiveStatement createEffective(final Current<String, ErrorAppTagStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyErrorAppTagEffectiveStatement(stmt.declared())
- : new RegularErrorAppTagEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createErrorAppTag(stmt.declared(), substatements);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Override
protected ErrorMessageEffectiveStatement createEffective(final Current<String, ErrorMessageStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyErrorMessageEffectiveStatement(stmt.declared())
- : new RegularErrorMessageEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createErrorMessage(stmt.declared(), substatements);
}
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
-import static com.google.common.base.Verify.verifyNotNull;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
SubstatementValidator.builder(YangStmtMapping.FRACTION_DIGITS).build();
private static final FractionDigitsStatementSupport INSTANCE = new FractionDigitsStatementSupport();
- private static final ImmutableMap<Integer, FractionDigitsStatement> EMPTY_DECLS;
- private static final ImmutableMap<FractionDigitsStatement, EmptyFractionDigitsEffectiveStatement> EMPTY_EFF;
+ // FIXME: move this to yang-model-spi
+ private static final ImmutableMap<FractionDigitsStatement, FractionDigitsEffectiveStatement> EMPTY_EFF;
static {
- final Builder<Integer, FractionDigitsStatement> declBuilder = ImmutableMap.builder();
- final Builder<FractionDigitsStatement, EmptyFractionDigitsEffectiveStatement> effBuilder =
- ImmutableMap.builder();
-
+ final Builder<FractionDigitsStatement, FractionDigitsEffectiveStatement> effBuilder = ImmutableMap.builder();
for (int i = 1; i <= 18; ++i) {
- final Integer argument = i;
- final FractionDigitsStatement decl = DeclaredStatements.createFractionDigits(argument);
- declBuilder.put(argument, decl);
- effBuilder.put(decl, new EmptyFractionDigitsEffectiveStatement(decl));
+ final FractionDigitsStatement decl = DeclaredStatements.createFractionDigits(i);
+ effBuilder.put(decl, EffectiveStatements.createFractionDigits(decl));
}
-
- EMPTY_DECLS = declBuilder.build();
EMPTY_EFF = effBuilder.build();
}
@Override
protected FractionDigitsStatement createEmptyDeclared(final StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
- final Integer argument = ctx.getArgument();
- return verifyNotNull(EMPTY_DECLS.get(argument), "No declared instance for %s", argument);
+ return DeclaredStatements.createFractionDigits(ctx.getArgument());
}
@Override
protected FractionDigitsEffectiveStatement createEffective(final Current<Integer, FractionDigitsStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
- : new RegularFractionDigitsEffectiveStatement(stmt.declared(), substatements);
+ : EffectiveStatements.createFractionDigits(stmt.declared(), substatements);
}
private static @NonNull FractionDigitsEffectiveStatement createEmptyEffective(
final FractionDigitsStatement declared) {
- final EmptyFractionDigitsEffectiveStatement shared = EMPTY_EFF.get(declared);
- return shared != null ? shared : new EmptyFractionDigitsEffectiveStatement(declared);
+ final FractionDigitsEffectiveStatement shared = EMPTY_EFF.get(declared);
+ return shared != null ? shared : EffectiveStatements.createFractionDigits(declared);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.FeatureNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
@Override
protected final IfFeatureEffectiveStatement createEffective(final Current<IfFeatureExpr, IfFeatureStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyIfFeatureEffectiveStatement(stmt.declared())
- : new RegularIfFeatureEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createIfFeature(stmt.declared(), substatements);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.SubmoduleNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
@Override
protected IncludeEffectiveStatement createEffective(final Current<String, IncludeStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyIncludeEffectiveStatement(stmt.declared())
- : new RegularIncludeEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createInclude(stmt.declared(), substatements);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
private MandatoryStatementSupport() {
super(YangStmtMapping.MANDATORY,
- new EmptyMandatoryEffectiveStatement(DeclaredStatements.createMandatory(Boolean.FALSE)),
- new EmptyMandatoryEffectiveStatement(DeclaredStatements.createMandatory(Boolean.TRUE)),
+ EffectiveStatements.createMandatory(DeclaredStatements.createMandatory(Boolean.FALSE)),
+ EffectiveStatements.createMandatory(DeclaredStatements.createMandatory(Boolean.TRUE)),
StatementPolicy.contextIndependent());
}
@Override
protected MandatoryEffectiveStatement createEffective(final MandatoryStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularMandatoryEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createMandatory(declared, substatements);
}
@Override
protected MandatoryEffectiveStatement createEmptyEffective(final MandatoryStatement declared) {
- return new EmptyMandatoryEffectiveStatement(declared);
+ return EffectiveStatements.createMandatory(declared);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Override
protected MaxElementsEffectiveStatement createEffective(final Current<String, MaxElementsStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyMaxElementsEffectiveStatement(stmt.declared())
- : new RegularMaxElementsEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createMaxElements(stmt.declared(), substatements);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@Override
protected MinElementsEffectiveStatement createEffective(final MinElementsStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularMinElementsEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createMinElements(declared, substatements);
}
@Override
protected MinElementsEffectiveStatement createEmptyEffective(final MinElementsStatement declared) {
- return new EmptyMinElementsEffectiveStatement(declared);
+ return EffectiveStatements.createMinElements(declared);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Override
protected NamespaceEffectiveStatement createEffective(final Current<XMLNamespace, NamespaceStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyNamespaceEffectiveStatement(stmt.declared())
- : new RegularNamespaceEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createNamespace(stmt.declared(), substatements);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
* Ordered-by has low argument cardinality, hence we can reuse them in case declaration does not have any
* substatements (which is the usual case).
*/
+ // FIXME: move this to yang-model-spi
private static final @NonNull OrderedByStatement EMPTY_SYSTEM_DECL =
DeclaredStatements.createOrderedBy(Ordering.SYSTEM);
private static final @NonNull OrderedByStatement EMPTY_USER_DECL =
DeclaredStatements.createOrderedBy(Ordering.USER);
- private static final @NonNull EmptyOrderedByEffectiveStatement EMPTY_SYSTEM_EFF =
- new EmptyOrderedByEffectiveStatement(EMPTY_SYSTEM_DECL);
- private static final @NonNull EmptyOrderedByEffectiveStatement EMPTY_USER_EFF =
- new EmptyOrderedByEffectiveStatement(EMPTY_USER_DECL);
+ private static final @NonNull OrderedByEffectiveStatement EMPTY_SYSTEM_EFF =
+ EffectiveStatements.createOrderedBy(EMPTY_SYSTEM_DECL);
+ private static final @NonNull OrderedByEffectiveStatement EMPTY_USER_EFF =
+ EffectiveStatements.createOrderedBy(EMPTY_USER_DECL);
private OrderedByStatementSupport() {
super(YangStmtMapping.ORDERED_BY, StatementPolicy.contextIndependent());
protected OrderedByEffectiveStatement createEffective(final Current<Ordering, OrderedByStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
- : new RegularOrderedByEffectiveStatement(stmt.declared(), substatements);
+ : EffectiveStatements.createOrderedBy(stmt.declared(), substatements);
}
private static @NonNull OrderedByEffectiveStatement createEmptyEffective(final OrderedByStatement declared) {
} else if (EMPTY_SYSTEM_DECL.equals(declared)) {
return EMPTY_SYSTEM_EFF;
} else {
- return new EmptyOrderedByEffectiveStatement(declared);
+ return EffectiveStatements.createOrderedBy(declared);
}
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@Override
protected OrganizationEffectiveStatement createEffective(final OrganizationStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularOrganizationEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createOrganization(declared, substatements);
}
@Override
protected OrganizationEffectiveStatement createEmptyEffective(final OrganizationStatement declared) {
- return new EmptyOrganizationEffectiveStatement(declared);
+ return EffectiveStatements.createOrganization(declared);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Override
protected PathEffectiveStatement createEffective(final Current<PathExpression, PathStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? new EmptyPathEffectiveStatement(stmt.declared())
- : new RegularPathEffectiveStatement(stmt.declared(), substatements);
+ return EffectiveStatements.createPath(stmt.declared(), substatements);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@Override
protected PositionEffectiveStatement createEffective(final PositionStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularPositionEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createPosition(declared, substatements);
}
@Override
protected PositionEffectiveStatement createEmptyEffective(final PositionStatement declared) {
- return new EmptyPositionEffectiveStatement(declared);
+ return EffectiveStatements.createPosition(declared);
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@Override
protected ReferenceEffectiveStatement createEffective(final ReferenceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularReferenceEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createReference(declared, substatements);
}
@Override
protected ReferenceEffectiveStatement createEmptyEffective(final ReferenceStatement declared) {
- return new EmptyReferenceEffectiveStatement(declared);
+ return EffectiveStatements.createReference(declared);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.require_instance;
-
-import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyRequireInstanceEffectiveStatement extends DefaultArgument<Boolean, RequireInstanceStatement>
- implements RequireInstanceEffectiveStatement {
- EmptyRequireInstanceEffectiveStatement(final RequireInstanceStatement declared) {
- super(declared);
- }
-}
import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
private RequireInstanceStatementSupport() {
super(YangStmtMapping.REQUIRE_INSTANCE,
- new EmptyRequireInstanceEffectiveStatement(DeclaredStatements.createRequireInstance(Boolean.FALSE)),
- new EmptyRequireInstanceEffectiveStatement(DeclaredStatements.createRequireInstance(Boolean.TRUE)),
+ EffectiveStatements.createRequireInstance(false), EffectiveStatements.createRequireInstance(true),
StatementPolicy.contextIndependent());
}
@Override
protected RequireInstanceEffectiveStatement createEffective(final RequireInstanceStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularRequireInstanceEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createRequireInstance(declared, substatements);
}
@Override
- protected EmptyRequireInstanceEffectiveStatement createEmptyEffective(final RequireInstanceStatement declared) {
- return new EmptyRequireInstanceEffectiveStatement(declared);
+ protected RequireInstanceEffectiveStatement createEmptyEffective(final RequireInstanceStatement declared) {
+ return EffectiveStatements.createRequireInstance(declared);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
-
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyStatusEffectiveStatement extends DefaultArgument<Status, StatusStatement>
- implements StatusEffectiveStatement {
- EmptyStatusEffectiveStatement(final StatusStatement declared) {
- super(declared);
- }
-}
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
public final class StatusStatementSupport
extends AbstractStatementSupport<Status, StatusStatement, StatusEffectiveStatement> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
- .STATUS)
- .build();
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.STATUS).build();
private static final StatusStatementSupport INSTANCE = new StatusStatementSupport();
- /*
- * status has low argument cardinality, hence we can reuse them in case declaration does not have any
- * substatements (which is the usual case). Yeah, we could consider an EnumMap, but this is not too bad, either.
- */
- private static final @NonNull StatusStatement EMPTY_CURRENT_DECL = DeclaredStatements.createStatus(Status.CURRENT);
- private static final @NonNull StatusStatement EMPTY_DEPRECATED_DECL =
- DeclaredStatements.createStatus(Status.DEPRECATED);
- private static final @NonNull StatusStatement EMPTY_OBSOLETE_DECL =
- DeclaredStatements.createStatus(Status.OBSOLETE);
- private static final @NonNull EmptyStatusEffectiveStatement EMPTY_CURRENT_EFF =
- new EmptyStatusEffectiveStatement(EMPTY_CURRENT_DECL);
- private static final @NonNull EmptyStatusEffectiveStatement EMPTY_DEPRECATED_EFF =
- new EmptyStatusEffectiveStatement(EMPTY_DEPRECATED_DECL);
- private static final @NonNull EmptyStatusEffectiveStatement EMPTY_OBSOLETE_EFF =
- new EmptyStatusEffectiveStatement(EMPTY_OBSOLETE_DECL);
-
private StatusStatementSupport() {
super(YangStmtMapping.STATUS, StatementPolicy.contextIndependent());
}
@Override
protected StatusStatement createEmptyDeclared(final StmtContext<Status, StatusStatement, ?> ctx) {
- final Status argument = ctx.getArgument();
- switch (argument) {
- case CURRENT:
- return EMPTY_CURRENT_DECL;
- case DEPRECATED:
- return EMPTY_DEPRECATED_DECL;
- case OBSOLETE:
- return EMPTY_OBSOLETE_DECL;
- default:
- throw new IllegalStateException("Unhandled argument " + argument);
- }
+ return DeclaredStatements.createStatus(ctx.getArgument());
}
@Override
protected StatusEffectiveStatement createEffective(final Current<Status, StatusStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
- : new RegularStatusEffectiveStatement(stmt.declared(), substatements);
- }
-
- private static @NonNull StatusEffectiveStatement createEmptyEffective(final StatusStatement declared) {
- // Aggressively reuse effective instances which are backed by the corresponding empty declared instance, as this
- // is the case unless there is a weird extension in use.
- if (EMPTY_DEPRECATED_DECL.equals(declared)) {
- // Most likely to be seen (as current is the default)
- return EMPTY_DEPRECATED_EFF;
- } else if (EMPTY_OBSOLETE_DECL.equals(declared)) {
- // less likely
- return EMPTY_OBSOLETE_EFF;
- } else if (EMPTY_CURRENT_DECL.equals(declared)) {
- // ... okay, why is this there? :)
- return EMPTY_CURRENT_EFF;
- } else {
- return new EmptyStatusEffectiveStatement(declared);
- }
+ return EffectiveStatements.createStatus(stmt.declared(), substatements);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@Override
protected ValueEffectiveStatement createEffective(final ValueStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularValueEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createValue(declared, substatements);
}
@Override
protected ValueEffectiveStatement createEmptyEffective(@NonNull final ValueStatement declared) {
- return new EmptyValueEffectiveStatement(declared);
+ return EffectiveStatements.createValue(declared);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
-
-import org.opendaylight.yangtools.yang.common.YangVersion;
-import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyYangVersionEffectiveStatement extends DefaultArgument<YangVersion, YangVersionStatement>
- implements YangVersionEffectiveStatement {
- EmptyYangVersionEffectiveStatement(final YangVersionStatement declared) {
- super(declared);
- }
-}
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
public final class YangVersionStatementSupport
extends AbstractStatementSupport<YangVersion, YangVersionStatement, YangVersionEffectiveStatement> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
- .YANG_VERSION)
- .build();
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.YANG_VERSION).build();
private static final YangVersionStatementSupport INSTANCE = new YangVersionStatementSupport();
- private static final @NonNull YangVersionStatement EMPTY_VER1_DECL =
- DeclaredStatements.createYangVersion(YangVersion.VERSION_1);
- private static final @NonNull YangVersionStatement EMPTY_VER1_1_DECL =
- DeclaredStatements.createYangVersion(YangVersion.VERSION_1_1);
- private static final @NonNull EmptyYangVersionEffectiveStatement EMPTY_VER1_EFF =
- new EmptyYangVersionEffectiveStatement(EMPTY_VER1_DECL);
- private static final @NonNull EmptyYangVersionEffectiveStatement EMPTY_VER1_1_EFF =
- new EmptyYangVersionEffectiveStatement(EMPTY_VER1_1_DECL);
-
private YangVersionStatementSupport() {
super(YangStmtMapping.YANG_VERSION, StatementPolicy.reject());
}
@Override
protected YangVersionStatement createEmptyDeclared(final StmtContext<YangVersion, YangVersionStatement, ?> ctx) {
- final YangVersion argument = ctx.getArgument();
- switch (argument) {
- case VERSION_1:
- return EMPTY_VER1_DECL;
- case VERSION_1_1:
- return EMPTY_VER1_1_DECL;
- default:
- throw new IllegalStateException("Unhandled version " + argument);
- }
+ return DeclaredStatements.createYangVersion(ctx.getArgument());
}
@Override
protected YangVersionEffectiveStatement createEffective(final Current<YangVersion, YangVersionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
- : new RegularYangVersionEffectiveStatement(stmt.declared(), substatements);
- }
-
- private static @NonNull YangVersionEffectiveStatement createEmptyEffective(final YangVersionStatement declared) {
- if (EMPTY_VER1_DECL.equals(declared)) {
- return EMPTY_VER1_EFF;
- } else if (EMPTY_VER1_1_DECL.equals(declared)) {
- return EMPTY_VER1_1_EFF;
- } else {
- return new EmptyYangVersionEffectiveStatement(declared);
- }
+ return EffectiveStatements.createYangVersion(stmt.declared(), substatements);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
private YinElementStatementSupport() {
super(YangStmtMapping.YIN_ELEMENT,
- new EmptyYinElementEffectiveStatement(DeclaredStatements.createYinElement(Boolean.FALSE)),
- new EmptyYinElementEffectiveStatement(DeclaredStatements.createYinElement(Boolean.TRUE)),
+ EffectiveStatements.createYinElement(DeclaredStatements.createYinElement(false)),
+ EffectiveStatements.createYinElement(DeclaredStatements.createYinElement(true)),
StatementPolicy.reject());
}
@Override
protected YinElementEffectiveStatement createEffective(final YinElementStatement declared,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
- return new RegularYinElementEffectiveStatement(declared, substatements);
+ return EffectiveStatements.createYinElement(declared, substatements);
}
@Override
protected YinElementEffectiveStatement createEmptyEffective(final YinElementStatement declared) {
- return new EmptyYinElementEffectiveStatement(declared);
+ return EffectiveStatements.createYinElement(declared);
}
}