lundi 31 décembre 2018

How can i reduce cyclomatic complexity from a model

i need to reduce cyclomatic complexity of this model because it has 26, this is a normal class for setters and getters

public class DetailRecord {
private int lengthReference1;
private int lengthReference2;
private int lengthPayersNit;
private int lengthTransactionAmount;
private String recordType;
private String payersNit;
private String payersName;
private String payersAccountBank;
private String accountNumberToBeDebited;
private String transactionType;
private String transactionAmount;
private String referenceOne;
private String referenceTwo;
private String expirationDateOrApplicationDate;
private String billedPeriods;
private String cycle;
private String reserved;
private String validationNit;
private String encabezadoTotal;

public DetailRecord() {
    lengthReference1 = 30;
    lengthReference2 = 30;
    lengthPayersNit = 13;
    lengthTransactionAmount = 17;
    recordType = "6";
    payersName = "                    ";


}

public int getLengthReference1() {
    return lengthReference1;
}

public int getLengthReference2() {
    return lengthReference2;
}

public int getLengthPayersNit() {
    return lengthPayersNit;
}

public int getLengthTransactionAmount() {
    return lengthTransactionAmount;
}


public String getRecordType() {
    return recordType;
}

public String getPayersName() {
    return payersName;
}

public String getPayersAccountBank() {
    return payersAccountBank;
}

how can i reduce the cyclomatic complexity? using a builder perhaps? or what can i do? abstract the class or maybe create a interface?

Aucun commentaire:

Enregistrer un commentaire