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

java.lang.Object
org.opendaylight.yangtools.yang.model.api.meta.AbstractEffectiveStatement<A,D>
Type Parameters:
A - Argument type (Empty if statement does not have argument.)
D - Class representing declared version of this statement.
All Implemented Interfaces:
EffectiveStatement<A,D>, ModelStatement<A>

public abstract non-sealed class AbstractEffectiveStatement<A,D extends DeclaredStatement<A>> extends Object implements EffectiveStatement<A,D>
Abstract base class for EffectiveStatement implementations.
  • Constructor Details

    • AbstractEffectiveStatement

      public AbstractEffectiveStatement()
  • Method Details

    • unmaskList

      protected static final @NonNull com.google.common.collect.ImmutableList<? extends @NonNull EffectiveStatement<?,?>> unmaskList(@NonNull Object masked)
      Utility method for recovering singleton lists squashed by maskList(ImmutableList).
      Parameters:
      masked - list to unmask
      Returns:
      Unmasked list
      Throws:
      NullPointerException - if masked is null
      ClassCastException - if masked object does not match EffectiveStatement
    • filterOptional

      protected static final <E> @NonNull Optional<E> filterOptional(@NonNull Optional<?> optional, @NonNull Class<E> type)
    • findValue

      protected static final <K, V> @NonNull Optional<V> findValue(Map<K,V> map, K key)
    • 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 com.google.common.base.MoreObjects.ToStringHelper addToStringAttributes(com.google.common.base.MoreObjects.ToStringHelper helper)
    • maskList

      protected static final @NonNull Object maskList(com.google.common.collect.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 com.google.common.collect.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(com.google.common.collect.ImmutableSet<?> set)
    • unmaskSet

      protected static final <T> @NonNull com.google.common.collect.ImmutableSet<T> unmaskSet(@NonNull Object masked, @NonNull Class<T> type)