blob: 34a5a748e4cb7f213b29fb1c0e53f7d4096070e5 [file] [log] [blame]
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);
}
}