This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// domain | |
class User {} | |
class UserRequest {} | |
class ProjectCreator {} | |
class UserCreator { | |
UserCreator(Supplier<OffsetDateTime> now, ProjectCreator projectCreator) {} | |
User create(UserRequest r) | |
} | |
// service layer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[java.util Base64]) | |
(let [decode-base64 #(.decode (Base64/getDecoder) %) | |
path "/my/input/zfo.xml" | |
output-dir "/my/output/dir/" | |
parsed (-> path io/file io/input-stream xml/parse) | |
files | |
(->> parsed | |
:content | |
first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[org.bouncycastle.cms CMSSignedData]) | |
(let [path "/my/input/path/for/zfo.eml" | |
reader (-> path io/file io/input-stream) | |
in-ba (-> (CMSSignedData. reader) .getSignedContent .getContent) | |
is (-> in-ba io/input-stream)] | |
(with-open [r (-> is io/reader)] | |
(with-open [w (io/writer "/my/output/path/for/extracted.xml")] | |
(.write w (slurp r)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns org.example.playground.handler.visitor) | |
(defmulti ->json type) | |
(defmethod ->json java.lang.Boolean | |
[x] | |
(str x)) | |
(defmethod ->json java.lang.Long | |
[x] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example.jplayground; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class ToJsonProblem { | |
interface SerializableValue<X> { | |
X serialize(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------- common -------------------------------------------------------------- | |
package io.applifting.jbtesting.module.usergist; | |
public class Email { | |
private final String email; | |
private Email(String email) { | |
this.email = email; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; factory functions | |
(defn order-query-of-field1 | |
[v] | |
{:type :field1, :value v}) | |
(defn order-query-of-field2 | |
[v1 v2] | |
{:type :field2, :v1 v1, :v2 v2}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; factory functions | |
(defn order-query-of-field1 | |
[v] | |
{:type :field1, :value v}) | |
(defn order-query-of-field2 | |
[v1 v2] | |
{:type :field2, :v1 v1, :v2 v2}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderQuery { | |
public static FilterableCollection of(Field1 field) { | |
return new FilterableByQueryField1(field); | |
} | |
public static FilterableCollection of(Field2 field) { | |
return new FilterableByQueryField2(field); | |
} | |
public static FilterableCollection of(Field3 field) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class OrderQuery { | |
public static OrderQuery of(Field1 field) { | |
return new FilterableByQueryField1(field); | |
} | |
public static OrderQuery of(Field2 field) { | |
return new FilterableByQueryField2(field); | |
} | |
public static OrderQuery of(Field3 field) { |
NewerOlder