public static List<Object> getDecoratorLineage(Object obj) {
    List<Object> lineage = Lists.newArrayList(obj);
    Object currentObject = obj;
    while(currentObject instanceof Decorator) {
      currentObject = ((Decorator)currentObject).getDecoratedObject();
      lineage.add(currentObject);
    }

    return Lists.reverse(lineage);
  }
public static List < Object > getDecoratorLineage ( Object obj ) { List < Object > lineage = Lists . newArrayList ( obj ) ; Object currentObject = obj ; while ( currentObject instanceof Decorator ) { currentObject = ( ( Decorator ) currentObject ) . getDecoratedObject ( ) ; lineage . add ( currentObject ) ; } return Lists . reverse ( lineage ) ; }
Finds the decorator lineage of the given object.

<p>
If object is not a {@link org.apache.gobblin.util.Decorator}, this method will return a singleton list with just the object.
If object is a {@link org.apache.gobblin.util.Decorator}, it will return a list of the underlying object followed by the
decorator lineage up to the input decorator object.
</p>

@param obj an object.
@return List of the non-decorator underlying object and all decorators on top of it,
starting with underlying object and ending with the input object itself (inclusive).