Fix generics in EppXmlTransformer.unmarshal to not be only on the return type.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124914271
This commit is contained in:
cgoldfeder 2016-06-14 20:58:57 -07:00 committed by Ben McIlwain
parent 6466ad51f6
commit ec39f15a23
31 changed files with 133 additions and 62 deletions

View file

@ -38,7 +38,6 @@ import com.googlecode.objectify.VoidWork;
import com.googlecode.objectify.Work;
import google.registry.flows.EppException;
import google.registry.flows.EppXmlTransformer;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.DomainCommand;
@ -89,7 +88,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
/** Extract the registration period from the XML used to create the domain application. */
private static Period extractPeriodFromXml(byte[] xmlBytes) throws EppException {
EppInput eppInput = unmarshal(xmlBytes);
EppInput eppInput = unmarshal(EppInput.class, xmlBytes);
return ((DomainCommand.Create)
((ResourceCommandWrapper) eppInput.getCommandWrapper().getCommand())
.getResourceCommand()).getPeriod();
@ -150,8 +149,10 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
"contacts", contactsMapBuilder.build(),
"authInfo", application.getAuthInfo().getPw().getValue(),
"smdId", application.getEncodedSignedMarks().isEmpty()
? null : EppXmlTransformer.<SignedMark>unmarshal(
application.getEncodedSignedMarks().get(0).getBytes()).getId(),
? null
: unmarshal(
SignedMark.class,
application.getEncodedSignedMarks().get(0).getBytes()).getId(),
"applicationRoid", application.getRepoId(),
"applicationTime", application.getCreationTime().toString(),
"launchNotice", launchNotice == null ? null : ImmutableMap.of(

View file

@ -138,7 +138,7 @@ final class GenerateApplicationsReportCommand implements RemoteApiCommand, Gtech
SignedMark signedMark;
try {
signedMark = unmarshal(signedMarkData);
signedMark = unmarshal(SignedMark.class, signedMarkData);
} catch (EppException e) {
return Optional.of(makeLine(domainApplication, "Unparseable SMD"));
}

View file

@ -86,7 +86,7 @@ final class ValidateEscrowDepositCommand implements Command {
}
private static void validateXmlStream(InputStream inputStream) throws XmlException {
XjcRdeDeposit deposit = XjcXmlTransformer.unmarshal(inputStream);
XjcRdeDeposit deposit = XjcXmlTransformer.unmarshal(XjcRdeDeposit.class, inputStream);
System.out.printf("ID: %s\n", deposit.getId());
System.out.printf("Previous ID: %s\n", deposit.getPrevId());
System.out.printf("Type: %s\n", deposit.getType());

View file

@ -17,6 +17,7 @@ package google.registry.tools;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.io.Resources.getResource;
import static google.registry.flows.EppXmlTransformer.unmarshal;
import static google.registry.tools.CommandUtilities.runFlow;
import static google.registry.util.X509Utils.getCertificateHash;
import static google.registry.util.X509Utils.loadCertificate;
@ -30,7 +31,6 @@ import com.google.template.soy.data.SoyMapData;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import google.registry.flows.EppXmlTransformer;
import google.registry.flows.FlowRunner;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
@ -104,7 +104,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
System.out.println(runFlow(
new FlowRunner(
LoginFlow.class,
EppXmlTransformer.<EppInput>unmarshal(inputXmlBytes),
unmarshal(EppInput.class, inputXmlBytes),
Trid.create(null),
new HttpSessionMetadata(
new TlsCredentials(

View file

@ -297,7 +297,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
if (xmlBytes == null) {
return;
}
final EppInput eppInput = unmarshal(xmlBytes);
final EppInput eppInput = unmarshal(EppInput.class, xmlBytes);
if (!statCounts.addAll(
FluentIterable.from(EnumSet.allOf(StatType.class))
.filter(