Class Util


  • public class Util
    extends Object
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • getOrElse

        public static <S> S getOrElse​(Optional<? extends S> opt,
                                      Supplier<? extends S> elseValue)
      • streamOfNullable

        public static <S> Stream<S> streamOfNullable​(Collection<S> nullableCollection)
      • getContainerOfType

        public static <T> Optional<T> getContainerOfType​(EObject obj,
                                                         Class<? extends T> type)
      • getFeatureBasedContainer

        public static Optional<EObject> getFeatureBasedContainer​(EObject obj,
                                                                 EStructuralFeature containingFeature)
        Walks up the containment tree until the given feauter is found. If the feature is found, the owner of the feature is returned as container. Otherwise an empty optional is returned.
        Parameters:
        obj - the object whose containers shall be traversed
        containingFeature - the feature type to look for
        Returns:
        the foudn container or an empty Optional otherwise