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.operation.element;
009
010import javax.jmi.reflect.RefFeatured;
011
012/**
013 * Navigate down the path and retrieve the referred attribute/association's value
014 * @author Rusi Popov (popovr@mdatools.net)
015 */
016public class Get extends NavigateObjectPath<Object> {
017
018  public Get(String path) {
019    super( path );
020  }
021
022  public Get(String[] path) {
023    super( path );
024  }
025
026
027  /**
028   * @return start as there is no navigation path from it
029   * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processEmptyPath(javax.jmi.reflect.RefFeatured)
030   */
031  protected Object processEmptyPath(RefFeatured start) {
032    return start;
033  }
034
035  /**
036   * @return associated
037   * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, javax.jmi.reflect.RefFeatured)
038   */
039  protected Object processLast(RefFeatured start, RefFeatured current, String itemName, RefFeatured associated) {
040    return associated;
041  }
042
043  /**
044   * @return value
045   * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, java.lang.Object)
046   */
047  protected Object processLast(RefFeatured start, RefFeatured current, String itemName, Object value) {
048    return value;
049  }
050}