com.happy3w.toolkits.convert.TciKey Maven / Gradle / Ivy
package com.happy3w.toolkits.convert;
import com.happy3w.toolkits.utils.PrimitiveTypeUtil;
import lombok.EqualsAndHashCode;
import lombok.Getter;
/**
* TypeConvertItemKey
* 用于表示从源类型到目的类型
* @param 源类型
* @param 目的类型
*/
@Getter
@EqualsAndHashCode
public class TciKey implements ITypeConvertItemKey {
protected final Class sourceType;
protected final Class targetType;
public TciKey(Class sourceType, Class targetType) {
this.sourceType = sourceType;
this.targetType = targetType;
}
@Override
public String toString() {
return createDesc(sourceType, targetType);
}
public TciKey objTypeKey() {
Class st = PrimitiveTypeUtil.toObjType(sourceType);
Class tt = PrimitiveTypeUtil.toObjType(targetType);
if (st != sourceType || tt != targetType) {
return new TciKey<>(st, tt);
}
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy