開発中止
This commit is contained in:
parent
fb0d3c41b6
commit
a840941fa1
|
@ -0,0 +1,11 @@
|
|||
package dev.usbharu.activitystreams.impl.builder
|
||||
|
||||
import dev.usbharu.activitystreams.impl.type.AbstractJsonObjectBuilder
|
||||
import dev.usbharu.activitystreams.impl.type.BuilderContext
|
||||
import dev.usbharu.activitystreams.model.core.Activity
|
||||
|
||||
class ActivityBuilder : AbstractJsonObjectBuilder<Activity>() {
|
||||
override fun internalBuild(t: Activity, jsonObject: Map<String, Any>, builderContext: BuilderContext) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package dev.usbharu.activitystreams.impl.builder
|
||||
|
||||
import dev.usbharu.activitystreams.impl.type.AbstractJsonObjectBuilder
|
||||
import dev.usbharu.activitystreams.model.core.Activity
|
||||
import dev.usbharu.activitystreams.model.core.Object
|
||||
|
||||
class CreateBuilder : AbstractJsonObjectBuilder<Activity> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package dev.usbharu.activitystreams.impl.builder
|
||||
|
||||
import dev.usbharu.activitystreams.impl.type.AbstractJsonObjectBuilder
|
||||
import dev.usbharu.activitystreams.impl.type.BuilderContext
|
||||
import dev.usbharu.activitystreams.model.core.InternalActivity
|
||||
|
||||
class InternalActivityBuilder : AbstractJsonObjectBuilder<InternalActivity>() {
|
||||
override fun internalBuild(t: InternalActivity, jsonObject: Map<String, Any>, builderContext: BuilderContext) {
|
||||
val typeFactory = builderContext.typeFactory().factory()
|
||||
t.actor =
|
||||
}
|
||||
}
|
|
@ -5,11 +5,13 @@ import dev.usbharu.activitystreams.impl.type.BuilderContext
|
|||
import dev.usbharu.activitystreams.impl.type.JsonObjectBuilder
|
||||
import dev.usbharu.activitystreams.model.JsonLd
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
|
||||
open class JsonLdBuilder : AbstractJsonObjectBuilder<JsonLd>() {
|
||||
override fun internalBuild(t: JsonLd, jsonObject: Map<String, Any>, builderContext: BuilderContext) {
|
||||
t.value = jsonObject["@value"]
|
||||
t.id = jsonObject["@id"]?.toString()?.let { URI.create(it) }
|
||||
t.type = (jsonObject["@type"] as? List<String>).orEmpty().map { URI.create(it) }
|
||||
t.language = jsonObject["@language"]?.toString()?.let { Locale.forLanguageTag(it) }
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package dev.usbharu.activitystreams.impl.builder
|
||||
|
||||
import dev.usbharu.activitystreams.impl.model.other.JsonLdImpl
|
||||
import dev.usbharu.activitystreams.impl.model.other.LangStringImpl
|
||||
import dev.usbharu.activitystreams.impl.type.AbstractJsonObjectBuilder
|
||||
import dev.usbharu.activitystreams.impl.type.BuilderContext
|
||||
import dev.usbharu.activitystreams.impl.type.JsonObjectBuilder
|
||||
|
@ -9,15 +11,19 @@ import dev.usbharu.activitystreams.model.other.LangString
|
|||
import java.net.URI
|
||||
|
||||
open class ObjectBuilder : AbstractJsonObjectBuilder<Object>() {
|
||||
override fun build(t: Object, jsonObject: Map<String, Any>, builderContext: BuilderContext) {
|
||||
// t.name =
|
||||
}
|
||||
|
||||
override fun internalBuild(t: Object, jsonObject: Map<String, Any>, builderContext: BuilderContext) {
|
||||
val langString = builderContext.typeFactory().factory(URI.create("")) as LangString
|
||||
builderContext.getBuilder(LangString::class.java)
|
||||
.build(langString, jsonObject["https://www.w3.org/ns/activitystreams#name"], builderContext)
|
||||
t.name =
|
||||
val maps = jsonObject["https://www.w3.org/ns/activitystreams#name"] as List<Map<String, String>>
|
||||
t.name = LangStringImpl(
|
||||
null, maps.mapNotNull {
|
||||
|
||||
val jsonLd = JsonLdImpl()
|
||||
builderContext.getBuilder(JsonLd::class.java).build(jsonLd, it, builderContext)
|
||||
(jsonLd.language?.toLanguageTag() ?: return@mapNotNull null) to (jsonLd.value as? String?
|
||||
?: return@mapNotNull null)
|
||||
}.toMap(), emptyList(), null, null
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import dev.usbharu.activitystreams.model.other.MimeMediaType
|
|||
import java.net.URI
|
||||
import java.time.Duration
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.*
|
||||
|
||||
class CreateImpl(
|
||||
override var type: List<URI> = emptyList(),
|
||||
|
@ -49,4 +50,5 @@ class CreateImpl(
|
|||
override var id: URI? = null,
|
||||
override var source: ObjectOrLink? = null,
|
||||
override var value: Any? = null,
|
||||
override var language: Locale? = null,
|
||||
) : Create
|
|
@ -0,0 +1,13 @@
|
|||
package dev.usbharu.activitystreams.impl.model.other
|
||||
|
||||
import dev.usbharu.activitystreams.model.JsonLd
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
|
||||
open class JsonLdImpl(
|
||||
override var type: List<URI> = emptyList(),
|
||||
override var id: URI? = null,
|
||||
override var value: Any? = null,
|
||||
override var language: Locale? = null
|
||||
) : JsonLd {
|
||||
}
|
|
@ -8,7 +8,7 @@ class LangStringImpl(
|
|||
override var value: Any?,
|
||||
private val map: Map<String, String>,
|
||||
override var type: List<URI> = emptyList(),
|
||||
override var id: URI? = null
|
||||
override var id: URI? = null, override var language: Locale? = null
|
||||
) : LangString {
|
||||
override fun getValue(): String? = value?.toString()
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package dev.usbharu.activitystreams.model
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Locale
|
||||
|
||||
interface JsonLd {
|
||||
var type: List<URI>
|
||||
var id: URI?
|
||||
var value: Any?
|
||||
var language: Locale?
|
||||
}
|
|
@ -2,7 +2,7 @@ package dev.usbharu.activitystreams.model.core
|
|||
|
||||
import dev.usbharu.activitystreams.model.ObjectOrLink
|
||||
|
||||
sealed interface InternalActivity : dev.usbharu.activitystreams.model.core.Object {
|
||||
sealed interface InternalActivity : Object {
|
||||
var actor: List<ObjectOrLink>
|
||||
var target: List<ObjectOrLink>
|
||||
var result: ObjectOrLink?
|
||||
|
@ -10,8 +10,8 @@ sealed interface InternalActivity : dev.usbharu.activitystreams.model.core.Objec
|
|||
var instrument: ObjectOrLink?
|
||||
}
|
||||
|
||||
interface Activity : dev.usbharu.activitystreams.model.core.InternalActivity {
|
||||
interface Activity : InternalActivity {
|
||||
var `object`: ObjectOrLink?
|
||||
}
|
||||
|
||||
interface IntransitiveActivity : dev.usbharu.activitystreams.model.core.InternalActivity
|
||||
interface IntransitiveActivity : InternalActivity
|
Loading…
Reference in New Issue