From 86d7d20cabf31620d01b1578ecff9da1bd87846b Mon Sep 17 00:00:00 2001 From: jstaerk Date: Thu, 22 Sep 2022 11:20:10 +0200 Subject: [PATCH] updated some javadoc --- History.md | 3 +- .../java/org/mustangproject/Allowance.java | 15 ++++++ .../java/org/mustangproject/BankDetails.java | 26 +++++++++- .../java/org/mustangproject/CII/CIIToUBL.java | 7 ++- .../main/java/org/mustangproject/Charge.java | 52 +++++++++++++++++++ .../main/java/org/mustangproject/Contact.java | 32 +++++++++++- .../ZUGFeRD/IZUGFeRDAllowanceCharge.java | 27 ++++++++++ .../ZUGFeRD/IZUGFeRDTradeSettlement.java | 8 +-- 8 files changed, 161 insertions(+), 9 deletions(-) diff --git a/History.md b/History.md index d97f56e4..5fa2c375 100644 --- a/History.md +++ b/History.md @@ -2,7 +2,8 @@ ======= 2022-09-22 -Removed a unneccessary dependency (ph-jaxb) +Removed a unneccessary dependency (ph-jaxb). +Added some javadoc. 2.5.5 ======= diff --git a/library/src/main/java/org/mustangproject/Allowance.java b/library/src/main/java/org/mustangproject/Allowance.java index bb038312..514dc625 100644 --- a/library/src/main/java/org/mustangproject/Allowance.java +++ b/library/src/main/java/org/mustangproject/Allowance.java @@ -5,16 +5,31 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge; import java.math.BigDecimal; +/*** + * (absolute) allowances on item and document level + */ public class Allowance extends Charge implements IZUGFeRDAllowanceCharge { + /*** + * bean constructor + */ public Allowance() { } + + /*** + * create a allowance with the following amount + * @param totalAmount the money amount as bigdecimal (prob max 2 decimals) + */ public Allowance(BigDecimal totalAmount) { super(totalAmount); } + /*** + * Always to return false for IZUGFeRDAllowanceCharge + * @return false since its not supposed to be calculated negatively + */ @Override public boolean isCharge() { return false; diff --git a/library/src/main/java/org/mustangproject/BankDetails.java b/library/src/main/java/org/mustangproject/BankDetails.java index 766396b0..db7b3ce0 100644 --- a/library/src/main/java/org/mustangproject/BankDetails.java +++ b/library/src/main/java/org/mustangproject/BankDetails.java @@ -6,13 +6,33 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment; * provides e.g. the IBAN to transfer money to :-) */ public class BankDetails implements IZUGFeRDTradeSettlementPayment { - protected String IBAN, BIC, accountName=null; + /** + * the bank account number + */ + protected String IBAN; + /** + * BIC, I believe it's optional + */ + protected String BIC; + /** + * the "name" of the bank account (holder) + */ + protected String accountName=null; + /*** + * constructor for normal use :-) + * @param IBAN the IBAN as string + * @param BIC the BIC code as string + */ public BankDetails(String IBAN, String BIC) { this.IBAN = IBAN; this.BIC = BIC; } + /*** + * getter for the IBAN + * @return IBAN + */ public String getIBAN() { return IBAN; } @@ -30,6 +50,10 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment { return this; } + /*** + * getter for the BIC + * @return the BIC + */ public String getBIC() { return BIC; } diff --git a/library/src/main/java/org/mustangproject/CII/CIIToUBL.java b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java index 8b2a28e3..98390e52 100644 --- a/library/src/main/java/org/mustangproject/CII/CIIToUBL.java +++ b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java @@ -7,10 +7,13 @@ import com.helger.ubl22.UBL22Writer; import java.io.File; import java.io.Serializable; +/*** + * converts a CII XML file to a UBL XML file + * thanks to Philip Helger for his library +*/ public class CIIToUBL { /*** - * converts a CII XML file to a UBL XML file - * thanks to Philip Helger for his library + * performs the actual conversion * @param input * @param output */ diff --git a/library/src/main/java/org/mustangproject/Charge.java b/library/src/main/java/org/mustangproject/Charge.java index 5ddf3009..86daec8a 100644 --- a/library/src/main/java/org/mustangproject/Charge.java +++ b/library/src/main/java/org/mustangproject/Charge.java @@ -7,14 +7,35 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem; import java.math.BigDecimal; +/*** + * Absolute and relative charges for document and item level + */ public class Charge implements IZUGFeRDAllowanceCharge { + /** + * the percentage, null if not relative at all + */ protected BigDecimal percent = null; + /** + * the absolute value if not percentage + */ protected BigDecimal totalAmount; + /** + * the tax rate the charge belongs to + */ protected BigDecimal taxPercent; + /** + * a simple human readable description + */ protected String reason; + /** + * the category ID why this charge has been applied + */ protected String categoryCode; + /*** + * Bean connstructor + */ public Charge() { taxPercent=BigDecimal.ZERO; } @@ -28,16 +49,31 @@ public class Charge implements IZUGFeRDAllowanceCharge { } + /*** + * sets the total amount to be changed to, e.g. if not specified via constructor + * @param totalAmount 2 decimal money amount + * @return fluid setter + */ public Charge setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; return this; } + /*** + * if relative charge: percent to increase the item + * @param percent as bigdecimal + * @return fluid setter + */ public Charge setPercent(BigDecimal percent) { this.percent = percent; return this; } + /*** + * charges can be applied to VAT items, in which case they take the same VAT rate + * @param taxPercent the tax percentage on the charge + * @return fluid setter + */ public Charge setTaxPercent(BigDecimal taxPercent) { this.taxPercent = taxPercent; return this; @@ -49,6 +85,11 @@ public class Charge implements IZUGFeRDAllowanceCharge { return reason; } + /*** + * Freetext (?) reason for the charge + * @param reason freetext + * @return fluid setter + */ public Charge setReason(String reason) { this.reason = reason; return this; @@ -77,6 +118,12 @@ public class Charge implements IZUGFeRDAllowanceCharge { return taxPercent; } + + + /*** + * Always to return true for IZUGFeRDAllowanceCharge + * @return true since it is supposed to be calculated negatively + */ @Override public boolean isCharge() { return true; @@ -91,6 +138,11 @@ public class Charge implements IZUGFeRDAllowanceCharge { } + /*** + * machine readable reason for this allowance/charge + * @param categoryCode usually S + * @return fluid setter + */ public Charge setCategoryCode(String categoryCode) { this.categoryCode = categoryCode; return this; diff --git a/library/src/main/java/org/mustangproject/Contact.java b/library/src/main/java/org/mustangproject/Contact.java index 514c18f2..4ecc1b6a 100644 --- a/library/src/main/java/org/mustangproject/Contact.java +++ b/library/src/main/java/org/mustangproject/Contact.java @@ -13,7 +13,37 @@ import org.w3c.dom.NodeList; @JsonIgnoreProperties(ignoreUnknown = true) public class Contact implements IZUGFeRDExportableContact { - protected String name, phone, email, zip, street, location, country; + /** + * name of the contact person + */ + protected String name; + /** + * phone of the contact + */ + protected String phone; + /** + * email address + */ + protected String email; + /** + * postcode of the contact + */ + protected String zip; + /** + * street address (=name+number) + */ + protected String street; + /** + * city + */ + protected String location; + /** + * 2 character ISO code of a country + */ + protected String country; + /** + * the fax number of the contact person + */ protected String fax = null; /*** diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java index 152c445c..fe854be7 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java @@ -20,20 +20,47 @@ import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants; import java.math.BigDecimal; /** + * The interface for allowances or charges, to be used by the pullprovider * @author AlexanderSchmidt */ public interface IZUGFeRDAllowanceCharge { + /*** + * returns the absolute amount, even if it was relative in the first place + * @param trans the class delivering the initial value + * @return the calculated value (e.g. when percentage) + */ BigDecimal getTotalAmount(IAbsoluteValueProvider trans); + + /*** + * returns a percentage, if relative abount, or null for absolute amounts + * @return null or Percentage as Bigdecimal + */ default BigDecimal getPercent() {return null;} + /*** + * get a description for the allowance/charge + * @return the description + */ String getReason(); + /*** + * get the applicable tax percentage for the allowance/charge + * @return the percentage + */ BigDecimal getTaxPercent(); + /*** + * the category ID why this has been applied + * @return default value Standard rate=S + */ default String getCategoryCode() { return TaxCategoryCodeTypeConstants.STANDARDRATE; } + /*** + * is this in reality a charge and now allowance + * @return true if amnount to be treated negative + */ public boolean isCharge(); } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDTradeSettlement.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDTradeSettlement.java index 7e92b204..038c5d36 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDTradeSettlement.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDTradeSettlement.java @@ -21,15 +21,15 @@ package org.mustangproject.ZUGFeRD; public interface IZUGFeRDTradeSettlement { /*** - * - * @return zf2 xml for applicableHeaderTradeSettlement + * gets the applicableHeaderTradeSettlement + * @return zf2 xml */ String getSettlementXML(); /*** - * - * @return zf2 xml for applicableHeaderTradePayment + * gets the applicableHeaderTradePayment + * @return zf2 xml */ default String getPaymentXML() { return null;