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

com.litongjava.model.validate.ValidateResult Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package com.litongjava.model.validate;

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

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class ValidateResult {
  private String field;
  private List messages;

  public static List toList(String field, String message) {
    ValidateResult verifyResult = by(field, message);

    List verifyResults = new ArrayList<>();
    verifyResults.add(verifyResult);
    return verifyResults;
  }

  public static ValidateResult by(String field, String message) {
    List messages = new ArrayList<>();
    messages.add(message);

    ValidateResult verifyResult = by(field, messages);
    return verifyResult;
  }

  public static ValidateResult by(String field, List messages) {
    ValidateResult verifyResult = new ValidateResult(field, messages);
    return verifyResult;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy