To have a constant and easy reproducible dev environment we're using Eclipse in a Docker container.
- Save
Dockerfile
anddocker-entrypoint.sh
somewhere in the same folder - Run
docker build -t desktop/eclipse:tapestry .
in that folder - Wait...
ext.mainClass = "com.example.Main" | |
import java.nio.file.Files | |
import java.nio.file.Paths | |
task shellScript(type: Jar) { | |
// Create fat Jar | |
doFirst { | |
from { |
#!/usr/bin/env bash | |
# Author: Benjamin Weidig <ben@netzgut.net> | |
# Version: 1 (2017-02-19) | |
# A helper shell script for starting a Docker container in a more flexible way. | |
# A container might not start if all the linked containers or ports are not | |
# available, so now we are able to specify optional resources. | |
# This script is used at Netzgut to start desktop applications with Docker. |
@Core | |
@Contribute(JavaScriptStack.class) | |
public static void overrideJquery(OrderedConfiguration<StackExtension> conf) { | |
conf.override("jquery-library", StackExtension.library("classpath:META-INF/assets/jquery/jquery-3.3.1.min.js")); | |
} | |
@Contribute(ModuleManager.class) | |
public static void contributeModuleManager(MappedConfiguration<String, JavaScriptModuleConfiguration> conf, | |
@Inject @Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode, | |
AssetSource assetSource) { |
To have a constant and easy reproducible dev environment we're using Eclipse in a Docker container.
Dockerfile
and docker-entrypoint.sh
somewhere in the same folderdocker build -t desktop/eclipse:tapestry .
in that folderlet name: String? = articles?.first?.author?.name |
let name: String = articles?.first?.author?.name ?? "n/a" |
// Case 1: We know there's a value | |
Optional<String> withValue = Optional.of("definitly a string"); | |
// Case 2: We 're not sure | |
Optional<String> maybeValue = Optional.ofNullable(null); | |
// Case 3: We're sure there's no value | |
Optional<String> noValue = Optional.empty(); |
Optional<String> withValue = Optional.of("definitly a string"); | |
if (withValue.isPresent()) { | |
System.out.println("There's definitly something there!"); | |
} | |
Optional<String> noValue = Optional.empty(); | |
if (noValue.isPresent() == false) { | |
System.out.println("No, nothing..."); | |
} |
Optional<String> withValue = Optional.of("definitly a string"); | |
String s1 = withValue.get(); | |
Optional<String> noValue = Optional.empty(); | |
String s2 = noValue.get(); | |
// ^^^^^^^^^^^^^ this throws NoSuchElementException! |
String result = this.buildResult(); | |
if (result == null) { | |
return "n/a"; | |
} | |
return result.toUpperCase(); |