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

com.rosetta.model.lib.validation.ElementValidationResult Maven / Gradle / Ivy

Go to download

Responsibilities: defining the Java runtime necessary for running generated Java code.

There is a newer version: 9.18.1
Show newest version
package com.rosetta.model.lib.validation;

import com.rosetta.model.lib.path.RosettaPath;

import java.util.Optional;

public class ElementValidationResult{
	private boolean success;
	private Optional failureReason;
	private RosettaPath path;
	private Optional data;

	public ElementValidationResult(boolean success, String failureReason, RosettaPath path, ValidationData data) {
		this.success = success;
		this.failureReason = failureReason!=""?Optional.ofNullable(failureReason):Optional.empty();
		this.path = path;
		this.data = data!=null?Optional.ofNullable(data):Optional.empty();
	}

	public static ElementValidationResult success(RosettaPath path) {
		return new ElementValidationResult(true, "", path, null);
	}
	
	public static ElementValidationResult failure(RosettaPath path, String failureReason, ValidationData data) {
		return new ElementValidationResult(false, failureReason, path, data);
	}

	public boolean isSuccess() {
		return success;
	}

	public Optional getFailureReason() {
		return failureReason;
	}

	public RosettaPath getPath() {
		return path;
	}

	public Optional getData() {
		return data;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy