mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#3601 provide fixture tests
This commit is contained in:
parent
baa02bf377
commit
4af76ec317
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyListMultiConditionMapper;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyListPropertyConditionMapper;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyListSourceParameterConditionMapper;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyStringMultiConditionMapper;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyStringPropertyConditionMapper;
|
||||
import org.mapstruct.ap.test.bugs._3601.single.OnlyStringSourceParameterConditionMapper;
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
import org.mapstruct.ap.testutil.ProcessorTest;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.GeneratedSource;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@IssueKey("3601")
|
||||
class Issue3601Test {
|
||||
|
||||
@RegisterExtension
|
||||
final GeneratedSource generatedSource = new GeneratedSource();
|
||||
|
||||
@Nested
|
||||
@WithClasses({ Source.class, Target.class })
|
||||
class OnlyOneConditionPresent {
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyListPropertyConditionMapper.class)
|
||||
void testOnlyListPropertyConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyListPropertyConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyListSourceParameterConditionMapper.class)
|
||||
void testOnlyListSourceParameterConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyListSourceParameterConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyListMultiConditionMapper.class)
|
||||
void testOnlyListMultiConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyListMultiConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyStringPropertyConditionMapper.class)
|
||||
void testOnlyStringPropertyConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyStringPropertyConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyStringSourceParameterConditionMapper.class)
|
||||
void testOnlyStringSourceParameterConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyStringSourceParameterConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(OnlyStringMultiConditionMapper.class)
|
||||
void testOnlyStringMultiConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( OnlyStringMultiConditionMapper.class );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Nested
|
||||
@WithClasses({ Source.class, Target.class })
|
||||
class BothConditionsPresent {
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringPropertyConditionListPropertyConditionMapper.class)
|
||||
void testStringPropertyConditionListPropertyConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringPropertyConditionListPropertyConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringSourceParameterConditionListSourceParameterConditionMapper.class)
|
||||
void testStringSourceParameterConditionListSourceParameterConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringSourceParameterConditionListSourceParameterConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringMultiConditionListMultiConditionMapper.class)
|
||||
void testStringMultiConditionListMultiConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringMultiConditionListMultiConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringPropertyConditionListMultiConditionMapper.class)
|
||||
void testStringPropertyConditionListMultiConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringPropertyConditionListMultiConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringPropertyConditionListSourceParameterConditionMapper.class)
|
||||
void testStringPropertyConditionListSourceParameterConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringPropertyConditionListSourceParameterConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringSourceParameterConditionListPropertyConditionMapper.class)
|
||||
void testStringSourceParameterConditionListPropertyConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringSourceParameterConditionListPropertyConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringSourceParameterConditionListMultiConditionMapper.class)
|
||||
void testStringSourceParameterConditionListMultiConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringSourceParameterConditionListMultiConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringMultiConditionListPropertyConditionMapper.class)
|
||||
void testStringMultiConditionListPropertyConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringMultiConditionListPropertyConditionMapper.class );
|
||||
}
|
||||
|
||||
@ProcessorTest
|
||||
@WithClasses(StringMultiConditionListSourceParameterConditionMapper.class)
|
||||
void testStringMultiConditionListSourceParameterConditionMapper() {
|
||||
generatedSource.addComparisonToFixtureFor( StringMultiConditionListSourceParameterConditionMapper.class );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
public class Source {
|
||||
|
||||
private final String uuid;
|
||||
|
||||
public Source(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringMultiConditionListMultiConditionMapper {
|
||||
|
||||
StringMultiConditionListMultiConditionMapper INSTANCE = Mappers.getMapper( StringMultiConditionListMultiConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringMultiConditionListPropertyConditionMapper {
|
||||
|
||||
StringMultiConditionListPropertyConditionMapper INSTANCE = Mappers.getMapper( StringMultiConditionListPropertyConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringMultiConditionListSourceParameterConditionMapper {
|
||||
|
||||
StringMultiConditionListSourceParameterConditionMapper INSTANCE = Mappers.getMapper( StringMultiConditionListSourceParameterConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringPropertyConditionListMultiConditionMapper {
|
||||
|
||||
StringPropertyConditionListMultiConditionMapper INSTANCE = Mappers.getMapper( StringPropertyConditionListMultiConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringPropertyConditionListPropertyConditionMapper {
|
||||
|
||||
StringPropertyConditionListPropertyConditionMapper INSTANCE = Mappers.getMapper( StringPropertyConditionListPropertyConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringPropertyConditionListSourceParameterConditionMapper {
|
||||
|
||||
StringPropertyConditionListSourceParameterConditionMapper INSTANCE = Mappers.getMapper( StringPropertyConditionListSourceParameterConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringSourceParameterConditionListMultiConditionMapper {
|
||||
|
||||
StringSourceParameterConditionListMultiConditionMapper INSTANCE = Mappers.getMapper( StringSourceParameterConditionListMultiConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringSourceParameterConditionListPropertyConditionMapper {
|
||||
|
||||
StringSourceParameterConditionListPropertyConditionMapper INSTANCE = Mappers.getMapper( StringSourceParameterConditionListPropertyConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@Condition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface StringSourceParameterConditionListSourceParameterConditionMapper {
|
||||
|
||||
StringSourceParameterConditionListSourceParameterConditionMapper INSTANCE = Mappers.getMapper( StringSourceParameterConditionListSourceParameterConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Target {
|
||||
//CHECKSTYLE:OFF
|
||||
public String currentId;
|
||||
public List<String> targetIds;
|
||||
//CHECKSTYLE:ON
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyListMultiConditionMapper {
|
||||
|
||||
OnlyListMultiConditionMapper INSTANCE = Mappers.getMapper( OnlyListMultiConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyListPropertyConditionMapper {
|
||||
|
||||
OnlyListPropertyConditionMapper INSTANCE = Mappers.getMapper( OnlyListPropertyConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyListSourceParameterConditionMapper {
|
||||
|
||||
OnlyListSourceParameterConditionMapper INSTANCE = Mappers.getMapper( OnlyListSourceParameterConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean isNotEmpty(List<String> elements) {
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.ConditionStrategy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyStringMultiConditionMapper {
|
||||
|
||||
OnlyStringMultiConditionMapper INSTANCE = Mappers.getMapper( OnlyStringMultiConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition(appliesTo = { ConditionStrategy.PROPERTIES, ConditionStrategy.SOURCE_PARAMETERS })
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Condition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyStringPropertyConditionMapper {
|
||||
|
||||
OnlyStringPropertyConditionMapper INSTANCE = Mappers.getMapper( OnlyStringPropertyConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@Condition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.SourceParameterCondition;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Oliver Erhart
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnlyStringSourceParameterConditionMapper {
|
||||
|
||||
OnlyStringSourceParameterConditionMapper INSTANCE = Mappers.getMapper( OnlyStringSourceParameterConditionMapper.class );
|
||||
|
||||
@Mapping(target = "currentId", source = "source.uuid")
|
||||
@Mapping(target = "targetIds", source = "sourceIds")
|
||||
Target map(Source source, List<String> sourceIds);
|
||||
|
||||
@SourceParameterCondition
|
||||
default boolean stringCondition(String str) {
|
||||
return str != null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringMultiConditionListMultiConditionMapperImpl implements StringMultiConditionListMultiConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringMultiConditionListPropertyConditionMapperImpl implements StringMultiConditionListPropertyConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringMultiConditionListSourceParameterConditionMapperImpl implements StringMultiConditionListSourceParameterConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringPropertyConditionListMultiConditionMapperImpl implements StringPropertyConditionListMultiConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringPropertyConditionListPropertyConditionMapperImpl implements StringPropertyConditionListPropertyConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringPropertyConditionListSourceParameterConditionMapperImpl implements StringPropertyConditionListSourceParameterConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringSourceParameterConditionListMultiConditionMapperImpl implements StringSourceParameterConditionListMultiConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringSourceParameterConditionListPropertyConditionMapperImpl implements StringSourceParameterConditionListPropertyConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds 0= null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class StringSourceParameterConditionListSourceParameterConditionMapperImpl implements StringSourceParameterConditionListSourceParameterConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyListMultiConditionMapperImpl implements OnlyListMultiConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyListPropertyConditionMapperImpl implements OnlyListPropertyConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
if ( isNotEmpty( sourceIds ) ) {
|
||||
List<String> list = sourceIds;
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyListSourceParameterConditionMapperImpl implements OnlyListSourceParameterConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && !isNotEmpty( sourceIds ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyStringMultiConditionMapperImpl implements OnlyStringMultiConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyStringPropertyConditionMapperImpl implements OnlyStringPropertyConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
if ( stringCondition( source.getUuid() ) ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._3601.single;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.processing.Generated;
|
||||
import org.mapstruct.ap.test.bugs._3601.Source;
|
||||
import org.mapstruct.ap.test.bugs._3601.Target;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-03T22:05:12+0200",
|
||||
comments = "version: , compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OnlyStringSourceParameterConditionMapperImpl implements OnlyStringSourceParameterConditionMapper {
|
||||
|
||||
@Override
|
||||
public Target map(Source source, List<String> sourceIds) {
|
||||
if ( source == null && sourceIds == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
if ( source != null ) {
|
||||
target.currentId = source.getUuid();
|
||||
}
|
||||
List<String> list = sourceIds;
|
||||
if ( list != null ) {
|
||||
target.targetIds = new ArrayList<String>( list );
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user