Class AbstractDeclaredEffectiveStatement<A,D extends DeclaredStatement<A>>
- java.lang.Object
-
- org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveStatement<A,D>
-
- org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement<A,D>
-
- Type Parameters:
A
- Argument type (Void
if statement does not have argument.)D
- Class representing declared version of this statement.
- All Implemented Interfaces:
EffectiveStatement<A,D>
,ModelStatement<A>
- Direct Known Subclasses:
AbstractDeclaredEffectiveStatement.Default
,AbstractDeclaredEffectiveStatement.WithSchemaTree
@Beta public abstract class AbstractDeclaredEffectiveStatement<A,D extends DeclaredStatement<A>> extends AbstractEffectiveStatement<A,D>
Base stateless superclass for statements which (logically) always have an associatedDeclaredStatement
. This is notably not true for allcase
statements, some of which may actually be implied.Note implementations are not strictly required to make the declared statement available, they are free to throw
UnsupportedOperationException
fromgetDeclared()
, rendering any services relying on declared statement to be not available.
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description AbstractDeclaredEffectiveStatement()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract @NonNull D
getDeclared()
Returns statement, which was explicit declaration of this effective statement.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 Object
maskSet(ImmutableSet<?> set)
protected static <T> @NonNull ImmutableList<T>
unmaskList(@NonNull Object masked, @NonNull Class<T> type)
Utility method for recovering singleton lists squashed bymaskList(ImmutableList)
.protected static <T> @NonNull ImmutableSet<? extends T>
unmaskSet(@NonNull Object masked, @NonNull Class<T> type)
-
Methods inherited from class org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveStatement
effectiveSubstatements, get, getAll, getNamespaceContents, unmaskList
-
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.EffectiveStatement
findAll, findFirstEffectiveSubstatement, findFirstEffectiveSubstatementArgument, streamEffectiveSubstatements
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.ModelStatement
argument, statementDefinition
-
-
-
-
Method Detail
-
getStatementSource
public final 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.- Returns:
- statement source.
-
getDeclared
public abstract @NonNull D getDeclared()
Description copied from interface:EffectiveStatement
Returns statement, which was explicit declaration of this effective statement.- Returns:
- statement, which was explicit declaration of this effective statement or null if statement was inferred from context.
-
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
-
maskSet
protected static final @NonNull Object maskSet(ImmutableSet<?> set)
-
unmaskSet
protected static final <T> @NonNull ImmutableSet<? extends T> unmaskSet(@NonNull Object masked, @NonNull Class<T> type)
-
-