Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save namila007/4ac1d43e593ae46b28846ee3fa9d682e to your computer and use it in GitHub Desktop.
Save namila007/4ac1d43e593ae46b28846ee3fa9d682e to your computer and use it in GitHub Desktop.
@Data
public class Resultset<T>
{
private HttpStatus status;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss")
private LocalDateTime timestamp;
private T data;
private Resultset()
{
this.timestamp = LocalDateTime.now();
}
public Resultset( T o, HttpStatus status ) throws ResourceNotFoundException
{
this();
if ( o == null || ( o instanceof List && ( ( List ) o ).isEmpty() ) )
throw new ResourceNotFoundException( "No Content Found" );
this.status = status;
this.data = o;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment