br.com.uol.pagseguro.api.application.authorization.PermissionsV2XMLConverter 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.application.authorization;
import br.com.uol.pagseguro.api.common.domain.PermissionCode;
import java.util.ArrayList;
import java.util.List;
public class PermissionsV2XMLConverter {
private ArrayList code;
public ArrayList getCode() {
if (code == null) {
code = new ArrayList();
}
return code;
}
public void setCode(ArrayList code) {
this.code = code;
}
/**
* Convert attributes in request XML
*
* @param codeList List of permission codes
* @return PermissionsV2XMLConverter
*/
public PermissionsV2XMLConverter convert(List codeList) {
PermissionsV2XMLConverter convertedPermissions = new PermissionsV2XMLConverter();
convertedPermissions.setCode(parseToCodeStringList(codeList));
return convertedPermissions;
}
/**
* Parse a permission codes list to a string list of codes
*
* @param codeList List of permission codes
* @return ArrayList List of permission codes
*/
private ArrayList parseToCodeStringList(List codeList) {
ArrayList codeStringList = new ArrayList();
for (PermissionCode.Code code : codeList) {
codeStringList.add(code.getStringCode());
}
return codeStringList;
}
}