最新リリース:5.7.0
これはホロンプラットフォームのコアモジュールであり、プラットフォームファンデーションを表し、全体的なアーキテクチャ、ベース構造、APIの定義を提供します。
モジュールのハイライトは次のとおりです。
ContextリソースPropertyモデルとDatastore APIJWT )サポート詳細については、モジュールのドキュメントを参照してください。
他のプラットフォームモジュールと同様に、このアーティファクトはホロンプラットフォームエコシステムの一部ですが、スタンドアロンライブラリとしても使用できます。
詳細については、開始とプラットフォームのドキュメントを参照してください。
プロパティモデルの定義:
public interface Subject {
static NumericProperty < Long > ID = NumericProperty . longType ( "id" );
static StringProperty NAME = StringProperty . create ( "name" );
static StringProperty SURNAME = StringProperty . create ( "surname" );
static TemporalProperty < LocalDate > BIRTH = TemporalProperty . localDate ( "birth" );
static BooleanProperty ACTIVE = BooleanProperty . create ( "active" );
static VirtualProperty < String > FULL_NAME = VirtualProperty . create ( String . class ,
propertyBox -> propertyBox . getValue ( NAME ) + " " + propertyBox . getValue ( SURNAME ));
static PropertySet <?> SUBJECT = PropertySet . of ( ID , NAME , SURNAME , BIRTH , ACTIVE , FULL_NAME );
}プロパティ構成:
static StringProperty NAME = StringProperty . create ( "name" ). message ( "Name" ). messageCode ( "localization.name" )
. withConfiguration ( "my-config" , "my-value" );プロパティバリューコンバーター:
static StringProperty INTEGER_MODEL = StringProperty . create ( "integer_value" ). converter ( Integer . class ,
integer -> String . valueOf ( integer ), string -> Integer . valueOf ( string ));プロパティバリデーター:
static StringProperty NAME = StringProperty . create ( "name" )
. withValidator ( Validator . notBlank ()). withValidator ( Validator . max ( 50 ));プロパティプレゼンターとレンダラー:
String value = NAME . present ( "A value" );
MyType myType = NAME . render ( MyType . class );プロパティボックス:
PropertyBox propertyBox = PropertyBox . create ( SUBJECT );
String name = propertyBox . getValue ( NAME );
Optional < String > oname = propertyBox . getValueIfPresent ( NAME );
propertyBox . setValue ( NAME , "John" );
propertyBox . propertyValues (). forEach ( propertyValue -> {
Property <?> property = propertyValue . getProperty ();
Object value = propertyValue . getValue ();
});データストア:
DataTarget <?> TARGET = DataTarget . named ( "subjects" );
Datastore datastore = getDatastore ();
Stream < PropertyBox > results = datastore . query (). target ( TARGET )
. filter ( NAME . contains ( "a" ). and ( SURNAME . isNotNull ())). sort ( BIRTH . desc ()). stream ( SUBJECT );
Stream < String > names = datastore . query ( TARGET ). aggregate ( SURNAME ). stream ( NAME . max ());
Optional < String > name = datastore . query ( TARGET ). filter ( ID . eq ( 1L )). findOne ( NAME );
datastore . insert ( TARGET , PropertyBox . builder ( SUBJECT ). set ( ID , 1L ). set ( NAME , "John" ). set ( ACTIVE , true ). build ());
datastore . bulkUpdate ( TARGET ). set ( ACTIVE , true ). filter ( BIRTH . lt ( LocalDate . now ())). execute ();
datastore . query ( TARGET ). filter ( ID . eq ( 1L )). findOne ( SUBJECT ). ifPresent ( subject -> datastore . delete ( TARGET , subject ));Bean PropertySetとDataStore:
class MyBean {
private @ NotNull Long id ;
private @ Caption ( "The name" ) String name ;
private @ Caption ( "The surname" ) String surname ;
/* getters and setters omitted */
}
BeanPropertySet < MyBean > propertySet = BeanPropertySet . create ( MyBean . class );
PathProperty <?> name = propertySet . property ( "name" );
PathProperty < String > typedName = propertySet . property ( "name" , String . class );
BeanDatastore datastore = BeanDatastore . of ( getDatastore ());
Stream < MyBean > results = datastore . query ( MyBean . class ). filter ( propertySet . property ( "name" ). eq ( "John" )). stream ();
datastore . save ( new MyBean ());レルム:
Realm realm = Realm . builder (). withAuthenticator ( Authenticator . create ( MyAuthenticationToken . class , token -> {
if ( "test" . equals ( token . getPrincipal ())) {
return Authentication . builder ( "test" ). withPermission ( "ROLE1" ). build ();
}
throw new UnknownAccountException ();
}))
. withDefaultAuthorizer (). build ();
Realm . builder (). withAuthenticator ( Account . authenticator ( id -> Optional . of ( Account . builder ( id ). build ()))). build ();authcontext:
AuthContext context = AuthContext . create ( realm );
context . authenticate ( AuthenticationToken . accountCredentials ( "test" , "pwd" ));
Optional < Authentication > authentication = context . getAuthentication ();
boolean permitted = context . isPermitted ( "ROLE1" , "ROLE2" );RESTCLIENT:
RestClient client = RestClient . forTarget ( "https://rest.api.example" );
ResponseEntity < TestData > response = client . request ()
. path ( "test/{id}" ). resolve ( "id" , 123 )
. accept ( MediaType . APPLICATION_JSON )
. header ( "MY_HEADER" , "my-value" )
. authorizationBearer ( "An389fz56xsr7" )
. get ( TestData . class );
HttpStatus status = response . getStatus ();
Optional < TestData > payload = response . getPayload ();
Optional < TestData > data = client . request (). path ( "test/{id}" ). resolve ( "id" , 123 )
. getForEntity ( TestData . class );
List < TestData > results = client . request (). path ( "test" ). getAsList ( TestData . class );
client . request (). path ( "test" ). post ( RequestEntity . json ( new TestData ()));
Optional < PropertyBox > propertyBox = client . request (). path ( "test2" )
. propertySet ( PROPERTIES ). getForEntity ( PropertyBox . class ); locializationcontext:
LocalizationContext localizationContext = LocalizationContext . builder ()
. withMessageProvider ( MessageProvider . fromProperties ( "messages" ). build ())
. withDefaultDateTemporalFormat ( TemporalFormat . MEDIUM )
. withInitialLocale ( Locale . US )
. build ();
localizationContext . localize ( Locale . ITALY );
String localized = localizationContext . getMessage ( "message.code" , "Default message" );
String formatted = localizationContext . format ( LocalDate . now ());
formatted = localizationContext . format ( 123.4d );
Optional < LocalizationContext > current = LocalizationContext . getCurrent ();ユーザーガイドのモジュールドキュメントと一連の例を参照してください。
Holonプラットフォームコード構造と条約を参照して、プロジェクトコードベースが開発および編成される「Real Java API」哲学について学びます。
HolonプラットフォームはJava 11を使用して構築されているため、プラットフォームアーティファクトを使用するにはJRE/JDKバージョン11以降が必要です。
利用可能なリリースについては、リリースを参照してください。各リリースタグは、閉じた問題へのリンクを提供します。
Holonプラットフォームはオープンソースであり、Apache 2.0ライセンスの下でライセンスされています。すべてのアーティファクト(バイナリ、ソース、Javadocsを含む)は、Maven Centralリポジトリから入手できます。
このモジュールのMaven Group IDはcom.holon-platform.coreであり、 BOM(材料の請求書)が提供されています。モジュールアーティファクトを取得します。
Maven Bom:
< dependencyManagement >
< dependency >
< groupId >com.holon-platform.core</ groupId >
< artifactId >holon-bom</ artifactId >
< version >5.7.0</ version >
< type >pom</ type >
< scope >import</ scope >
</ dependency >
</ dependencyManagement >このモジュールの利用可能なアーティファクトのリストについては、Artifactsリストを参照してください。
Holonプラットフォームは、利用可能なすべてのプラットフォームアーティファクトを簡単に取得するための全体的なMaven Bom(材料請求書)を提供します。
プラットフォームMaven Bom:
< dependencyManagement >
< dependency >
< groupId >com.holon-platform</ groupId >
< artifactId >bom</ artifactId >
< version >${platform-version}</ version >
< type >pom</ type >
< scope >import</ scope >
</ dependency >
</ dependencyManagement >このモジュールの利用可能なアーティファクトのリストについては、Artifactsリストを参照してください。
次のように、Maven(バージョン3.3.x以上を推奨)を使用してソースを構築できます。
mvn clean install
プラットフォームのドキュメントまたは特定のモジュールのドキュメントを確認してください。
スタックオーバーフローについて質問してください。 holon-platformタグを監視します。
問題を報告します。
商業サポートも利用できます。
一連の例プロジェクトについては、Holon Platformの例リポジトリを参照してください。
Holonプラットフォームへの貢献を参照してください。
あらゆる質問と私たちに連絡するために、寄付のギッタールームに参加してください。
すべてのHolonプラットフォームモジュールは、Apache 2.0ライセンスの下でリリースされたオープンソースソフトウェアです。
Maven Group ID : com.holon-platform.core
| アーティファクトID | 説明 |
|---|---|
holon-core | プラットフォームコアコンポーネント、サービス、API |
holon-http | HTTPメッセージサポート |
holon-async-http | 非同期HTTPメッセージサポート |
holon-async-datastore | 非同期データストアAPI |
holon-auth | 認証と承認 |
holon-auth-jwt | JSON Webトークンサポート |
holon-spring | 春の統合 |
holon-spring-security | スプリングセキュリティ統合 |
holon-spring-boot | スプリングブート統合 |
holon-starter | ベーススプリングブートスターター |
holon-starter-security | Spring Security Integrationを備えたベーススプリングブートスターター |
holon-starter-test | ユニットテスト用のベーススプリングブートスターター |
holon-bom | 材料の手形 |
holon-bom-platform | 外部依存関係を含む材料の請求書 |
documentation-core | ドキュメント |