Java example code for Getting Started
* WiP on Java version of new Hello World Done: - implementation for first 3 sections - tests for first 2 sections To do: - formatting - tests for section 3 - section 4 and 5 - hooking the fragments into the docs themselves * Finish tutorial_03 conversion * Converted tutorial 04 * Convert step 5 scala->java * Reformat Java code (thx IntelliJ IDEA) * Format using 2 spaces Really it'd be neat to have something like scalariform for the Java code, too * Make fields 'private final' * Make message classes 'public static final' * Use primitive long/double where possible * sender() -> getSender() * Static import of org.junit.Assert.... * Final actor fields * println() the instruction to hit ENTER to quit * Use jdocs package for quickstart, too * Use helper methods for message handling * Compare doubles specifying a delta * Keep tutorial steps independent
This commit is contained in:
parent
20b5e6b955
commit
f064d1321a
30 changed files with 2848 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
package jdocs.tutorial_2;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import jdocs.tutorial_2.Device.ReadTemperature;
|
||||
import jdocs.tutorial_2.Device.RecordTemperature;
|
||||
import jdocs.tutorial_2.Device.RespondTemperature;
|
||||
import jdocs.tutorial_2.Device.TemperatureRecorded;
|
||||
|
||||
class DeviceInProgress1 {
|
||||
|
||||
//#read-protocol-1
|
||||
public static final class ReadTemperature {
|
||||
}
|
||||
|
||||
public static final class RespondTemperature {
|
||||
final Optional<Double> value;
|
||||
|
||||
public RespondTemperature(Optional<Double> value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
//#read-protocol-1
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue