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

uk.co.mruoc.nac.entities.SortOrder Maven / Gradle / Ivy

There is a newer version: 0.1.42
Show newest version
package uk.co.mruoc.nac.entities;

import static uk.co.mruoc.nac.entities.SortOrder.Direction.ASC;
import static uk.co.mruoc.nac.entities.SortOrder.Direction.DESC;

import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Builder
@RequiredArgsConstructor
@Data
public class SortOrder {

  private final String field;
  private final Direction direction;

  public static SortOrder asc(String fieldName) {
    return new SortOrder(fieldName, ASC);
  }

  public static SortOrder desc(String fieldName) {
    return new SortOrder(fieldName, DESC);
  }

  public boolean isAscending() {
    return direction == ASC;
  }

  public enum Direction {
    ASC,
    DESC
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy