gmariotti
01/17/2019, 3:00 PMcompanion object
, instead of the static class generated?cristiangm
01/17/2019, 7:22 PMcristiangm
01/17/2019, 7:23 PMSam Garfinkel
04/11/2020, 7:21 PMhalgorithm
04/12/2020, 2:59 AMoperator fun MyDelegate.setValue()
returns a type other than Unit
(for use with delegated properties).
does that mean the setter generated in JVM bytecode will also return something? even though this isn't something the compiler normally allows with a non-delegated property setter?halgorithm
04/12/2020, 2:59 AMsetBanana(value).setOtherThing(otherValue).etc()
if the setters return their thisReftunedal
04/12/2020, 4:39 PMlibraries/tools/kotlin-main-kts
– do I really need all those JDK versions installed, and JDK 9 in particular? Debian only has JDK 8 and 11.Ivan Serdyuk
04/13/2020, 5:09 PMuser
04/14/2020, 9:30 AME.Kisaragi
04/16/2020, 1:39 AMShawn
04/16/2020, 1:46 AMShawn
04/16/2020, 1:47 AMstevecstian
04/16/2020, 1:49 AME.Kisaragi
04/16/2020, 1:55 AMPaul Woitaschek
04/16/2020, 6:34 AMuser
04/16/2020, 3:30 PMBen Madore
04/16/2020, 6:55 PMobject a {
object b {
const val one = 1
}
object c {
const val two = 2
}
}
is there any way to get the values 1
and 2
reflectively from KClass<a>
Ben Madore
04/16/2020, 6:57 PMnestedClasses
ikej
04/17/2020, 11:16 AMsnowe
04/17/2020, 8:31 PMpublic abstract class AbstractProjector<ID extends Serializable, DTO extends AbstractView, DAO extends AbstractViewDao> {
protected final JpaRepository<DAO, ID> repository;
protected final Function<DAO, DTO> toDto;
protected final Function<DTO, DAO> toDao;
protected AbstractProjector(JpaRepository<DAO, ID> repository,
Function<DAO, DTO> toDtoFunction,
Function<DTO, DAO> toDaoFunction) {
this.repository = repository;
this.toDto = toDtoFunction;
this.toDao = toDaoFunction;
}
...
that is used like this:
public class WorkItemProjector extends AbstractProjector<WorkItemId, WorkItemView, WorkItemViewDao> {
@Autowired
public WorkItemProjector(WorkItemViewRepository repository) {
super(repository, WorkItemViewDao::toDto, WorkItemViewDao::toDao);
}
...
}
Here is the repository:
interface WorkItemViewRepository : JpaRepository<WorkItemViewDao?, WorkItemId?> {...}
Here is the WorkItemView
and WorkItemViewDao
data class WorkItemView(
val workItemId: WorkItemId,
val decisionId: SomeId,
val appId: SomeId,
override var tenantId: TenantId,
val workItemStatus: WorkItemListType? = null
) : AbstractView, Serializable
@Entity(name = "…")
@Table(name = "…")
data class WorkItemViewDao(
@Id var workItemId: WorkItemId,
@AttributeOverrides(AttributeOverride(name = "id", column = Column(name = "…")))
var decisionId: SomeId,
@AttributeOverrides(AttributeOverride(name = "id", column = Column(name = "…")))
var appId: SomeId,
override var tenantId: TenantId,
@Type(type = "Json", parameters = arrayOf(Parameter(name = "type", value = "…")))
@Column(name = "data") var workItemView: WorkItemView
) : AbstractViewDao {
companion object {
@JvmStatic
fun toDao(view: WorkItemView) = WorkItemViewDao(view.workItemId, view.decisionId, view.appId, view.tenantId, view)
@JvmStatic
fun toDto(dao: WorkItemViewDao?) = dao?.workItemView
}
}
When converting this to Kotlin, you can guess the issue.
AbstractProjector
abstract class AbstractProjector<ID : Serializable?, DTO : AbstractView?, DAO : AbstractViewDao?> protected constructor(
protected val repository: JpaRepository<DAO, ID>,
protected val toDto: (DAO) -> DTO,
protected val toDao: (DTO) -> DAO
) {..}
WorkItemProjector
class WorkItemProjector(repository: WorkItemViewRepository) :
AbstractProjector<WorkItemId?, WorkItemView?, WorkItemViewDao?>(
repository,
WorkItemViewDao::toDto,
WorkItemViewDao::toDao
) {…}
and the issue is show in an image below.
Here are some of the function signatures (in AbstractProjector
) that demonstrate how I can’t effectively split this into multiple interfaces with different out/in
variances (I think)
protected fun save(tenantId: TenantId?, viewCreator: () -> DTO) {
protected fun conditionallyUpdate(viewId: ID, proceedWithUpdate: (DTO) -> Unit, viewUpdater: (DTO) -> DTO) {
protected fun update(viewId: ID, viewUpdater: (DTO) -> DTO) {
protected fun update(daoSupplier: Supplier<DAO>, viewUpdater: (DTO) -> DTO) {
protected fun updateDao(viewId: ID, viewUpdater: (DAO) -> DAO) {
protected fun delete(viewId: ID) {
private fun update(viewDao: DAO, viewUpdater: (DTO) -> DTO) {
Any clue on this would be great.snowe
04/17/2020, 8:31 PMsnowe
04/17/2020, 10:35 PM?
.Ahmed Mourad
04/18/2020, 10:27 AMBarddo
04/18/2020, 3:02 PMOfir Bar
04/18/2020, 7:52 PMOfir Bar
04/18/2020, 7:53 PMOfir Bar
04/18/2020, 7:54 PMmertgundoganx
04/19/2020, 5:16 AMAnaniya
04/19/2020, 12:06 PMoleksiyp
04/19/2020, 11:06 PM