Class AbstractDeclaredStatement<A>
- java.lang.Object
-
- org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement<A>
-
- All Implemented Interfaces:
DeclaredStatement<A>
,ModelStatement<A>
- Direct Known Subclasses:
AbstractDeclaredStatement.ArgumentToString
,AbstractDeclaredStatement.WithoutArgument
,AbstractDeclaredStatement.WithQNameArgument
,AbstractDeclaredStatement.WithRawArgument
,EmptyOrderedByStatement
,EmptyPathStatement
,EmptyStatusStatement
,RegularOrderedByStatement
,RegularStatusStatement
@Beta public abstract class AbstractDeclaredStatement<A> extends Object implements DeclaredStatement<A>
An abstract base class forDeclaredStatement
implementations. It provides various further stateless and stateful subclasses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractDeclaredStatement.ArgumentToString<A>
static class
AbstractDeclaredStatement.WithArgument<A>
static class
AbstractDeclaredStatement.WithoutArgument
static class
AbstractDeclaredStatement.WithQNameArgument
static class
AbstractDeclaredStatement.WithRawArgument<A>
static class
AbstractDeclaredStatement.WithRawStringArgument
-
Constructor Summary
Constructors Constructor Description 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.protected static @NonNull Object
maskList(ImmutableList<?> list)
Utility method for squashing singleton lists into single objects.protected static @NonNull Object
maskSet(ImmutableSet<?> set)
StatementOrigin
statementOrigin()
ReturnsStatementOrigin
, which denotes if statement was explicitly declared in original model or inferred during semantic processing of model.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)
.protected static <T> @NonNull ImmutableSet<T>
unmaskSet(@NonNull Object masked, @NonNull Class<T> type)
-
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
declarationReference, declaredSubstatements, findFirstDeclaredSubstatement, findFirstDeclaredSubstatementArgument, rawArgument, streamDeclaredSubstatements
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.ModelStatement
argument, statementDefinition
-
-
-
-
Method Detail
-
statementOrigin
public StatementOrigin statementOrigin()
Description copied from interface:ModelStatement
ReturnsStatementOrigin
, which denotes if statement was explicitly declared in original model or inferred during semantic processing of model.- Specified by:
statementOrigin
in interfaceModelStatement<A>
- Returns:
- statement origin.
-
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
-
maskSet
protected static final @NonNull Object maskSet(ImmutableSet<?> set)
-
unmaskSet
protected static final <T> @NonNull ImmutableSet<T> unmaskSet(@NonNull Object masked, @NonNull Class<T> type)
-
-