Class AbstractDeclaredStatement<A>
- java.lang.Object
-
- org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement<A>
-
- All Implemented Interfaces:
DeclaredStatement<A>
,ModelStatement<A>
- Direct Known Subclasses:
AbstractDeclaredStatement.ArgumentToString
,AbstractDeclaredStatement.WithQNameArgument
,AbstractDeclaredStatement.WithRawArgument
@Beta public abstract class AbstractDeclaredStatement<A> extends Object implements DeclaredStatement<A>
An abstract base class forDeclaredStatement
implementations. This is a direct competition toAbstractDeclaredStatement
, providing lower-footprint implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractDeclaredStatement.ArgumentToString<A>
static class
AbstractDeclaredStatement.WithArgument<A>
static class
AbstractDeclaredStatement.WithQNameArgument
static class
AbstractDeclaredStatement.WithRawArgument<A>
static class
AbstractDeclaredStatement.WithRawStringArgument
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDeclaredStatement()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<? extends DeclaredStatement<?>>
declaredSubstatements()
Returns collection of explicitly declared child statements, while preserving its original ordering from original source.StatementSource
getStatementSource()
Returns statement source, which denotes if statement was explicitly declared in original model or inferred during semantic processing of model.protected static @NonNull Object
maskList(ImmutableList<?> list)
Utility method for squashing singleton lists into single objects.protected static @NonNull ImmutableList<? extends DeclaredStatement<?>>
unmaskList(@NonNull Object masked)
Utility method for recovering singleton lists squashed bymaskList(ImmutableList)
.protected static <T> @NonNull ImmutableList<T>
unmaskList(@NonNull Object masked, @NonNull Class<T> type)
Utility method for recovering singleton lists squashed bymaskList(ImmutableList)
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement
declaredSubstatements, findFirstDeclaredSubstatement, findFirstDeclaredSubstatementArgument, rawArgument, streamDeclaredSubstatements
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.ModelStatement
argument, statementDefinition
-
-
-
-
Method Detail
-
getStatementSource
public StatementSource getStatementSource()
Description copied from interface:ModelStatement
Returns statement source, which denotes if statement was explicitly declared in original model or inferred during semantic processing of model.- Specified by:
getStatementSource
in interfaceModelStatement<A>
- Returns:
- statement source.
-
declaredSubstatements
public Collection<? extends DeclaredStatement<?>> declaredSubstatements()
Description copied from interface:DeclaredStatement
Returns collection of explicitly declared child statements, while preserving its original ordering from original source.- Specified by:
declaredSubstatements
in interfaceDeclaredStatement<A>
- Returns:
- Collection of statements, which were explicitly declared in source of model.
-
unmaskList
protected static final @NonNull ImmutableList<? extends DeclaredStatement<?>> unmaskList(@NonNull Object masked)
Utility method for recovering singleton lists squashed bymaskList(ImmutableList)
.- Parameters:
masked
- list to unmask- Returns:
- Unmasked list
- Throws:
NullPointerException
- if masked is nullClassCastException
- if masked object does not match DeclaredStatement
-
maskList
protected static final @NonNull Object maskList(ImmutableList<?> list)
Utility method for squashing singleton lists into single objects. This is a CPU/mem trade-off, which we are usually willing to make: for the cost of an instanceof check we can save one object and re-create it when needed. The inverse operation is #unmaskSubstatements(Object)}.- Parameters:
list
- list to mask- Returns:
- Masked list
- Throws:
NullPointerException
- if list is null
-
unmaskList
protected static final <T> @NonNull ImmutableList<T> unmaskList(@NonNull Object masked, @NonNull Class<T> type)
Utility method for recovering singleton lists squashed bymaskList(ImmutableList)
.- Parameters:
masked
- list to unmask- Returns:
- Unmasked list
- Throws:
NullPointerException
- if any argument is nullClassCastException
- if masked object does not match expected class
-
-