br.com.uol.pagseguro.api.common.domain.converterXML.DocumentsV2XMLConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pagseguro-api Show documentation
Show all versions of pagseguro-api Show documentation
A collection of domain classes to ease integrations with PagSeguro Api
The newest version!
package br.com.uol.pagseguro.api.common.domain.converterXML;
import br.com.uol.pagseguro.api.common.domain.Document;
import java.util.ArrayList;
import java.util.List;
public class DocumentsV2XMLConverter {
private ArrayList document;
public ArrayList getDocument() {
if (document == null) {
document = new ArrayList();
}
return document;
}
public void setDocument(ArrayList document) {
this.document = document;
}
/**
* Convert attributes in request XML
*
* @param documentAccountList Document data
* @see Document
* @return DocumentsV2XMLConverter
*/
public DocumentsV2XMLConverter convert(List extends Document> documentAccountList) {
DocumentsV2XMLConverter convertedDocument = new DocumentsV2XMLConverter();
convertedDocument.setDocument(parseToDocumentList(documentAccountList));
return convertedDocument;
}
/**
* Parse a Document list to a list of converted documents
*
* @param documentsList List of Document
* @see Document
* @return ArrayList List of converted documents
*/
private ArrayList parseToDocumentList(List extends Document> documentsList) {
ArrayList documentList = new ArrayList();
for (Document document : documentsList) {
DocumentV2XMLConverter documentConverter = new DocumentV2XMLConverter(
document.getType().toString(), document.getValue()
);
documentList.add(documentConverter);
}
return documentList;
}
}