小编Jes*_*Hun的帖子

MapStruct继承,不止一个配置原型是application

我的所有实体都扩展了一个具有Customer createdByandString createdById字段的基本实体,还有一些具有相同功能的实体。我想Customer在传输数据时排除整个对象。

其他一些实体扩展了另一个实体,该实体本身扩展了基本实体,因此有以下映射器:

@MapperConfig(componentModel = "spring", mappingInheritanceStrategy = MappingInheritanceStrategy.AUTO_INHERIT_FROM_CONFIG)
public interface AuditingEntityMapper<Dto, Entity> {

    @Mapping(target = "createdBy", source = "createdById")
    @Mapping(target = "lastModifiedBy", source = "lastModifiedById")
    Dto toDto(Entity entity);

    @Mapping(target = "createdBy", ignore = true)
    @Mapping(target = "lastModifiedBy", ignore = true)
    Entity toEntity(Dto dto);
}


@MapperConfig(componentModel = "spring", mappingInheritanceStrategy = MappingInheritanceStrategy.AUTO_INHERIT_FROM_CONFIG)
public interface ManageableEntityMapper<ManageableDtoType extends ManageableDTO, ManageableType extends Manageable> {

    ManageableDtoType toDto(ManageableType manageable);

    @Mapping(target = "project", ignore = true)
    ManageableType toEntity(ManageableDtoType dto);
} …
Run Code Online (Sandbox Code Playgroud)

java jhipster mapstruct

6
推荐指数
1
解决办法
3万
查看次数

PHP,编译 foreach 和 opline

我试图弄清楚 PHP 如何解释 foreach 语句。这导致我gdb在执行虚拟 foreach 脚本时使用。

我最终在zend_compile_foreach()函数中的 zend_compile.c 中。我看到对宏 ZEND_FE_FETCH_R 的调用移动了我们循环的数组/对象的内部指针。

有几件事我不明白:

  • 值如何实际返回到zend_compile_foreach上下文
  • 我们是否嵌套调用zend_compile_stmt(因此zend_compile_foreach)以进行迭代?那么代码编译 N 次了吗?N 是数组/对象中的元素数
  • 什么是opline??我到处都看到,但我不知道这一点

php arrays compiler-construction php-internals

5
推荐指数
0
解决办法
230
查看次数