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

ai.stapi.graphsystem.operationdefinition.exceptions.CannotMergeOperationDefinition Maven / Gradle / Ivy

package ai.stapi.graphsystem.operationdefinition.exceptions;


public class CannotMergeOperationDefinition extends RuntimeException {

  private CannotMergeOperationDefinition(String becauseMessage) {
    super("Cannot merge Operation Definition, because " + becauseMessage);
  }

  public static CannotMergeOperationDefinition becauseSomeFieldIsNotSame(
      String fieldName,
      Object originalValue,
      Object otherValue
  ) {
    return new CannotMergeOperationDefinition(
        String.format(
            "field '%s' has different value, but they should be same.%nOriginal: '%s'%nOther: '%s'",
            fieldName,
            originalValue,
            otherValue
        )
    );
  }

  public static CannotMergeOperationDefinition becauseSomeParameterHasSomeFieldWhichIsNotSame(
      String parameterName,
      String fieldName,
      Object originalValue,
      Object otherValue
  ) {
    return new CannotMergeOperationDefinition(
        String.format(
            "parameter '%s' has field '%s' with different values, "
                + "but they should be same.%nOriginal: '%s'%nOther: '%s'",
            parameterName,
            fieldName,
            originalValue,
            otherValue
        )
    );
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy