agile4j-model-builder

model构建工具

Лицензия

Лицензия

Группа

Группа

com.agile4j
Идентификатор

Идентификатор

agile4j-model-builder
Последняя версия

Последняя версия

1.2.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

agile4j-model-builder
model构建工具
Ссылка на сайт

Ссылка на сайт

https://github.com/agile4j/agile4j-model-builder
Система контроля версий

Система контроля версий

https://github.com/agile4j/agile4j-model-builder

Скачать agile4j-model-builder

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.agile4j/agile4j-model-builder/ -->
<dependency>
    <groupId>com.agile4j</groupId>
    <artifactId>agile4j-model-builder</artifactId>
    <version>1.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.agile4j/agile4j-model-builder/
implementation 'com.agile4j:agile4j-model-builder:1.2.2'
// https://jarcasting.com/artifacts/com.agile4j/agile4j-model-builder/
implementation ("com.agile4j:agile4j-model-builder:1.2.2")
'com.agile4j:agile4j-model-builder:jar:1.2.2'
<dependency org="com.agile4j" name="agile4j-model-builder" rev="1.2.2">
  <artifact name="agile4j-model-builder" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.agile4j', module='agile4j-model-builder', version='1.2.2')
)
libraryDependencies += "com.agile4j" % "agile4j-model-builder" % "1.2.2"
[com.agile4j/agile4j-model-builder "1.2.2"]

Зависимости

compile (8)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.31
com.agile4j : agile4j-utils jar 1.0.5
com.agile4j : agile4j-kts-loader jar 1.0.0
com.fasterxml.jackson.core : jackson-databind jar 2.10.1
com.fasterxml.jackson.core : jackson-core jar 2.10.1
com.fasterxml.jackson.core : jackson-annotations jar 2.10.1
com.fasterxml.jackson.module : jackson-module-kotlin jar 2.10.1
com.github.ben-manes.caffeine : caffeine jar 2.8.5

Модули Проекта

Данный проект не имеет модулей.

agile4j-model-builder

agile4j-model-builder是用Kotlin语言实现的model构建器,可在Kotlin/Java工程中使用。

如何引入

Gradle

dependencies {
    compile "com.agile4j:agile4j-model-builder:1.1.3"
}

Maven

<dependency>
    <groupId>com.agile4j</groupId>
    <artifactId>agile4j-model-builder</artifactId>
    <version>1.1.3</version>
</dependency>

如何使用

step1.定义Target

  • 通过API inJoinexJoin,在target中进行关联关系的声明,例如:
data class ArticleView (val article: Article) {
    val user: User? by inJoin(Article::userId)
    val commentViews: Collection<CommentView>? by exJoin(::getCommentIdsByArticleIds)

    val userName: String? get() = user?.userName
}

data class CommentView(val comment: Comment) {
    val isLiked: Boolean? by exJoin(::isLikedComment)

    val isLikeShowMsg:String get() = if (isLiked == true) "" else ""
}

step2.声明Relation

  • 通过API indexBybuildBytargets,声明Relation,例如:
fun initModelBuilder() {
    Article::class {
        indexBy(Article::id)
        buildBy(::getArticleByIds)
        targets(ArticleView::class)
    }
    User::class {
        indexBy(User::id)
        buildBy(::getUserByIds)
    }
    Comment::class {
        indexBy(Comment::id)
        buildBy(::getCommentByIds)
        targets(CommentView::class)
    }
}

step3.构建Target

  • 通过API mapMultimapSingle,构建target对象,例如:
val articleViews = articleIds mapMulti ArticleView::class

了解更多

使用场景

名词定义

特性

API

高级用法

JAVA如何接入

Версии библиотеки

Версия
1.2.2
1.2.1
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0