cz.active24.client.fred.data.poll.domain.EnumDomainValidationCustomConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fred-client Show documentation
Show all versions of fred-client Show documentation
A Java EPP client for FRED (Free Registry for ENUM and Domains)
package cz.active24.client.fred.data.poll.domain;
import cz.nic.xml.epp.enumval_1.ImpendingValExpDataT;
import cz.nic.xml.epp.enumval_1.ValExpDataT;
import org.dozer.CustomConverter;
import org.dozer.MappingException;
/**
* One way converter from {@link ImpendingValExpDataT} or {@link ValExpDataT} to {@link DomainDeletionPollResponse}.
*/
public class EnumDomainValidationCustomConverter implements CustomConverter {
public Object convert(Object destination, Object source, Class> destClass, Class> sourceClass) {
if (source == null) {
return null;
}
if (source instanceof ImpendingValExpDataT) {
ImpendingValExpDataT impendingValExpDataT = (ImpendingValExpDataT) source;
EnumDomainValidationPollResponse response = new EnumDomainValidationPollResponse();
response.setName(impendingValExpDataT.getName());
response.setValExDate(impendingValExpDataT.getValExDate().toGregorianCalendar().getTime());
response.setEventType(EnumDomainValidationEventType.IMPENDING_VAL_EXP_DATA);
return response;
}
if (source instanceof ValExpDataT) {
ValExpDataT valExpDataT = (ValExpDataT) source;
EnumDomainValidationPollResponse response = new EnumDomainValidationPollResponse();
response.setName(valExpDataT.getName());
response.setValExDate(valExpDataT.getValExDate().toGregorianCalendar().getTime());
response.setEventType(EnumDomainValidationEventType.VAL_EXP_DATA);
return response;
}
throw new MappingException("Converter " + this.getClass().getSimpleName() + " used incorrectly!");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy