Skip to content

Instantly share code, notes, and snippets.

View gtudan's full-sized avatar

Gregor Tudan gtudan

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gtudan on github.
  • I am gtudan (https://keybase.io/gtudan) on keybase.
  • I have a public key ASCqmDrJ2QsP8suVtPTk3aekUPaBWsrqdbeWv6EFlc-UqQo

To claim this, I am signing this object:

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${project.artifactId}:${project.version}</name>
<alias>${project.artifactId}</alias>
<build>
<contextDir>${project.basedir}</contextDir>
@gtudan
gtudan / JsonbGreeting.java
Last active November 18, 2018 15:48
Customizing JSON-B using annotations
import javax.json.bind.annotation.*;
public class Greeting {
@JsonbProperty("greeting") // name this field "greeting" in json
private String message;
@JsonbTransient // hide this field
private LocalDate created;
@gtudan
gtudan / JsonbCustomizingTest.java
Last active November 19, 2018 09:49
Customizing JSON-B output using Config
var config = new JsonbConfig()
.withFormatting(true) // indents the output - default is false
.withNullValues(true); // show null fields - default is false
var jsonb = JsonbBuilder.create(config);
var json = jsonb.toJson(new Greeting("Hello World!"));
System.out.println(json);
/*
{
@gtudan
gtudan / JsonbMarshallingTest.java
Created November 18, 2018 15:45
To JSON and back again using JSON-B
import javax.json.bind.*;
/* ... */
var pojo = new Greeting("Hello World!");
// to JSON
Jsonb jsonb = JsonbBuilder.create();
String json = jsonb.toJson(pojo);
assertEquals("{\"greeting\":\"Hello World!\"}", json);
@gtudan
gtudan / jsonb-build.gradle
Created November 18, 2018 15:43
Dependencies for a JSON-B project in Java SE
dependencies {
implementation 'javax.json.bind:javax.json.bind-api:1.0'
// yasson is the reference implementation for JSON-B
runtime 'org.eclipse:yasson:1.0.2'
// it uses JSON-P under the hood
runtime 'org.glassfish:javax.json:1.1.4'
}
@gtudan
gtudan / wildfly-domain.cli
Created April 14, 2015 12:44
Wildfly Profile example
# change the provided default configuration for the ejb-multi-server quickstart
# stop the preconfigured server for the domain
batch
# first stop the default servers, block until the server is down
/host=master/server-config=server-one:stop(blocking=true)
/host=master/server-config=server-two:stop(blocking=true)
# remove the default server configuration and server-groups