View Javadoc
1   package io.guixer.logs.lines;
2   
3   import static com.google.common.base.Preconditions.checkNotNull;
4   import static io.guixer.logs.lines.LogLine.Type.SLEEP;
5   
6   public final class SleepLogLine extends AbstractLogLine {
7   
8   	private final int seconds;
9   
10  	public SleepLogLine(
11  		final long timeMillis,
12  		final String rawText,
13  		final String secondsAsString
14  	) {
15  
16  		super(timeMillis, SLEEP, rawText);
17  
18  		checkNotNull(secondsAsString, "secondsAsString");
19  
20  		try {
21  
22  			this.seconds = Integer.parseInt(secondsAsString);
23  
24  		} catch (final NumberFormatException e) {
25  
26  			throw new IllegalArgumentException("Cannot parse seconds: " + secondsAsString);
27  		}
28  	}
29  
30  	public int getSeconds() {
31  
32  		return seconds;
33  	}
34  }