All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.happy3w.toolkits.convert.TciKey Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
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; } }