org.ovirt.engine.api.builders.V4ActionBuilder Maven / Gradle / Ivy
/*
Copyright (c) 2015 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.ovirt.engine.api.builders;
import org.ovirt.engine.api.containers.V4ActionContainer;
import org.ovirt.engine.api.types.V4Action;
import org.ovirt.engine.api.types.V4Fault;
import org.ovirt.engine.api.types.V4GracePeriod;
import org.ovirt.engine.api.types.V4Job;
import org.ovirt.engine.api.types.V4Status;
public class V4ActionBuilder {
private V4Fault fault;
private V4GracePeriod gracePeriod;
private V4Job job;
private V4Status status;
public V4ActionBuilder fault(V4Fault newFault) {
fault = newFault;
return this;
}
public V4ActionBuilder fault(V4FaultBuilder newFault) {
if (newFault == null) {
fault = null;
}
else {
fault = newFault.build();
}
return this;
}
public V4ActionBuilder gracePeriod(V4GracePeriod newGracePeriod) {
gracePeriod = newGracePeriod;
return this;
}
public V4ActionBuilder gracePeriod(V4GracePeriodBuilder newGracePeriod) {
if (newGracePeriod == null) {
gracePeriod = null;
}
else {
gracePeriod = newGracePeriod.build();
}
return this;
}
public V4ActionBuilder job(V4Job newJob) {
job = newJob;
return this;
}
public V4ActionBuilder job(V4JobBuilder newJob) {
if (newJob == null) {
job = null;
}
else {
job = newJob.build();
}
return this;
}
public V4ActionBuilder status(V4Status newStatus) {
status = newStatus;
return this;
}
public V4ActionBuilder status(V4StatusBuilder newStatus) {
if (newStatus == null) {
status = null;
}
else {
status = newStatus.build();
}
return this;
}
public V4Action build() {
V4ActionContainer container = new V4ActionContainer();
container.fault(fault);
container.gracePeriod(gracePeriod);
container.job(job);
container.status(status);
return container;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy