return new AnyxmlSchemaLocationStatementImpl(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected AnyxmlSchemaLocationStatement createEmptyDeclared(
- final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected AnyxmlSchemaLocationEffectiveStatement createEffective(
final Current<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement> stmt,
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractEmptyStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport.StatementPolicy;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
return new Declared(getPublicView(), substatements);
}
- @Override
- protected final OpenConfigHashedValueStatement createEmptyDeclared(
- final StmtContext<Empty, OpenConfigHashedValueStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected OpenConfigHashedValueEffectiveStatement createEffective(
final Current<Empty, OpenConfigHashedValueStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new Effective(stmt, substatements);
}
-
}
protected GetFilterElementAttributesStatement createDeclared(
final StmtContext<Empty, GetFilterElementAttributesStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new Declared(substatements);
- }
-
- @Override
- protected GetFilterElementAttributesStatement createEmptyDeclared(
- final StmtContext<Empty, GetFilterElementAttributesStatement, ?> ctx) {
- return Declared.EMPTY;
+ return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
}
@Override
@Override
protected DefaultDenyAllStatement createDeclared(final StmtContext<Empty, DefaultDenyAllStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new Declared(substatements);
- }
-
- @Override
- protected DefaultDenyAllStatement createEmptyDeclared(final StmtContext<Empty, DefaultDenyAllStatement, ?> ctx) {
- return Declared.EMPTY;
+ return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
}
@Override
@Override
protected DefaultDenyWriteStatement createDeclared(final StmtContext<Empty, DefaultDenyWriteStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new Declared(substatements);
- }
-
- @Override
- protected DefaultDenyWriteStatement createEmptyDeclared(
- final StmtContext<Empty, DefaultDenyWriteStatement, ?> ctx) {
- return Declared.EMPTY;
+ return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
}
@Override
return new AliasStatementImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected AliasStatement createEmptyDeclared(final StmtContext<String, AliasStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected AliasEffectiveStatement createEffective(final Current<String, AliasStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new DefValStatementImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected DefValStatement createEmptyDeclared(final StmtContext<String, DefValStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected DefValEffectiveStatement createEffective(final Current<String, DefValStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new DisplayHintStatementImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected DisplayHintStatement createEmptyDeclared(final StmtContext<String, DisplayHintStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected DisplayHintEffectiveStatement createEffective(final Current<String, DisplayHintStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new ImpliedStatementImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected ImpliedStatement createEmptyDeclared(final StmtContext<String, ImpliedStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected ImpliedEffectiveStatement createEffective(final Current<String, ImpliedStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new MaxAccessStatementImpl(ctx.getArgument(), substatements);
}
- @Override
- protected MaxAccessStatement createEmptyDeclared(final StmtContext<MaxAccess, MaxAccessStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected MaxAccessEffectiveStatement createEffective(final Current<MaxAccess, MaxAccessStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new OidIdStatementImpl(ctx.getArgument(), substatements);
}
- @Override
- protected OidStatement createEmptyDeclared(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected OidEffectiveStatement createEffective(final Current<ObjectIdentifier, OidStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new SubIdStatementImpl(ctx.getArgument(), substatements);
}
- @Override
- protected SubIdStatement createEmptyDeclared(final StmtContext<Uint32, SubIdStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected SubIdEffectiveStatement createEffective(final Current<Uint32, SubIdStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new Declared(ctx.getArgument(), substatements);
}
- @Override
- protected AnnotationStatement createEmptyDeclared(final StmtContext<QName, AnnotationStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected AnnotationEffectiveStatement createEffective(final Current<QName, AnnotationStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new Declared(ctx.getRawArgument(), substatements);
}
- @Override
- protected YangDataStatement createEmptyDeclared(final StmtContext<String, YangDataStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected YangDataEffectiveStatement createEffective(final Current<String, YangDataStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new Declared(ctx.getArgument(), substatements);
}
- @Override
- protected MountPointStatement createEmptyDeclared(final StmtContext<QName, MountPointStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected MountPointEffectiveStatement createEffective(final Current<QName, MountPointStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
// Hidden on purpose
}
- public static ActionStatement createAction(final QName argument) {
- return new EmptyActionStatement(argument);
- }
-
public static ActionStatement createAction(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createAction(argument) : new RegularActionStatement(argument, substatements);
- }
-
- public static AnydataStatement createAnydata(final QName argument) {
- return new EmptyAnydataStatement(argument);
+ return substatements.isEmpty() ? new EmptyActionStatement(argument)
+ : new RegularActionStatement(argument, substatements);
}
public static AnydataStatement createAnydata(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createAnydata(argument) : new RegularAnydataStatement(argument, substatements);
- }
-
- public static AnyxmlStatement createAnyxml(final QName argument) {
- return new EmptyAnyxmlStatement(argument);
+ return substatements.isEmpty() ? new EmptyAnydataStatement(argument)
+ : new RegularAnydataStatement(argument, substatements);
}
public static AnyxmlStatement createAnyxml(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createAnyxml(argument) : new RegularAnyxmlStatement(argument, substatements);
- }
-
- public static ArgumentStatement createArgument(final QName argument) {
- return new EmptyArgumentStatement(argument);
+ return substatements.isEmpty() ? new EmptyAnyxmlStatement(argument)
+ : new RegularAnyxmlStatement(argument, substatements);
}
public static ArgumentStatement createArgument(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createArgument(argument)
+ return substatements.isEmpty() ? new EmptyArgumentStatement(argument)
: new RegularArgumentStatement(argument, substatements);
}
- public static AugmentStatement createAugment(final String rawArgument, final SchemaNodeIdentifier argument) {
- return new EmptyAugmentStatement(rawArgument, argument);
- }
-
public static AugmentStatement createAugment(final String rawArgument, final SchemaNodeIdentifier argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createAugment(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyAugmentStatement(rawArgument, argument)
: new RegularAugmentStatement(rawArgument, argument, substatements);
}
- public static BaseStatement createBase(final QName argument) {
- return new EmptyBaseStatement(argument);
- }
-
public static BaseStatement createBase(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createBase(argument) : new RegularBaseStatement(argument, substatements);
- }
-
- public static BelongsToStatement createBelongsTo(final String argument) {
- return new EmptyBelongsToStatement(argument);
+ return substatements.isEmpty() ? new EmptyBaseStatement(argument)
+ : new RegularBaseStatement(argument, substatements);
}
public static BelongsToStatement createBelongsTo(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createBelongsTo(argument)
+ return substatements.isEmpty() ? new EmptyBelongsToStatement(argument)
: new RegularBelongsToStatement(argument, substatements);
}
- public static BitStatement createBit(final String argument) {
- return new EmptyBitStatement(argument);
- }
-
public static BitStatement createBit(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createBit(argument) : new RegularBitStatement(argument, substatements);
- }
-
- public static ChoiceStatement createChoice(final QName argument) {
- return new EmptyChoiceStatement(argument);
+ return substatements.isEmpty() ? new EmptyBitStatement(argument)
+ : new RegularBitStatement(argument, substatements);
}
public static ChoiceStatement createChoice(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createChoice(argument) : new RegularChoiceStatement(argument, substatements);
+ return substatements.isEmpty() ? new EmptyChoiceStatement(argument)
+ : new RegularChoiceStatement(argument, substatements);
}
public static ConfigStatement createConfig(final boolean argument) {
return substatements.isEmpty() ? createContact(argument) : new RegularContactStatement(argument, substatements);
}
- public static ContainerStatement createContainer(final QName argument) {
- return new EmptyContainerStatement(argument);
- }
-
public static ContainerStatement createContainer(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createContainer(argument)
+ return substatements.isEmpty() ? new EmptyContainerStatement(argument)
: new RegularContainerStatement(argument, substatements);
}
- public static DefaultStatement createDefault(final String argument) {
- return new EmptyDefaultStatement(argument);
- }
-
public static DefaultStatement createDefault(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createDefault(argument) : new RegularDefaultStatement(argument, substatements);
- }
-
- public static DescriptionStatement createDescription(final String argument) {
- return new EmptyDescriptionStatement(argument);
+ return substatements.isEmpty() ? new EmptyDefaultStatement(argument)
+ : new RegularDefaultStatement(argument, substatements);
}
public static DescriptionStatement createDescription(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createDescription(argument)
+ return substatements.isEmpty() ? new EmptyDescriptionStatement(argument)
: new RegularDescriptionStatement(argument, substatements);
}
- public static DeviateStatement createDeviate(final DeviateKind argument) {
- // This is exceedingly unlikely, just reuse the implementation
- return createDeviate(argument, ImmutableList.of());
- }
-
public static DeviateStatement createDeviate(final DeviateKind argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
return new DeviateStatementImpl(argument, substatements);
}
- public static DeviationStatement createDeviation(final String rawArgument, final Absolute argument) {
- // This does not make really sense
- return createDeviation(rawArgument, argument, ImmutableList.of());
- }
-
public static DeviationStatement createDeviation(final String rawArgument, final Absolute argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
return new DeviationStatementImpl(rawArgument, argument, substatements);
}
// FIXME: what is the distinction between rawArgument and argument?
- public static EnumStatement createEnum(final String rawArgument, final String argument) {
- return new EmptyEnumStatement(rawArgument, argument);
- }
-
public static EnumStatement createEnum(final String rawArgument, final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createEnum(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyEnumStatement(rawArgument, argument)
: new RegularEnumStatement(rawArgument, argument, substatements);
}
- public static ErrorAppTagStatement createErrorAppTag(final String argument) {
- return new EmptyErrorAppTagStatement(argument);
- }
-
public static ErrorAppTagStatement createErrorAppTag(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createErrorAppTag(argument)
+ return substatements.isEmpty() ? new EmptyErrorAppTagStatement(argument)
: new RegularErrorAppTagStatement(argument, substatements);
}
- public static ErrorMessageStatement createErrorMessage(final String argument) {
- return new EmptyErrorMessageStatement(argument);
- }
-
public static ErrorMessageStatement createErrorMessage(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createErrorMessage(argument)
+ return substatements.isEmpty() ? new EmptyErrorMessageStatement(argument)
: new RegularErrorMessageStatement(argument, substatements);
}
- public static ExtensionStatement createExtension(final QName argument) {
- return new EmptyExtensionStatement(argument);
- }
-
public static ExtensionStatement createExtension(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createExtension(argument)
+ return substatements.isEmpty() ? new EmptyExtensionStatement(argument)
: new RegularExtensionStatement(argument, substatements);
}
- public static FeatureStatement createFeature(final QName argument) {
- return new EmptyFeatureStatement(argument);
- }
-
public static FeatureStatement createFeature(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createFeature(argument) : new RegularFeatureStatement(argument, substatements);
+ return substatements.isEmpty() ? new EmptyFeatureStatement(argument)
+ : new RegularFeatureStatement(argument, substatements);
}
public static FractionDigitsStatement createFractionDigits(final int argument) {
: new RegularFractionDigitsStatement(argument, substatements);
}
- public static GroupingStatement createGrouping(final QName argument) {
- return new EmptyGroupingStatement(argument);
- }
-
public static GroupingStatement createGrouping(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createGrouping(argument)
+ return substatements.isEmpty() ? new EmptyGroupingStatement(argument)
: new RegularGroupingStatement(argument, substatements);
}
- public static IdentityStatement createIdentity(final QName argument) {
- return new EmptyIdentityStatement(argument);
- }
-
public static IdentityStatement createIdentity(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createIdentity(argument)
+ return substatements.isEmpty() ? new EmptyIdentityStatement(argument)
: new RegularIdentityStatement(argument, substatements);
}
- public static IfFeatureStatement createIfFeature(final String rawArgument, final IfFeatureExpr argument) {
- return new EmptyIfFeatureStatement(rawArgument, argument);
- }
-
public static IfFeatureStatement createIfFeature(final String rawArgument, final IfFeatureExpr argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createIfFeature(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyIfFeatureStatement(rawArgument, argument)
: new RegularIfFeatureStatement(rawArgument, argument, substatements);
}
- public static ImportStatement createImport(final String argument) {
- // This should never happen
- return createImport(argument, ImmutableList.of());
- }
-
public static ImportStatement createImport(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
return new ImportStatementImpl(argument, substatements);
}
- public static IncludeStatement createInclude(final String rawArgument, final String argument) {
- return new EmptyIncludeStatement(rawArgument, argument);
- }
-
public static IncludeStatement createInclude(final String rawArgument, final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createInclude(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyIncludeStatement(rawArgument, argument)
: new RegularIncludeStatement(rawArgument, argument, substatements);
}
return substatements.isEmpty() ? createInput(argument) : new RegularInputStatement(argument, substatements);
}
- public static KeyStatement createKey(final String rawArgument, final Set<QName> argument) {
- return new EmptyKeyStatement(rawArgument, argument);
- }
-
public static KeyStatement createKey(final String rawArgument, final Set<QName> argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createKey(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyKeyStatement(rawArgument, argument)
: new RegularKeyStatement(rawArgument, argument, substatements);
}
- public static LeafStatement createLeaf(final QName argument) {
- return new EmptyLeafStatement(argument);
- }
-
public static LeafStatement createLeaf(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createLeaf(argument) : new RegularLeafStatement(argument, substatements);
- }
-
- public static LeafListStatement createLeafList(final QName argument) {
- return new EmptyLeafListStatement(argument);
+ return substatements.isEmpty() ? new EmptyLeafStatement(argument)
+ : new RegularLeafStatement(argument, substatements);
}
public static LeafListStatement createLeafList(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createLeafList(argument)
+ return substatements.isEmpty() ? new EmptyLeafListStatement(argument)
: new RegularLeafListStatement(argument, substatements);
}
- public static LengthStatement createLength(final String rawArgument, final List<ValueRange> argument) {
- return new EmptyLengthStatement(rawArgument, argument);
- }
-
public static LengthStatement createLength(final String rawArgument, final List<ValueRange> argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createLength(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyLengthStatement(rawArgument, argument)
: new RegularLengthStatement(rawArgument, argument, substatements);
}
- public static ListStatement createList(final QName argument) {
- return new EmptyListStatement(argument);
- }
-
public static ListStatement createList(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createList(argument) : new RegularListStatement(argument, substatements);
+ return substatements.isEmpty() ? new EmptyListStatement(argument)
+ : new RegularListStatement(argument, substatements);
}
public static MandatoryStatement createMandatory(final Boolean argument) {
: new RegularMandatoryStatement(argument, substatements);
}
- public static MaxElementsStatement createMaxElements(final String rawArgument, final String argument) {
- return new EmptyMaxElementsStatement(rawArgument, argument);
- }
-
public static MaxElementsStatement createMaxElements(final String rawArgument, final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createMaxElements(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyMaxElementsStatement(rawArgument, argument)
: new RegularMaxElementsStatement(rawArgument, argument, substatements);
}
: new RegularMinElementsStatement(argument, substatements);
}
- public static ModifierStatement createModifier(final ModifierKind argument) {
- return new EmptyModifierStatement(argument);
- }
-
public static ModifierStatement createModifier(final ModifierKind argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createModifier(argument)
+ return substatements.isEmpty() ? new EmptyModifierStatement(argument)
: new RegularModifierStatement(argument, substatements);
}
return new ModuleStatementImpl(rawArgument, argument, substatements);
}
- public static MustStatement createMust(final String rawArgument, final QualifiedBound argument) {
- return new EmptyMustStatement(rawArgument, argument);
- }
-
public static MustStatement createMust(final String rawArgument, final QualifiedBound argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createMust(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyMustStatement(rawArgument, argument)
: new RegularMustStatement(rawArgument, argument, substatements);
}
- public static NamespaceStatement createNamespace(final XMLNamespace argument) {
- return new EmptyNamespaceStatement(argument);
- }
-
public static NamespaceStatement createNamespace(final XMLNamespace argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createNamespace(argument)
+ return substatements.isEmpty() ? new EmptyNamespaceStatement(argument)
: new RegularNamespaceStatement(argument, substatements);
}
- public static NotificationStatement createNotification(final QName argument) {
- return new EmptyNotificationStatement(argument);
- }
-
public static NotificationStatement createNotification(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createNotification(argument)
+ return substatements.isEmpty() ? new EmptyNotificationStatement(argument)
: new RegularNotificationStatement(argument, substatements);
}
: new RegularOrderedByStatement(argument, substatements);
}
- public static PathStatement createPath(final PathExpression argument) {
- return new EmptyPathStatement(argument);
- }
-
public static PathStatement createPath(final PathExpression argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createPath(argument) : new RegularPathStatement(argument, substatements);
- }
-
- public static PatternStatement createPattern(final PatternExpression argument) {
- return new EmptyPatternStatement(argument);
+ return substatements.isEmpty() ? new EmptyPathStatement(argument)
+ : new RegularPathStatement(argument, substatements);
}
public static PatternStatement createPattern(final PatternExpression argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createPattern(argument)
+ return substatements.isEmpty() ? new EmptyPatternStatement(argument)
: new RegularPatternStatement(argument, substatements);
}
- public static PositionStatement createPosition(final Uint32 argument) {
- return new EmptyPositionStatement(argument);
- }
-
public static PositionStatement createPosition(final Uint32 argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createPosition(argument)
+ return substatements.isEmpty() ? new EmptyPositionStatement(argument)
: new RegularPositionStatement(argument, substatements);
}
- public static PrefixStatement createPrefix(final String argument) {
- return new EmptyPrefixStatement(argument);
- }
-
public static PrefixStatement createPrefix(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createPrefix(argument) : new RegularPrefixStatement(argument, substatements);
- }
-
- public static PresenceStatement createPresence(final String argument) {
- return new EmptyPresenceStatement(argument);
+ return substatements.isEmpty() ? new EmptyPrefixStatement(argument)
+ : new RegularPrefixStatement(argument, substatements);
}
public static PresenceStatement createPresence(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createPresence(argument)
+ return substatements.isEmpty() ? new EmptyPresenceStatement(argument)
: new RegularPresenceStatement(argument, substatements);
}
: new RegularReferenceStatement(argument, substatements);
}
- public static RangeStatement createRange(final String rawArgument, final List<ValueRange> argument) {
- return new EmptyRangeStatement(rawArgument, argument);
- }
-
public static RangeStatement createRange(final String rawArgument, final List<ValueRange> argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createRange(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyRangeStatement(rawArgument, argument)
: new RegularRangeStatement(rawArgument, argument, substatements);
}
- public static RefineStatement createRefine(final String rawArgument, final Descendant argument) {
- return createRefine(rawArgument, argument, ImmutableList.of());
- }
-
public static RefineStatement createRefine(final String rawArgument, final Descendant argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
return new RefineStatementImpl(rawArgument, argument, substatements);
}
- public static RequireInstanceStatement createRequireInstance(final boolean argument) {
- return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
- }
-
public static RequireInstanceStatement createRequireInstance(final Boolean argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createRequireInstance(argument)
- : new RegularRequireInstanceStatement(argument, substatements);
- }
-
- public static RevisionStatement createRevision(final Revision argument) {
- return new EmptyRevisionStatement(argument);
+ if (substatements.isEmpty()) {
+ return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
+ }
+ return new RegularRequireInstanceStatement(argument, substatements);
}
public static RevisionStatement createRevision(final Revision argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createRevision(argument)
+ return substatements.isEmpty() ? new EmptyRevisionStatement(argument)
: new RegularRevisionStatement(argument, substatements);
}
- public static RevisionDateStatement createRevisionDate(final Revision argument) {
- return new EmptyRevisionDateStatement(argument);
- }
-
public static RevisionDateStatement createRevisionDate(final Revision argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createRevisionDate(argument)
+ return substatements.isEmpty() ? new EmptyRevisionDateStatement(argument)
: new RegularRevisionDateStatement(argument, substatements);
}
- public static RpcStatement createRpc(final QName argument) {
- return new EmptyRpcStatement(argument);
+ public static RpcStatement createRpc(final QName argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return substatements.isEmpty() ? new EmptyRpcStatement(argument)
+ : new RegularRpcStatement(argument, substatements);
}
- public static RpcStatement createRpc(final QName argument,
+ public static StatusStatement createStatus(final Status argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createRpc(argument) : new RegularRpcStatement(argument, substatements);
+ return substatements.isEmpty() ? createStatus(argument) : new RegularStatusStatement(argument, substatements);
}
- public static StatusStatement createStatus(final Status argument) {
+ private static StatusStatement createStatus(final Status argument) {
switch (argument) {
case CURRENT:
return EmptyStatusStatement.CURRENT;
}
}
- public static StatusStatement createStatus(final Status argument,
- final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createStatus(argument) : new RegularStatusStatement(argument, substatements);
- }
-
public static SubmoduleStatement createSubmodule(final String rawArgument, final UnqualifiedQName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
return new SubmoduleStatementImpl(rawArgument, argument, substatements);
}
- public static TypeStatement createType(final String argument) {
- return new EmptyTypeStatement(argument);
- }
-
public static TypeStatement createType(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createType(argument) : new RegularTypeStatement(argument, substatements);
- }
-
- public static TypedefStatement createTypedef(final QName argument) {
- return new EmptyTypedefStatement(argument);
+ return substatements.isEmpty() ? new EmptyTypeStatement(argument)
+ : new RegularTypeStatement(argument, substatements);
}
public static TypedefStatement createTypedef(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createTypedef(argument) : new RegularTypedefStatement(argument, substatements);
- }
-
- public static UniqueStatement createUnique(final String rawArgument, final Set<Descendant> argument) {
- return new EmptyUniqueStatement(rawArgument, argument);
+ return substatements.isEmpty() ? new EmptyTypedefStatement(argument)
+ : new RegularTypedefStatement(argument, substatements);
}
public static UniqueStatement createUnique(final String rawArgument, final Set<Descendant> argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createUnique(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyUniqueStatement(rawArgument, argument)
: new RegularUniqueStatement(rawArgument, argument, substatements);
}
- public static UnitsStatement createUnits(final String argument) {
- return new EmptyUnitsStatement(argument);
- }
-
public static UnitsStatement createUnits(final String argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createUnits(argument) : new RegularUnitsStatement(argument, substatements);
- }
-
- public static UsesStatement createUses(final String rawArgument, final QName argument) {
- return new EmptyUsesStatement(rawArgument, argument);
+ return substatements.isEmpty() ? new EmptyUnitsStatement(argument)
+ : new RegularUnitsStatement(argument, substatements);
}
public static UsesStatement createUses(final String rawArgument, final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createUses(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyUsesStatement(rawArgument, argument)
: new RegularUsesStatement(rawArgument, argument, substatements);
}
return substatements.isEmpty() ? createValue(argument) : new RegularValueStatement(argument, substatements);
}
- public static WhenStatement createWhen(final String rawArgument, final QualifiedBound argument) {
- return new EmptyWhenStatement(rawArgument, argument);
- }
-
public static WhenStatement createWhen(final String rawArgument, final QualifiedBound argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createWhen(rawArgument, argument)
+ return substatements.isEmpty() ? new EmptyWhenStatement(rawArgument, argument)
: new RegularWhenStatement(rawArgument, argument, substatements);
}
- public static YangVersionStatement createYangVersion(final YangVersion argument) {
+ public static YangVersionStatement createYangVersion(final YangVersion argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return substatements.isEmpty() ? createYangVersion(argument)
+ : new RegularYangVersionStatement(argument, substatements);
+ }
+
+ private static YangVersionStatement createYangVersion(final YangVersion argument) {
switch (argument) {
case VERSION_1:
return EmptyYangVersionStatement.VERSION_1;
}
}
- public static YangVersionStatement createYangVersion(final YangVersion argument,
- final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createYangVersion(argument)
- : new RegularYangVersionStatement(argument, substatements);
- }
-
public static YinElementStatement createYinElement(final boolean argument) {
return argument ? EmptyYinElementStatement.TRUE : EmptyYinElementStatement.FALSE;
}
// Hidden on purpose
}
- public static InputStatement createInput(final QName argument) {
- return new EmptyUndeclaredInputStatement(argument);
- }
-
public static InputStatement createInput(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createInput(argument)
+ return substatements.isEmpty() ? new EmptyUndeclaredInputStatement(argument)
: new RegularUndeclaredInputStatement(argument, substatements);
}
- public static OutputStatement createOutput(final QName argument) {
- return new EmptyUndeclaredOutputStatement(argument);
- }
-
public static OutputStatement createOutput(final QName argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return substatements.isEmpty() ? createOutput(argument)
+ return substatements.isEmpty() ? new EmptyUndeclaredOutputStatement(argument)
: new RegularUndeclaredOutputStatement(argument, substatements);
}
}
return new OpenConfigVersionStatementImpl(ctx.getArgument(), substatements);
}
- @Override
- protected OpenConfigVersionStatement createEmptyDeclared(
- final StmtContext<SemVer, OpenConfigVersionStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected OpenConfigVersionEffectiveStatement createEffective(
final Current<SemVer, OpenConfigVersionStatement> stmt,
return DeclaredStatements.createAugment(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected final AugmentStatement createEmptyDeclared(
- final StmtContext<SchemaNodeIdentifier, AugmentStatement, ?> ctx) {
- return DeclaredStatements.createAugment(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected final List<? extends StmtContext<?, ?, ?>> statementsToBuild(
final Current<SchemaNodeIdentifier, AugmentStatement> stmt,
protected CaseStatement createDeclared(final StmtContext<QName, CaseStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
final StatementSource source = ctx.source();
- switch (source) {
- case CONTEXT:
- return new RegularUndeclaredCaseStatement(ctx.getArgument(), substatements);
- case DECLARATION:
- return new RegularCaseStatement(ctx.getArgument(), substatements);
- default:
- throw new IllegalStateException("Unhandled statement source " + source);
- }
- }
-
- @Override
- protected CaseStatement createEmptyDeclared(final StmtContext<QName, CaseStatement, ?> ctx) {
- final StatementSource source = ctx.source();
- switch (source) {
- case CONTEXT:
- return new EmptyUndeclaredCaseStatement(ctx.getArgument());
- case DECLARATION:
- return new EmptyCaseStatement(ctx.getArgument());
- default:
- throw new IllegalStateException("Unhandled statement source " + source);
+ if (substatements.isEmpty()) {
+ switch (source) {
+ case CONTEXT:
+ return new EmptyUndeclaredCaseStatement(ctx.getArgument());
+ case DECLARATION:
+ return new EmptyCaseStatement(ctx.getArgument());
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
+ } else {
+ switch (source) {
+ case CONTEXT:
+ return new RegularUndeclaredCaseStatement(ctx.getArgument(), substatements);
+ case DECLARATION:
+ return new RegularCaseStatement(ctx.getArgument(), substatements);
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
}
}
return DeclaredStatements.createDeviate(ctx.getArgument(), substatements);
}
- @Override
- protected final DeviateStatement createEmptyDeclared(final StmtContext<DeviateKind, DeviateStatement, ?> ctx) {
- return DeclaredStatements.createDeviate(ctx.getArgument());
- }
-
@Override
protected final DeviateEffectiveStatement createEffective(final Current<DeviateKind, DeviateStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createExtension(ctx.getArgument(), substatements);
}
- @Override
- protected ExtensionStatement createEmptyDeclared(final StmtContext<QName, ExtensionStatement, ?> ctx) {
- return DeclaredStatements.createExtension(ctx.getArgument());
- }
-
@Override
protected ExtensionEffectiveStatement createEffective(final Current<QName, ExtensionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return new UnrecognizedStatementImpl(ctx.rawArgument(), ctx.publicDefinition(), substatements);
}
- @Override
- protected UnrecognizedStatement createEmptyDeclared(final StmtContext<Object, UnrecognizedStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
// createEffective() should never be called, ensure that for each declared statement
@Override
return DeclaredStatements.createIfFeature(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected final IfFeatureStatement createEmptyDeclared(
- final StmtContext<IfFeatureExpr, IfFeatureStatement, ?> ctx) {
- return DeclaredStatements.createIfFeature(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected final IfFeatureEffectiveStatement createEffective(final Current<IfFeatureExpr, IfFeatureStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createImport(ctx.getRawArgument(), substatements);
}
- @Override
- protected ImportStatement createEmptyDeclared(final StmtContext<String, ImportStatement, ?> ctx) {
- return DeclaredStatements.createImport(ctx.getRawArgument());
- }
-
@Override
protected ImportEffectiveStatement createEffective(final Current<String, ImportStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createKey(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected KeyStatement createEmptyDeclared(final StmtContext<Set<QName>, KeyStatement, ?> ctx) {
- return DeclaredStatements.createKey(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected KeyEffectiveStatement createEffective(final Current<Set<QName>, KeyStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createLeafList(ctx.getArgument(), substatements);
}
- @Override
- protected LeafListStatement createEmptyDeclared(final StmtContext<QName, LeafListStatement, ?> ctx) {
- return DeclaredStatements.createLeafList(ctx.getArgument());
- }
-
@Override
public LeafListEffectiveStatement copyEffective(final Current<QName, LeafListStatement> stmt,
final LeafListEffectiveStatement original) {
return DeclaredStatements.createList(ctx.getArgument(), substatements);
}
- @Override
- protected ListStatement createEmptyDeclared(final StmtContext<QName, ListStatement, ?> ctx) {
- return DeclaredStatements.createList(ctx.getArgument());
- }
-
@Override
public ListEffectiveStatement copyEffective(final Current<QName, ListStatement> stmt,
final ListEffectiveStatement original) {
return DeclaredStatements.createAction(ctx.getArgument(), substatements);
}
- @Override
- protected ActionStatement createEmptyDeclared(final StmtContext<QName, ActionStatement, ?> ctx) {
- return DeclaredStatements.createAction(ctx.getArgument());
- }
-
@Override
protected ActionEffectiveStatement createEffective(final Current<QName, ActionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createAnydata(ctx.getArgument(), substatements);
}
- @Override
- protected AnydataStatement createEmptyDeclared(final StmtContext<QName, AnydataStatement, ?> ctx) {
- return DeclaredStatements.createAnydata(ctx.getArgument());
- }
-
@Override
protected AnydataEffectiveStatement createEffective(final Current<QName, AnydataStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createAnyxml(ctx.getArgument(), substatements);
}
- @Override
- protected AnyxmlStatement createEmptyDeclared(final StmtContext<QName, AnyxmlStatement, ?> ctx) {
- return DeclaredStatements.createAnyxml(ctx.getArgument());
- }
-
@Override
protected AnyxmlEffectiveStatement createEffective(final Current<QName, AnyxmlStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createArgument(ctx.getArgument(), substatements);
}
- @Override
- protected ArgumentStatement createEmptyDeclared(final StmtContext<QName, ArgumentStatement, ?> ctx) {
- return DeclaredStatements.createArgument(ctx.getArgument());
- }
-
@Override
protected ArgumentEffectiveStatement createEffective(final Current<QName, ArgumentStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createBase(ctx.getArgument(), substatements);
}
- @Override
- protected BaseStatement createEmptyDeclared(final StmtContext<QName, BaseStatement, ?> ctx) {
- return DeclaredStatements.createBase(ctx.getArgument());
- }
-
@Override
protected BaseEffectiveStatement createEffective(final Current<QName, BaseStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createBelongsTo(ctx.getRawArgument(), substatements);
}
- @Override
- protected BelongsToStatement createEmptyDeclared(final StmtContext<String, BelongsToStatement, ?> ctx) {
- return DeclaredStatements.createBelongsTo(ctx.getRawArgument());
- }
-
@Override
protected BelongsToEffectiveStatement createEffective(final Current<String, BelongsToStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createBit(ctx.getArgument(), substatements);
}
- @Override
- protected BitStatement createEmptyDeclared(final StmtContext<String, BitStatement, ?> ctx) {
- return DeclaredStatements.createBit(ctx.getArgument());
- }
-
@Override
protected BitEffectiveStatement createEffective(final Current<String, BitStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createChoice(ctx.getArgument(), substatements);
}
- @Override
- protected ChoiceStatement createEmptyDeclared(@NonNull final StmtContext<QName, ChoiceStatement, ?> ctx) {
- return DeclaredStatements.createChoice(ctx.getArgument());
- }
-
@Override
public ChoiceEffectiveStatement copyEffective(final Current<QName, ChoiceStatement> stmt,
final ChoiceEffectiveStatement original) {
import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
import org.opendaylight.yangtools.yang.model.ri.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;
public final class ConfigStatementSupport
}
@Override
- protected ConfigStatement createDeclared(final StmtContext<Boolean, ConfigStatement, ?> ctx,
+ protected ConfigStatement createDeclared(final Boolean argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return DeclaredStatements.createConfig(ctx.getArgument(), substatements);
+ return DeclaredStatements.createConfig(argument, substatements);
}
@Override
return DeclaredStatements.createContainer(ctx.getArgument(), substatements);
}
- @Override
- protected ContainerStatement createEmptyDeclared(final StmtContext<QName, ContainerStatement, ?> ctx) {
- return DeclaredStatements.createContainer(ctx.getArgument());
- }
-
@Override
protected ContainerEffectiveStatement createEffective(final Current<QName, ContainerStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createDefault(ctx.getRawArgument(), substatements);
}
- @Override
- protected DefaultStatement createEmptyDeclared(final StmtContext<String, DefaultStatement, ?> ctx) {
- return DeclaredStatements.createDefault(ctx.getRawArgument());
- }
-
@Override
protected DefaultEffectiveStatement createEffective(final Current<String, DefaultStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createDescription(ctx.getRawArgument(), substatements);
}
- @Override
- protected DescriptionStatement createEmptyDeclared(final StmtContext<String, DescriptionStatement, ?> ctx) {
- return DeclaredStatements.createDescription(ctx.getRawArgument());
- }
-
@Override
protected DescriptionEffectiveStatement createEffective(final Current<String, DescriptionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createDeviation(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected DeviationStatement createEmptyDeclared(final StmtContext<Absolute, DeviationStatement, ?> ctx) {
- return DeclaredStatements.createDeviation(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected DeviationEffectiveStatement createEffective(final Current<Absolute, DeviationStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createEnum(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected EnumStatement createEmptyDeclared(final StmtContext<String, EnumStatement, ?> ctx) {
- return DeclaredStatements.createEnum(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected EnumEffectiveStatement createEffective(final Current<String, EnumStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createErrorAppTag(ctx.getRawArgument(), substatements);
}
- @Override
- protected ErrorAppTagStatement createEmptyDeclared(final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
- return DeclaredStatements.createErrorAppTag(ctx.getRawArgument());
- }
-
@Override
protected ErrorAppTagEffectiveStatement createEffective(final Current<String, ErrorAppTagStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createErrorMessage(ctx.getRawArgument(), substatements);
}
- @Override
- protected ErrorMessageStatement createEmptyDeclared(final StmtContext<String, ErrorMessageStatement, ?> ctx) {
- return DeclaredStatements.createErrorMessage(ctx.getRawArgument());
- }
-
@Override
protected ErrorMessageEffectiveStatement createEffective(final Current<String, ErrorMessageStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta;
import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
return DeclaredStatements.createFeature(ctx.getArgument(), substatements);
}
- @Override
- protected FeatureStatement createEmptyDeclared(@NonNull final StmtContext<QName, FeatureStatement, ?> ctx) {
- return DeclaredStatements.createFeature(ctx.getArgument());
- }
-
@Override
protected FeatureEffectiveStatement createEffective(final Current<QName, FeatureStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createFractionDigits(ctx.getArgument(), substatements);
}
- @Override
- protected FractionDigitsStatement createEmptyDeclared(final StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
- return DeclaredStatements.createFractionDigits(ctx.getArgument());
- }
-
@Override
protected FractionDigitsEffectiveStatement createEffective(final Current<Integer, FractionDigitsStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createGrouping(ctx.getArgument(), substatements);
}
- @Override
- protected GroupingStatement createEmptyDeclared(final StmtContext<QName, GroupingStatement, ?> ctx) {
- return DeclaredStatements.createGrouping(ctx.getArgument());
- }
-
@Override
protected GroupingEffectiveStatement createEffective(final Current<QName, GroupingStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createIdentity(ctx.getArgument(), substatements);
}
- @Override
- protected IdentityStatement createEmptyDeclared(final StmtContext<QName, IdentityStatement, ?> ctx) {
- return DeclaredStatements.createIdentity(ctx.getArgument());
- }
-
@Override
protected IdentityEffectiveStatement createEffective(final Current<QName, IdentityStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createInclude(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected IncludeStatement createEmptyDeclared(final StmtContext<String, IncludeStatement, ?> ctx) {
- return DeclaredStatements.createInclude(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected IncludeEffectiveStatement createEffective(final Current<String, IncludeStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
}
}
- @Override
- protected InputStatement createEmptyDeclared(final StmtContext<QName, InputStatement, ?> ctx) {
- final StatementSource source = ctx.source();
- switch (source) {
- case CONTEXT:
- return ImplicitStatements.createInput(ctx.getArgument());
- case DECLARATION:
- return DeclaredStatements.createInput(ctx.getArgument());
- default:
- throw new IllegalStateException("Unhandled statement source " + source);
- }
- }
-
@Override
protected InputEffectiveStatement copyDeclaredEffective(final int flags,
final Current<QName, InputStatement> stmt, final InputEffectiveStatement original) {
return DeclaredStatements.createLeaf(ctx.getArgument(), substatements);
}
- @Override
- protected LeafStatement createEmptyDeclared(final StmtContext<QName, LeafStatement, ?> ctx) {
- return DeclaredStatements.createLeaf(ctx.getArgument());
- }
-
@Override
public LeafEffectiveStatement copyEffective(final Current<QName, LeafStatement> stmt,
final LeafEffectiveStatement original) {
return DeclaredStatements.createLength(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected LengthStatement createEmptyDeclared(final StmtContext<List<ValueRange>, LengthStatement, ?> ctx) {
- return DeclaredStatements.createLength(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected LengthEffectiveStatement createEffective(final Current<List<ValueRange>, LengthStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
import org.opendaylight.yangtools.yang.model.ri.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;
public final class MandatoryStatementSupport extends
}
@Override
- protected MandatoryStatement createDeclared(final StmtContext<Boolean, MandatoryStatement, ?> ctx,
+ protected MandatoryStatement createDeclared(final Boolean argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return DeclaredStatements.createMandatory(ctx.getArgument(), substatements);
+ return DeclaredStatements.createMandatory(argument, substatements);
}
@Override
return DeclaredStatements.createMaxElements(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected MaxElementsStatement createEmptyDeclared(final StmtContext<String, MaxElementsStatement, ?> ctx) {
- return DeclaredStatements.createMaxElements(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected MaxElementsEffectiveStatement createEffective(final Current<String, MaxElementsStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createModifier(ctx.getArgument(), substatements);
}
- @Override
- protected ModifierStatement createEmptyDeclared(final StmtContext<ModifierKind, ModifierStatement, ?> ctx) {
- return DeclaredStatements.createModifier(ctx.getArgument());
- }
-
@Override
protected ModifierEffectiveStatement createEffective(final Current<ModifierKind, ModifierStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createNamespace(ctx.getArgument(), substatements);
}
- @Override
- protected NamespaceStatement createEmptyDeclared(final StmtContext<XMLNamespace, NamespaceStatement, ?> ctx) {
- return DeclaredStatements.createNamespace(ctx.getArgument());
- }
-
@Override
protected NamespaceEffectiveStatement createEffective(final Current<XMLNamespace, NamespaceStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
@Override
protected OrderedByStatement createDeclared(final StmtContext<Ordering, OrderedByStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return DeclaredStatements.createOrderedBy(ctx.getArgument(), substatements);
- }
-
- @Override
- protected OrderedByStatement createEmptyDeclared(final StmtContext<Ordering, OrderedByStatement, ?> ctx) {
- final Ordering argument = ctx.getArgument();
- switch (argument) {
- case SYSTEM:
- return EMPTY_SYSTEM_DECL;
- case USER:
- return EMPTY_USER_DECL;
- default:
- throw new IllegalStateException("Unhandled argument " + argument);
+ if (substatements.isEmpty()) {
+ final Ordering argument = ctx.getArgument();
+ switch (argument) {
+ case SYSTEM:
+ return EMPTY_SYSTEM_DECL;
+ case USER:
+ return EMPTY_USER_DECL;
+ default:
+ throw new IllegalStateException("Unhandled argument " + argument);
+ }
+ } else {
+ return DeclaredStatements.createOrderedBy(ctx.getArgument(), substatements);
}
}
}
}
- @Override
- protected OutputStatement createEmptyDeclared(final StmtContext<QName, OutputStatement, ?> ctx) {
- final StatementSource source = ctx.source();
- switch (source) {
- case CONTEXT:
- return ImplicitStatements.createOutput(ctx.getArgument());
- case DECLARATION:
- return DeclaredStatements.createOutput(ctx.getArgument());
- default:
- throw new IllegalStateException("Unhandled statement source " + source);
- }
- }
-
@Override
protected OutputEffectiveStatement copyDeclaredEffective(final int flags,
final Current<QName, OutputStatement> stmt, final OutputEffectiveStatement original) {
@Override
protected PositionStatement createEmptyDeclared(final Uint32 argument) {
- return DeclaredStatements.createPosition(argument);
+ return DeclaredStatements.createPosition(argument, ImmutableList.of());
}
@Override
return DeclaredStatements.createPrefix(ctx.getRawArgument(), substatements);
}
- @Override
- protected PrefixStatement createEmptyDeclared(final StmtContext<String, PrefixStatement, ?> ctx) {
- return DeclaredStatements.createPrefix(ctx.getRawArgument());
- }
-
@Override
protected PrefixEffectiveStatement createEffective(final Current<String, PrefixStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createPresence(ctx.getRawArgument(), substatements);
}
- @Override
- protected PresenceStatement createEmptyDeclared(final StmtContext<String, PresenceStatement, ?> ctx) {
- return DeclaredStatements.createPresence(ctx.getRawArgument());
- }
-
@Override
protected PresenceEffectiveStatement createEffective(final Current<String, PresenceStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createRange(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected RangeStatement createEmptyDeclared(final StmtContext<List<ValueRange>, RangeStatement, ?> ctx) {
- return DeclaredStatements.createRange(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected RangeEffectiveStatement createEffective(final Current<List<ValueRange>, RangeStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
import org.opendaylight.yangtools.yang.model.ri.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;
public final class RequireInstanceStatementSupport
}
@Override
- protected RequireInstanceStatement createDeclared(final StmtContext<Boolean, RequireInstanceStatement, ?> ctx,
+ protected RequireInstanceStatement createDeclared(final Boolean argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return DeclaredStatements.createRequireInstance(ctx.getArgument(), substatements);
+ return DeclaredStatements.createRequireInstance(argument, substatements);
}
@Override
return DeclaredStatements.createRevisionDate(ctx.getArgument(), substatements);
}
- @Override
- protected RevisionDateStatement createEmptyDeclared(final StmtContext<Revision, RevisionDateStatement, ?> ctx) {
- return DeclaredStatements.createRevisionDate(ctx.getArgument());
- }
-
@Override
protected RevisionDateEffectiveStatement createEffective(final Current<Revision, RevisionDateStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createRevision(ctx.getArgument(), substatements);
}
- @Override
- protected RevisionStatement createEmptyDeclared(final StmtContext<Revision, RevisionStatement, ?> ctx) {
- return DeclaredStatements.createRevision(ctx.getArgument());
- }
-
@Override
protected RevisionEffectiveStatement createEffective(final Current<Revision, RevisionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createRpc(ctx.getArgument(), substatements);
}
- @Override
- protected RpcStatement createEmptyDeclared(final StmtContext<QName, RpcStatement, ?> ctx) {
- return DeclaredStatements.createRpc(ctx.getArgument());
- }
-
@Override
protected RpcEffectiveStatement createEffective(final Current<QName, RpcStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createStatus(ctx.getArgument(), substatements);
}
- @Override
- protected StatusStatement createEmptyDeclared(final StmtContext<Status, StatusStatement, ?> ctx) {
- return DeclaredStatements.createStatus(ctx.getArgument());
- }
-
@Override
protected StatusEffectiveStatement createEffective(final Current<Status, StatusStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createTypedef(ctx.getArgument(), substatements);
}
- @Override
- protected TypedefStatement createEmptyDeclared(final StmtContext<QName, TypedefStatement, ?> ctx) {
- return DeclaredStatements.createTypedef(ctx.getArgument());
- }
-
@Override
protected TypedefEffectiveStatement createEffective(final Current<QName, TypedefStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createUnique(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected UniqueStatement createEmptyDeclared(final StmtContext<Set<Descendant>, UniqueStatement, ?> ctx) {
- return DeclaredStatements.createUnique(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected UniqueEffectiveStatement createEffective(final Current<Set<Descendant>, UniqueStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createUnits(ctx.getRawArgument(), substatements);
}
- @Override
- protected UnitsStatement createEmptyDeclared(final StmtContext<String, UnitsStatement, ?> ctx) {
- return DeclaredStatements.createUnits(ctx.getRawArgument());
- }
-
@Override
protected UnitsEffectiveStatement createEffective(final Current<String, UnitsStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createWhen(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected WhenStatement createEmptyDeclared(final StmtContext<QualifiedBound, WhenStatement, ?> ctx) {
- return DeclaredStatements.createWhen(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected WhenEffectiveStatement createEffective(final Current<QualifiedBound, WhenStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createYangVersion(ctx.getArgument(), substatements);
}
- @Override
- protected YangVersionStatement createEmptyDeclared(final StmtContext<YangVersion, YangVersionStatement, ?> ctx) {
- return DeclaredStatements.createYangVersion(ctx.getArgument());
- }
-
@Override
protected YangVersionEffectiveStatement createEffective(final Current<YangVersion, YangVersionStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
import org.opendaylight.yangtools.yang.model.ri.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;
public final class YinElementStatementSupport
}
@Override
- protected YinElementStatement createDeclared(final StmtContext<Boolean, YinElementStatement, ?> ctx,
+ protected YinElementStatement createDeclared(final Boolean argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return DeclaredStatements.createYinElement(ctx.getArgument(), substatements);
+ return DeclaredStatements.createYinElement(argument, substatements);
}
@Override
@Override
protected ModuleStatement createDeclared(final StmtContext<UnqualifiedQName, ModuleStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noNamespace(ctx);
+ }
return DeclaredStatements.createModule(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected ModuleStatement createEmptyDeclared(final StmtContext<UnqualifiedQName, ModuleStatement, ?> ctx) {
- throw noNamespace(ctx);
- }
-
@Override
protected ModuleEffectiveStatement createEffective(final Current<UnqualifiedQName, ModuleStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createMust(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected MustStatement createEmptyDeclared(final StmtContext<QualifiedBound, MustStatement, ?> ctx) {
- return DeclaredStatements.createMust(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected MustEffectiveStatement createEffective(final Current<QualifiedBound, MustStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createNotification(ctx.getArgument(), substatements);
}
- @Override
- protected final NotificationStatement createEmptyDeclared(final StmtContext<QName, NotificationStatement, ?> ctx) {
- return DeclaredStatements.createNotification(ctx.getArgument());
- }
-
@Override
protected final NotificationEffectiveStatement createEffective(final Current<QName, NotificationStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createPath(ctx.getArgument(), substatements);
}
- @Override
- protected PathStatement createEmptyDeclared(final StmtContext<PathExpression, PathStatement, ?> ctx) {
- return DeclaredStatements.createPath(ctx.getArgument());
- }
-
@Override
protected PathEffectiveStatement createEffective(final Current<PathExpression, PathStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createPattern(ctx.getArgument(), substatements);
}
- @Override
- protected PatternStatement createEmptyDeclared(
- final StmtContext<PatternExpression, PatternStatement, ?> ctx) {
- return DeclaredStatements.createPattern(ctx.getArgument());
- }
-
@Override
protected PatternEffectiveStatement createEffective(final Current<PatternExpression, PatternStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
return DeclaredStatements.createRefine(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected RefineStatement createEmptyDeclared(final StmtContext<Descendant, RefineStatement, ?> ctx) {
- // Empty refine is exceedingly unlikely: let's be lazy and reuse the implementation
- return DeclaredStatements.createRefine(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected RefineEffectiveStatement createEffective(final Current<Descendant, RefineStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
@Override
protected SubmoduleStatement createDeclared(final StmtContext<UnqualifiedQName, SubmoduleStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noBelongsTo(ctx);
+ }
return DeclaredStatements.createSubmodule(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected SubmoduleStatement createEmptyDeclared(
- final StmtContext<UnqualifiedQName, SubmoduleStatement, ?> ctx) {
- throw noBelongsTo(ctx);
- }
-
@Override
protected SubmoduleEffectiveStatement createEffective(final Current<UnqualifiedQName, SubmoduleStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
@Override
protected final IdentityRefSpecification createDeclared(final StmtContext<String, IdentityRefSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noBase(ctx);
+ }
return new IdentityRefSpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected final IdentityRefSpecification createEmptyDeclared(
- final StmtContext<String, IdentityRefSpecification, ?> ctx) {
- throw noBase(ctx);
- }
-
@Override
protected final EffectiveStatement<String, IdentityRefSpecification> createEffective(
final Current<String, IdentityRefSpecification> stmt,
@Override
protected final LeafrefSpecification createDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noPath(ctx);
+ }
return new LeafrefSpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected final LeafrefSpecification createEmptyDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx) {
- throw noPath(ctx);
- }
-
@Override
protected EffectiveStatement<String, LeafrefSpecification> createEffective(
final Current<String, LeafrefSpecification> stmt,
@Override
protected final TypeStatement createDeclared(final StmtContext<String, TypeStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ final TypeStatement builtin = BuiltinTypeStatement.lookup(ctx);
+ if (builtin != null) {
+ return builtin;
+ }
+ }
return DeclaredStatements.createType(ctx.getRawArgument(), substatements);
}
- @Override
- protected final TypeStatement createEmptyDeclared(final StmtContext<String, TypeStatement, ?> ctx) {
- final TypeStatement builtin;
- return (builtin = BuiltinTypeStatement.lookup(ctx)) != null ? builtin
- : DeclaredStatements.createType(ctx.getRawArgument());
- }
-
@Override
protected EffectiveStatement<String, TypeStatement> createEffective(final Current<String, TypeStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
@Override
protected BitsSpecification createDeclared(final StmtContext<String, BitsSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noBits(ctx);
+ }
return new BitsSpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected BitsSpecification createEmptyDeclared(final StmtContext<String, BitsSpecification, ?> ctx) {
- throw noBits(ctx);
- }
-
@Override
protected EffectiveStatement<String, BitsSpecification> createEffective(
final Current<String, BitsSpecification> stmt,
@Override
protected Decimal64Specification createDeclared(final StmtContext<String, Decimal64Specification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noFracDigits(ctx);
+ }
return new Decimal64SpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected Decimal64Specification createEmptyDeclared(final StmtContext<String, Decimal64Specification, ?> ctx) {
- throw noFracDigits(ctx);
- }
-
@Override
protected EffectiveStatement<String, Decimal64Specification> createEffective(
final Current<String, Decimal64Specification> stmt,
@Override
protected EnumSpecification createDeclared(final StmtContext<String, EnumSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noEnum(ctx);
+ }
return new EnumSpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected EnumSpecification createEmptyDeclared(final StmtContext<String, EnumSpecification, ?> ctx) {
- throw noEnum(ctx);
- }
-
@Override
protected EffectiveStatement<String, EnumSpecification> createEffective(
final Current<String, EnumSpecification> stmt,
protected InstanceIdentifierSpecification createDeclared(
final StmtContext<String, InstanceIdentifierSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new RegularInstanceIdentifierSpecification(ctx.getRawArgument(), substatements);
- }
-
- @Override
- protected InstanceIdentifierSpecification createEmptyDeclared(
- final StmtContext<String, InstanceIdentifierSpecification, ?> ctx) {
- return new EmptyIdentifierSpecification(ctx.getRawArgument());
+ return substatements.isEmpty() ? new EmptyIdentifierSpecification(ctx.getRawArgument())
+ : new RegularInstanceIdentifierSpecification(ctx.getRawArgument(), substatements);
}
@Override
@Override
protected UnionSpecification createDeclared(final StmtContext<String, UnionSpecification, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ if (substatements.isEmpty()) {
+ throw noType(ctx);
+ }
return new UnionSpecificationImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected UnionSpecification createEmptyDeclared(final StmtContext<String, UnionSpecification, ?> ctx) {
- throw noType(ctx);
- }
-
@Override
protected EffectiveStatement<String, UnionSpecification> createEffective(
final Current<String, UnionSpecification> stmt,
return DeclaredStatements.createUses(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
- @Override
- protected UsesStatement createEmptyDeclared(final StmtContext<QName, UsesStatement, ?> ctx) {
- return DeclaredStatements.createUses(ctx.getRawArgument(), ctx.getArgument());
- }
-
@Override
protected UsesEffectiveStatement createEffective(final Current<QName, UsesStatement> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
public final class ThirdPartyExtensionSupport
extends AbstractStringStatementSupport<ThirdPartyExtensionStatement, ThirdPartyExtensionEffectiveStatement> {
-
private static final ThirdPartyExtensionSupport INSTANCE = new ThirdPartyExtensionSupport();
private ThirdPartyExtensionSupport() {
return new ThirdPartyExtensionStatementImpl(ctx.getRawArgument(), substatements);
}
- @Override
- protected ThirdPartyExtensionStatement createEmptyDeclared(
- final StmtContext<String, ThirdPartyExtensionStatement, ?> ctx) {
- return createDeclared(ctx, ImmutableList.of());
- }
-
@Override
protected ThirdPartyExtensionEffectiveStatement createEffective(
final Current<String, ThirdPartyExtensionStatement> stmt,
}
@Override
- protected final D createEmptyDeclared(final StmtContext<Boolean, D, ?> ctx) {
- return ctx.getArgument() ? emptyDeclaredTrue : emptyDeclaredFalse;
+ protected final D createDeclared(final StmtContext<Boolean, D, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ final Boolean argument = ctx.getArgument();
+ if (substatements.isEmpty()) {
+ return argument ? emptyDeclaredTrue : emptyDeclaredFalse;
+ }
+ return createDeclared(argument, substatements);
}
+ protected abstract @NonNull D createDeclared(@NonNull Boolean argument,
+ @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
+
@Override
protected final E createEffective(final Current<Boolean, D> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
}
@Override
- protected final D createEmptyDeclared(final StmtContext<A, D, ?> ctx) {
- return declaredCache.getUnchecked(ctx.getArgument());
+ protected final D createDeclared(final StmtContext<A, D, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ final A argument = ctx.getArgument();
+ return substatements.isEmpty() ? declaredCache.getUnchecked(ctx.getArgument())
+ : createDeclared(argument, substatements);
}
+ protected abstract @NonNull D createDeclared(@NonNull A argument,
+ @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
+
protected abstract @NonNull D createEmptyDeclared(@NonNull A argument);
@Override
@NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements);
protected abstract @NonNull E createEmptyEffective(@NonNull D declared);
-
- @Override
- protected final D createDeclared(final StmtContext<A, D, ?> ctx,
- final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return createDeclared(ctx.getArgument(), substatements);
- }
-
- protected abstract @NonNull D createDeclared(@NonNull A argument,
- ImmutableList<? extends DeclaredStatement<?>> substatements);
}
@Override
public final D createDeclared(final StmtContext<A, D, ?> ctx) {
- final ImmutableList<? extends DeclaredStatement<?>> substatements = ctx.declaredSubstatements().stream()
- .map(StmtContext::declared)
- .collect(ImmutableList.toImmutableList());
- return substatements.isEmpty() ? createEmptyDeclared(ctx) : createDeclared(ctx, substatements);
+ return createDeclared(ctx, ctx.declaredSubstatements().stream()
+ .map(StmtContext::declared)
+ .collect(ImmutableList.toImmutableList()));
}
protected abstract @NonNull D createDeclared(@NonNull StmtContext<A, D, ?> ctx,
@NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
- protected abstract @NonNull D createEmptyDeclared(@NonNull StmtContext<A, D, ?> ctx);
-
@Override
public final E createEffective(final Current<A, D> stmt,
final Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements,