001/*
002 * Copyright c 2018 Rusi Popov, MDA Tools.net All rights reserved.
003 *
004 * This program and the accompanying materials are made available under the terms of the
005 * Eclipse Public License v2.0 which accompanies this distribution, and is available at
006 * http://www.eclipse.org/legal/epl-v20.html
007 */
008package net.mdatools.modelant.core.selector;
009
010import java.util.Collection;
011
012import javax.jmi.reflect.JmiException;
013import javax.jmi.reflect.RefObject;
014import javax.jmi.reflect.RefPackage;
015
016import net.mdatools.modelant.core.api.Selector;
017import net.mdatools.modelant.core.util.Navigator;
018
019/**
020 * Selector of all model elements, which are instances of the classes in the wrapped extent.
021 * @author popovr
022 */
023public class SelectAllObjects implements Selector<RefPackage, RefObject> {
024
025  /**
026   * @param sourceExtent not null extent where to collect all instances in
027   * @return not null collection of all model objects, that are instances of any model class in the wrapped extent
028   * @throws JmiException
029   * @see net.mdatools.modelant.core.api.Function#execute(java.lang.Object)
030   */
031  public Collection<RefObject> execute(RefPackage sourceExtent) throws JmiException {
032    Collection<RefObject> result;
033
034    result = Navigator.getAllObjects( sourceExtent );
035
036    return result;
037  }
038}