package net.onrc.onos.core.newintent;

import com.google.common.collect.ImmutableList;
import net.onrc.onos.api.newintent.InstallableIntent;

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

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * A class representing a result of intent compilation.
 */
public class IntentCompilationResult {
    private final List<InstallableIntent> result;

    /**
     * Constructs an instance containing the specified list of installable intents.
     *
     * @param result installable intents
     */
    public IntentCompilationResult(List<InstallableIntent> result) {
        checkNotNull(result);
        checkArgument(result.size() > 0,
                "result of intent compilation should be " +
                "more than 1 installable intents or more, but %s", result.size());

        this.result = new ArrayList<>(checkNotNull(result));
    }

    /**
     * Constructor for serializer.
     */
    protected IntentCompilationResult() {
        this.result = null;
    }

    /**
     * Returns list of installable intents that this object contains.
     *
     * @return installable intents
     */
    public List<InstallableIntent> getResult() {
        return ImmutableList.copyOf(result);
    }
}

package net.onrc.onos.core.newintent;

import com.google.common.collect.ImmutableList;
import net.onrc.onos.api.newintent.InstallableIntent;

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

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * A class representing a result of intent compilation.
 */
public class IntentCompilationResult {
    private final List<InstallableIntent> result;

    /**
     * Constructs an instance containing the specified list of installable intents.
     *
     * @param result installable intents
     */
    public IntentCompilationResult(List<InstallableIntent> result) {
        checkNotNull(result);
        checkArgument(result.size() > 0,
                "result of intent compilation should be " +
                "at least one installable intent, but %s", result.size());

        this.result = new ArrayList<>(checkNotNull(result));
    }

    /**
     * Constructor for serializer.
     */
    protected IntentCompilationResult() {
        this.result = null;
    }

    /**
     * Returns list of installable intents that this object contains.
     *
     * @return installable intents
     */
    public List<InstallableIntent> getResult() {
        return ImmutableList.copyOf(result);
    }
}

Revise message explaining the cause of exception
Revise message explaining the cause of exception

Change-Id: Ic6c6048f3e04d99c55b8de08ec4be1370139a549
