NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

◆API汎用化アイデア

技術要素
* ※汎用化に利用出来そうなモノ
1. JSON関連
1. Jackson
* https://style.potepan.com/articles/17019.html
2. PostgreSQL JSONサポート関数 (9.3〜 ※後続verでも仕様拡張あり)
* https://qiita.com/kumazo/items/483f47360f8b61a9fbb9
* https://qiita.com/kumazo/items/9010f9dad134b9d9d16d
1. SELECT句でのto_json(table_name)系
- ※複雑なWHERE句への対応 : SQLクエリビルダー併用で可能?(SQL Injectionの懸念あり)
- ※ORDER BY句も同様?
2. INSERTでのjson_populate_record(json)系
* 1クエリで複数対応可
* カラム省略時のNULL設定可
- DEFAULT,SERIAL,制約,等は汎用化時には利用不可
-
3. UPDATE でのjson_populate_record(json)
* 1クエリで複数対応不可
- カラム省略時のNULL設定不可
- ※複雑なWHERE句への対応 : SQLクエリビルダー併用で可能?(SQL Injectionの懸念あり)
2. Doma
1. 公式ドキュメント ※必読!
* ※英語だが最新ver.2.51.xを翻訳して読むべき(日本語版はかなり古い...ver.2.19.3。おそらくJDK15以前)
* https://doma.readthedocs.io/en/latest/#user-documentation
2. サンプル実装
1. DSL/DAO,JDK8,15等、各スタイルでのサンプルあり
* https://github.com/domaframework/simple-examples
2. SpringBootプロジェクトでのDomaサンプル
* https://github.com/domaframework/spring-boot-jpetstore
3. 自動生成、ボイラープレートコードの排除
1. Lombok
* https://qiita.com/opengl-8080/items/671ffd4bf84fe5e32557
2. Doma
1. 自動生成 Doma-Gen 2
* ※公式ドキュメント 最新ver.2.28.0
* https://doma-gen.readthedocs.io/en/2.28.0/
* 簡単な記事
* https://m-shige1979.hatenablog.com/entry/2017/01/04/080000
2. 注釈処理(アノテーション)
* https://doma.readthedocs.io/en/latest/annotation-processing/
4. その他汎用的なコーディング手段
1. var型(JDK 10〜)
* https://blog1.mammb.com/entry/2020/08/02/090000
2. 総称型(ジェネリクス)
3. Reflection
5. 他にあれば...



汎用化アイデア
1. 個別資源なしでの汎用化
* Entity、DAO、sqlの個別定義が不要
* テーブルの新規追加・定義変更時に修正が不要

- EntityへのBean Validationの定義が不可
-
- ※複雑なWHERE句への対応が難しい?
- ※ORDER BY句も同様?
1. 個別資源ありきでの汎用化
- Entity、DAOの個別定義が必要(E ntityはDomaによる自動生成可)
- テーブルの新規追加・定義変更時に修正が必要
-
* EntityへのBean Validationの定義が可能
* DAOクラスのPKによるinsert,update,deleteは単純定義でOK
* 複数レコード対応も、DAOクラスのbatchXXX()のみでOK
* https://github.com/domaframework/simple-examples/blob/master/dao-style-basic/src/main/java/example/dao_style_basic/dao/EmployeeDao.java
* DAOクラスに拡張メソッドの追加も可能(≒複雑なWHERE句やORDER BY句への対応が可能)
*
-



その他
1. 参考リンク
* ※汎用化と関連性なしだがオススメな最新情報
1. モダンJava
* https://blog1.mammb.com/entry/2020/07/23/090000
1. Text Blocks(15〜)
* https://blog1.mammb.com/entry/2020/08/12/000000
2. switch式(14〜)
* https://blog1.mammb.com/entry/2020/07/03/090000
3. HTTP Client(11〜)
* https://blog1.mammb.com/entry/2020/07/28/090000
4. .javaソース直接実行(11〜)
* https://blog1.mammb.com/entry/2020/08/07/090000
5. Recordsクラス(16〜)
* https://blog1.mammb.com/entry/2021/05/28/090000
6. Code Snippets in JavaDoc(18〜)
* https://blog1.mammb.com/entry/2022/04/09/222753
7. Simple Web Server : jwebserver(18〜)
1. https://blog1.mammb.com/entry/2022/03/26/001441
2. PostgreSQL JSONサポート関数 Hacks
* コードマスタ(アンチパターン)対策
* https://qiita.com/kumazo/items/19361acffddb6be10ac2#24-otlt-%E3%82%92-json-%E3%81%A7%E3%81%AA%E3%82%93%E3%81%A8%E3%81%8B%E3%81%99%E3%82%8B
* カラムへのアクセス制御
* https://qiita.com/kumazo/items/19361acffddb6be10ac2#27-%E3%83%9D%E3%83%AA%E3%82%B7%E3%83%BC%E3%82%AB%E3%83%A9%E3%83%A0
* ※ただし、データの更新や管理が簡単にはいかない。
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.