Nga Pham
01/31/2024, 11:11 PMnadi
02/04/2024, 9:49 AMnadi
02/04/2024, 9:55 AMVedran
02/04/2024, 12:41 PMclass MyMapper {
companion object AccountMapper {
fun Account.toDto() = AccountDto(
id, firstName, lastName, username, email, password, role, createdAt, lastModified,null
)
fun AccountDto.toEntity() = Account(
id, firstName, lastName, username, email, password, role, createdAt, lastModified
)
}
}
And without companion object (if I just delete "companion object AccountMapper" and leave functions) ... it does not?
Of course if there are some recomendations about how to handle mapping, please share.Bharat Kumar
02/05/2024, 8:50 AMNero Nguyễn
02/07/2024, 2:38 AMJavokhir Akramjonov
02/07/2024, 12:29 PMstefano
02/14/2024, 11:18 AMMath.ceilDiv
which was introduced in Java 18. In the Intellij project I have Java 21 configured and everything works fine. But if I run Gradle from a shell then I get an unresolved reference compilation error. I'm using SDKMAN and it configures automatically Java 21 once I enter the directory. I have also set sourceCompatibility
, targetCompatibility
and jvmTarget
to Java 21 in the build file. Any hint on what's missing would be greatly appreciated, thanksnadi
02/14/2024, 7:43 PM@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FUNCTION])
@Retention(AnnotationRetention.RUNTIME)
annotation class RequiredExternalUserAuth<T>(
val contextReader: KClass<ContextReader<T>>
)
i want to be able to know what T is in runtime. is it possible?dave08
02/15/2024, 4:53 PMRos
02/19/2024, 11:19 AMTudor Luca
02/19/2024, 4:53 PMMd Sadique Inam
02/20/2024, 2:13 AMelonzh
02/23/2024, 4:18 PMRay Rahke
02/25/2024, 7:59 PMRay Rahke
02/25/2024, 8:00 PMAkshay Taru
02/26/2024, 5:33 AMAbhi
02/26/2024, 9:28 AMDaria Voronina [JB]
02/26/2024, 1:32 PMAns Trakhtman
02/27/2024, 1:48 PMAns Trakhtman
02/27/2024, 1:52 PMimport akka.actor.*
import com.typesafe.config.Config
import kotlin.time.Duration.Companion.seconds
class JobsScheduler {
fun run(config: Config) {
val system = ActorSystem.create("jobsScheduler", config)
val job = system.actorOf(Job.props(), "job1")
system.scheduler.scheduleOnce(5.seconds, job, Job.Message("foo")); // this needs some ExecutorContext, which I can't figure out what it is.
}
}
I would greatly appreciate any help to make this dummy example run. Can’t figure out what’s wrong 🤦Hildebrandt Tobias
02/28/2024, 4:49 PMMd Sadique Inam
02/29/2024, 11:22 AMChristopher Hübner
03/04/2024, 8:22 AMLaurent Thiebaud
03/04/2024, 3:13 PMLaurent Thiebaud
03/05/2024, 11:14 AMFred Bowker
03/06/2024, 1:39 PM@Singleton
class PostServiceWeb
@Inject
constructor(
properties: AppProperties,
networkJson: Json,
) : ServiceWeb(
to use a Json that has
Json { encodeDefaults = true }
Basically I want to create a default JSON that has this set then it would be injected across the application, or do people change this at the retrofit level, any help would be appreciatedHildebrandt Tobias
03/07/2024, 11:54 AMCHANGE_PROFILE
and ADD_PROFILE
. The first needs id, from, to
and the latter just needs id, name
.
Somewhere up in the code an Audit(user, auditAction)
is created and passed down.
It eventuelle lands at the point where it should be written to the databse.
So I have imagine something that looks into the `AuditAction`and depending if it's change or add a different function(signature) is presented, they all return a Map<AuditDetail, String>
.
So in pseudo code something like this:
enum class AuditDetail {
ID,
NAME,
FROM,
TO,
}
object AuditPresets {
fun profileChange(id: String, from: String, to: String) = mapOf(
AuditDetail.ID to id,
AuditDetail.FROM to from,
AuditDetail.TO to to,
)
fun profileAdd(id: String, name: String) = mapOf(
AuditDetail.ID to id,
AuditDetail.NAME to name,
)
}
enum class AuditAction(val transformer: ???) {
PROFILE_CHANGE(AuditPresets::profileChange),
PROFILE_ADD(AuditPresets::profileAdd)
}
Now this obviously doesn't work since calling audit.auditAction()
could be any of the AuditAction
and the compiler doesn't know the signature ahead of time.
I just want a way to connect the AuditAction
enum(or sealed class or whatever) to a specific function even when the result is something like:
return when (audit.auditAction) {
AuditAction.PROFILE_CHANGE -> AuditAction.PROFILE_CHANGE("0","oldValue", "newValue")
AuditAction.PROFILE_ADD -> AuditAction.PROFILE_ADD("1","newName")
}
I feel like the solution might be simple and obvious and I just can't see the forest for the trees.Loïc Lamarque
03/08/2024, 1:44 PMNotBlankString
explicit type that you’ve dreamed of. 🙌
What’s more? This type uses kotlinx.serialization for automatic conversion from or as String
. 🤯
Want more? Check Kotools Types on GitHub. 👀Md Sadique Inam
03/15/2024, 1:34 AM