Class AbstractUndeclaredEffectiveStatement<A,D extends DeclaredStatement<A>>

java.lang.Object
org.opendaylight.yangtools.yang.model.api.meta.AbstractEffectiveStatement<A,D>
org.opendaylight.yangtools.yang.model.spi.meta.AbstractUndeclaredEffectiveStatement<A,D>
All Implemented Interfaces:
EffectiveStatement<A,D>, ModelStatement<A>
Direct Known Subclasses:
AbstractUndeclaredEffectiveStatement.WithSchemaTree, UndeclaredLeafEffectiveStatement

@Beta public abstract non-sealed class AbstractUndeclaredEffectiveStatement<A,D extends DeclaredStatement<A>> extends AbstractEffectiveStatement<A,D>
  • Constructor Details

    • AbstractUndeclaredEffectiveStatement

      public AbstractUndeclaredEffectiveStatement()
  • Method Details

    • getDeclared

      public final 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.
    • get

      public final <K, V, N extends IdentifierNamespace<K, V>> Optional<V> get(Class<N> namespace, K identifier)
      Description copied from interface: EffectiveStatement
      Returns value associated with supplied identifier.
      Type Parameters:
      K - Identifier type
      V - Value type
      N - Namespace identifier type
      Parameters:
      namespace - Namespace type
      identifier - Identifier of element.
      Returns:
      Value if present
    • getAll

      public final <K, V, N extends IdentifierNamespace<K, V>> Map<K,V> getAll(Class<N> namespace)
      Description copied from interface: EffectiveStatement
      Returns all local values from supplied namespace.
      Type Parameters:
      K - Identifier type
      V - Value type
      N - Namespace identifier type
      Parameters:
      namespace - Namespace type
      Returns:
      Key-value mappings, empty if the namespace does not exist.
    • effectiveSubstatements

      public ImmutableList<? extends EffectiveStatement<?,?>> effectiveSubstatements()
      Description copied from interface: EffectiveStatement
      Returns a collection of all effective substatements.
      Returns:
      collection of all effective substatements.
    • getNamespaceContents

      protected <K, V, N extends IdentifierNamespace<K, V>> Optional<? extends Map<K,V>> getNamespaceContents(@NonNull Class<N> namespace)
      Return the statement-specific contents of specified namespace, if available.
      Parameters:
      namespace - Requested namespace
      Returns:
      Namespace contents, if available.
    • createSchemaTreeNamespace

      protected static @NonNull Map<QName,SchemaTreeEffectiveStatement<?>> createSchemaTreeNamespace(Collection<? extends EffectiveStatement<?,?>> substatements)
      Create a Map containing the contents of the schema tree. Retur
      Parameters:
      substatements - Substatements to index
      Returns:
      Index of the schema tree as a mutable Map
      Throws:
      NullPointerException - if substatements is null
    • createDataTreeNamespace

      protected static @NonNull Map<QName,DataTreeEffectiveStatement<?>> createDataTreeNamespace(Collection<SchemaTreeEffectiveStatement<?>> schemaTreeStatements, Map<QName,SchemaTreeEffectiveStatement<?>> schemaTreeNamespace)
    • immutableNamespaceOf

      protected static <T extends SchemaTreeEffectiveStatement<?>> @NonNull Map<QName,T> immutableNamespaceOf(Map<QName,T> map)
    • createTypedefNamespace

      protected static @NonNull HashMap<QName,TypedefEffectiveStatement> createTypedefNamespace(Collection<? extends EffectiveStatement<?,?>> substatements)
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • addToStringAttributes

      protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper helper)
    • 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 by maskList(ImmutableList).
      Parameters:
      masked - list to unmask
      Returns:
      Unmasked list
      Throws:
      NullPointerException - if any argument is null
      ClassCastException - 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)