Skip to content

Commit

Permalink
[#noissue] Remove deprecated @mappings annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
intr3p1d committed Jan 17, 2025
1 parent 4733cc2 commit 8f5093b
Show file tree
Hide file tree
Showing 12 changed files with 191 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.Mappings;
import org.mapstruct.Named;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
Expand All @@ -51,40 +50,33 @@
)
public interface AgentInfoMapper {

@Mappings({
@Mapping(source = "agentInformation.hostIp", target = "ip"),
@Mapping(source = "agentInformation.machineName", target = "hostname"),
@Mapping(source = ".", target = "ports", qualifiedByName = "emptyPort"),
@Mapping(source = "agentInformation.container", target = "container"),
@Mapping(source = "agentInformation.pid", target = "pid"),
@Mapping(source = "agentInformation.serverType.code", target = "serviceType"),
@Mapping(source = "agentInformation.jvmVersion", target = "vmVersion"),
@Mapping(source = ".", target = "agentVersion", qualifiedByName = "agentVersion"),

@Mapping(target = "endStatus", ignore = true),
@Mapping(target = "endTimestamp", ignore = true),

})
@Mapping(source = "agentInformation.hostIp", target = "ip")
@Mapping(source = "agentInformation.machineName", target = "hostname")
@Mapping(source = ".", target = "ports", qualifiedByName = "emptyPort")
@Mapping(source = "agentInformation.container", target = "container")
@Mapping(source = "agentInformation.pid", target = "pid")
@Mapping(source = "agentInformation.serverType.code", target = "serviceType")
@Mapping(source = "agentInformation.jvmVersion", target = "vmVersion")
@Mapping(source = ".", target = "agentVersion", qualifiedByName = "agentVersion")
@Mapping(target = "endStatus", ignore = true)
@Mapping(target = "endTimestamp", ignore = true)
PAgentInfo map(AgentInfo agentInfo);

@Mappings({
@Mapping(source = "vmArgs", target = "vmArg"),
@Mapping(source = "serviceInfos", target = "serviceInfo"),
@Mapping(source = "serverInfo", target = "serverInfo"),
})

@Mapping(source = "vmArgs", target = "vmArg")
@Mapping(source = "serviceInfos", target = "serviceInfo")
@Mapping(source = "serverInfo", target = "serverInfo")
PServerMetaData map(ServerMetaData serverMetaData);

@Mappings({
@Mapping(source = "serviceLibs", target = "serviceLib"),
})

@Mapping(source = "serviceLibs", target = "serviceLib")
PServiceInfo map(ServiceInfo serviceInfo);

@Mappings({
@Mapping(source = "jvmVersion", target = "vmVersion"),
@Mapping(source = "jvmGcType", target = "gcType", qualifiedBy = JvmGcTypeMapper.ToPJvmGcType.class),

@Mapping(target = "version", ignore = true),
})
@Mapping(source = "jvmVersion", target = "vmVersion")
@Mapping(source = "jvmGcType", target = "gcType", qualifiedBy = JvmGcTypeMapper.ToPJvmGcType.class)
@Mapping(target = "version", ignore = true)
PJvmInfo map(JvmInformation jvmInformation);

@Named("emptyPort")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.Mappings;
import org.mapstruct.Named;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
Expand Down Expand Up @@ -84,27 +83,19 @@ default PAgentStatBatch.Builder newBuilder() {
return pAgentStatBatchBuilder;
}

@Mappings({
@Mapping(source = "agentStats", target = "agentStat"),
})
@Mapping(source = "agentStats", target = "agentStat")
PAgentStatBatch map(AgentStatMetricSnapshotBatch batch);

@Mappings({
@Mapping(source = "loadedClassCount", target = "loadedClass"),
})
@Mapping(source = "loadedClassCount", target = "loadedClass")
PAgentStat map(AgentStatMetricSnapshot snapshot);

@Mappings({
@Mapping(source = "type", target = "type", qualifiedBy = JvmGcTypeMapper.ToPJvmGcType.class),
})
@Mapping(source = "type", target = "type", qualifiedBy = JvmGcTypeMapper.ToPJvmGcType.class)
PJvmGc map(JvmGcMetricSnapshot snapshot);

PJvmGcDetailed map(JvmGcDetailedMetricSnapshot snapshot);

@Mappings({
@Mapping(source = "jvmCpuUsage", target = "jvmCpuLoad"),
@Mapping(source = "systemCpuUsage", target = "systemCpuLoad"),
})
@Mapping(source = "jvmCpuUsage", target = "jvmCpuLoad")
@Mapping(source = "systemCpuUsage", target = "systemCpuLoad")
PCpuLoad map(CpuLoadMetricSnapshot snapshot);

PTransaction map(TransactionMetricSnapshot snapshot);
Expand Down Expand Up @@ -132,26 +123,18 @@ default List<Integer> toList(ActiveTraceHistogram histogram) {
return histogram.getCounter();
}

@Mappings({
@Mapping(source = "dataSourceList", target = "dataSource"),
})
@Mapping(source = "dataSourceList", target = "dataSource")
PDataSourceList map(DataSourceMetricSnapshot snapshot);

@Mappings({
@Mapping(source = "activeConnectionSize", target = "activeConnectionSize", conditionQualifiedByName = "isNotZero"),
})
@Mapping(source = "activeConnectionSize", target = "activeConnectionSize", conditionQualifiedByName = "isNotZero")
PDataSource map(DataSource dataSource);

@Mappings({
@Mapping(source = "avg", target = "avg", conditionQualifiedBy = MapperUtils.IsNotZeroLong.class),
@Mapping(source = "max", target = "max", conditionQualifiedBy = MapperUtils.IsNotZeroLong.class),
})
@Mapping(source = "avg", target = "avg", conditionQualifiedBy = MapperUtils.IsNotZeroLong.class)
@Mapping(source = "max", target = "max", conditionQualifiedBy = MapperUtils.IsNotZeroLong.class)
PResponseTime map(ResponseTimeValue value);

@Mappings({
@Mapping(source = "deadlockedThreadCount", target = "count"),
@Mapping(target = "threadDump", ignore = true),
})
@Mapping(source = "deadlockedThreadCount", target = "count")
@Mapping(target = "threadDump", ignore = true)
PDeadlock map(DeadlockMetricSnapshot snapshot);

PFileDescriptor map(FileDescriptorMetricSnapshot snapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.Named;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.Qualifier;
import org.mapstruct.SubclassExhaustiveStrategy;
import org.mapstruct.SubclassMapping;
import org.mapstruct.SubclassMappings;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down Expand Up @@ -146,55 +144,48 @@ default PAnnotationValue map(Annotation<?> annotation) {
}

@Named("dummy")
@Mappings({
@Mapping(target = "binaryValue", ignore = true),
@Mapping(target = "boolValue", ignore = true),
@Mapping(target = "byteValue", ignore = true),
@Mapping(target = "bytesStringStringValue", ignore = true),
@Mapping(target = "doubleValue", ignore = true),
@Mapping(target = "intBooleanIntBooleanValue", ignore = true),
@Mapping(target = "intStringStringValue", ignore = true),
@Mapping(target = "intStringValue", ignore = true),
@Mapping(target = "intValue", ignore = true),
@Mapping(target = "longIntIntByteByteStringValue", ignore = true),
@Mapping(target = "longValue", ignore = true),
@Mapping(target = "stringValue", ignore = true),
@Mapping(target = "shortValue", ignore = true),
@Mapping(target = "stringStringValue", ignore = true),
})


@Mapping(target = "binaryValue", ignore = true)
@Mapping(target = "boolValue", ignore = true)
@Mapping(target = "byteValue", ignore = true)
@Mapping(target = "bytesStringStringValue", ignore = true)
@Mapping(target = "doubleValue", ignore = true)
@Mapping(target = "intBooleanIntBooleanValue", ignore = true)
@Mapping(target = "intStringStringValue", ignore = true)
@Mapping(target = "intStringValue", ignore = true)
@Mapping(target = "intValue", ignore = true)
@Mapping(target = "longIntIntByteByteStringValue", ignore = true)
@Mapping(target = "longValue", ignore = true)
@Mapping(target = "stringValue", ignore = true)
@Mapping(target = "shortValue", ignore = true)
@Mapping(target = "stringStringValue", ignore = true)
PAnnotationValue dummyForIgnoreMapping(Annotation<?> annotation);

@SubclassMappings({
@SubclassMapping(source = BooleanAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = ByteAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = BytesAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = DataTypeAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = DoubleAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = IntAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = LongAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = ObjectAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = ShortAnnotation.class, target = PAnnotationValue.class),
@SubclassMapping(source = StringAnnotation.class, target = PAnnotationValue.class),
})

@SubclassMapping(source = BooleanAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = ByteAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = BytesAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = DataTypeAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = DoubleAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = IntAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = LongAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = ObjectAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = ShortAnnotation.class, target = PAnnotationValue.class)
@SubclassMapping(source = StringAnnotation.class, target = PAnnotationValue.class)
@InheritConfiguration(name = "dummyForIgnoreMapping")
PAnnotationValue mapNonNull(Annotation<?> annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "boolValue"),
})
@Mapping(source = "value", target = "boolValue")
PAnnotationValue map(BooleanAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "byteValue"),
})
@Mapping(source = "value", target = "byteValue")
PAnnotationValue map(ByteAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "binaryValue", qualifiedByName = "copyFrom"),
})
@Mapping(source = "value", target = "binaryValue", qualifiedByName = "copyFrom")
PAnnotationValue map(BytesAnnotation annotation);

