public class Belege {
public String Belegnummer {get;set;}
public String Debitornummer {get;set;}
public Decimal Bruttobetrag {get;set;}
public Decimal Nettobetrag {get;set;}
public Decimal Steuerbetrag {get;set;}
public Decimal Rabattbetrag {get;set;}
public List<VKBelegPositionen> VKBelegPositionen {get;set;}
}
public class VKBelegPositionen {
public Integer Position {get;set;}
public String Artikelnummer {get;set;}
public Decimal Menge {get;set;}
public Decimal Bruttopreis {get;set;}
public Decimal Nettopreis {get;set;}
public String UStKennzeichen {get;set;}
}
In Apex, you can define top-level classes (also called outer classes) as well as inner classes, that is, a class defined within another class. You can only have inner classes one level deep. For example:
if you want to nested then aonther wrapper class should created sapratly
public class AccountSelectClassController{
//Our collection of the class/wrapper objects wrapClass_1
public List<wrapClass_1> wrapAccountList {get; set;}
public List<Account> selectedAccounts{get;set;}
public AccountSelectClassController(){
if(wrapAccountList == null) {
wrapAccountList = new List<wrapClass_1>();
for(Account a: [select Id, Name,BillingState, Website, Phone from Account limit 10]) {
// As each Account is processed we create a new wrapClass_1 object and add it to the wrapAccountList
wrapAccountList.add(new wrapClass_1(a));
}
}
}
public void processSelected() {
selectedAccounts = new List<Account>();
for(wrapAccount wrapAccountObj : wrapAccountList) {
if(wrapAccountObj.selected == true) {
selectedAccounts.add(wrapAccountObj.acc);
}
}
}
// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
public class wrapClass_1 {
public Account acc {get; set;}
public Boolean selected {get; set;}
Public List<wrapClass_2>nestedWrapperList = new List<wrapClass_2>();
//This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
public wrapClass_1(Account a) {
acc = a;
selected = false;
nestedWrapperList.add(new wrapClass_2(pass you object));
wrapClass_2 cls2 = wrapClass_2();
}
}
New apex class : wrapClass_2
public class wrapClass_2 {
public Contact con {get; set;}
public Boolean selected {get; set;}
public wrapClass_2(Contact a) {
con = a;
selected = false;
}
}
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
You mean something like this?
Please follow below example:-
In Apex, you can define top-level classes (also called outer classes) as well as inner classes, that is, a class defined within another class. You can only have inner classes one level deep. For example:
if you want to nested then aonther wrapper class should created sapratly
New apex class : wrapClass_2 if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh