All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.javers.spring.auditable.AspectUtil Maven / Gradle / Ivy

There is a newer version: 7.6.2
Show newest version
package org.javers.spring.auditable;

import org.aspectj.lang.JoinPoint;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author bartosz walacik
 */
public class AspectUtil {
    public static Iterable collectArguments(JoinPoint jp){
        List result = new ArrayList<>();

        for (Object arg: jp.getArgs()) {
            if (arg instanceof Collection) {
                result.addAll((Collection)arg);
            } else {
                result.add(arg);
            }
        }
        return result;
    }
}