@Named("copyFrom")
Expand All @@ -203,27 +194,19 @@ default ByteString copyFrom(byte[] v) {
}

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "doubleValue"),
})
@Mapping(source = "value", target = "doubleValue")
PAnnotationValue map(DoubleAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "intValue"),
})
@Mapping(source = "value", target = "intValue")
PAnnotationValue map(IntAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "longValue"),
})
@Mapping(source = "value", target = "longValue")
PAnnotationValue map(LongAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "stringValue", qualifiedByName = "ObjectToString"),
})
@Mapping(source = "value", target = "stringValue", qualifiedByName = "ObjectToString")
PAnnotationValue map(ObjectAnnotation annotation);

@Named("ObjectToString")
Expand All @@ -232,15 +215,11 @@ default String objectToString(Object o) {
}

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "shortValue"),
})
@Mapping(source = "value", target = "shortValue")
PAnnotationValue map(ShortAnnotation annotation);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "value", target = "stringValue"),
})
@Mapping(source = "value", target = "stringValue")
PAnnotationValue map(StringAnnotation annotation);

default PAnnotationValue map(DataTypeAnnotation annotation) {
Expand Down Expand Up @@ -282,26 +261,18 @@ default PAnnotationValue map(DataTypeAnnotation annotation) {
}

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
})
PIntStringValue map(IntStringValue v);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
})
PStringStringValue map(StringStringValue v);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
})
PIntStringStringValue map(IntStringStringValue v);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "intValue2", target = "intValue2", conditionQualifiedByName = "isNotMinusInt"),
@Mapping(source = "byteValue1", target = "byteValue1", conditionQualifiedByName = "isNotMinusByte"),
@Mapping(source = "byteValue2", target = "byteValue2", conditionQualifiedByName = "isNotMinusByte"),
})
@Mapping(source = "intValue2", target = "intValue2", conditionQualifiedByName = "isNotMinusInt")
@Mapping(source = "byteValue1", target = "byteValue1", conditionQualifiedByName = "isNotMinusByte")
@Mapping(source = "byteValue2", target = "byteValue2", conditionQualifiedByName = "isNotMinusByte")
PLongIntIntByteByteStringValue map(LongIntIntByteByteStringValue v);


Expand All @@ -316,21 +287,16 @@ default boolean isNotMinusOne(byte value) {
}

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "booleanValue1", target = "boolValue1"),
@Mapping(source = "booleanValue2", target = "boolValue2"),
})
@Mapping(source = "booleanValue1", target = "boolValue1")
@Mapping(source = "booleanValue2", target = "boolValue2")
PIntBooleanIntBooleanValue map(IntBooleanIntBooleanValue v);

@InheritConfiguration(name = "dummyForIgnoreMapping")
@Mappings({
@Mapping(source = "bytesValue", target = "bytesValue", qualifiedByName = "copyFrom"),
})
@Mapping(source = "bytesValue", target = "bytesValue", qualifiedByName = "copyFrom")
PBytesStringStringValue map(BytesStringStringValue v);

@Mappings({
@Mapping(source = ".", target = "value")
})

@Mapping(source = ".", target = "value")
StringValue map(String stringValue);


Expand Down
Loading

0 comments on commit 8f5093b

Please sign in to comment.