Reputation: 19
I wrote all classes to make better sense out of what i am trying to achieve. i am having issue with looping or if there is some other option.. what i am confused is currently i have my index set at 0. how do i loop through list and perform function
if(empgrouping = group-A){use group-A position and ID}
else
if(empgrouping = group-B){use group-B position and ID}
private Employeesset employeesset (String personal, String empgrouping) throws Exception{
Employeesset emp = new Employeesset();
Details details = employeeconfig.getempdepts().get(0);
if(emp.flagistrue()&&empgrouping.equals(“group-A”){
emp.setemplgroup(empgrouping);
emp.setposition(“”);
emp.setidentification(“”);
}else{
// choose group b or c//
—————————————————
“employee_details”:[
{“Employees “: ”group-A“,
“Position “: ”management“,
“ID “: ”333iisdsa“,
“Environments” :
[
"name":"Shyam",
"name":"Bob",
"name":"Jai"
]} ,
{"Employees “: ”group-B”,
“Position “: ”management“,
“ID “: ”4455iisdf“,
“Environments” :
[
"name”:”sam”,
"name”:”loki”,
"name”:”avenger”
]},
{"Employees “: ”group-c“,
“Position “: ”management“,
“ID “: ”234kkdk“,
“Environments” : [
"name”:”super”,
"name”:”kam”,
"name”:”mike”
]}
]
———————————————
public static class Details{
@Jsonproperty(“Employees”)
String emptype;
@Jsonproperty(“Position”)
String position;
@Jsonproperty(“ID”)
String identification;
@Jsonproperty(“environments”)
List<Environments> environments;
//Getters and setters//
———————————
public class employeeconfig{
@Jsonproperty(“employee_details”);
List<Details> empdepts;
//getters and setters//
—————————————
public class Employeesset{
private employee;
private position;
private identification;
//getters and setters//
Upvotes: 0
Views: 55
Reputation: 658
First, you need to change the whole structure of code for Class you have written Employeesset
which should be EmployeesSet
Then method should always follow camel casing structure same with variables
private EmployeesSet employeesSet (String personal, String empGrouping) throws Exception{
EmployeesSet emp = new EmployeesSet();
employeeConfig.getempdepts().foreach(resultDetails->{
//Write your code logic here //Using jdk 8
}
if(emp.flagistrue()&&empGrouping.equals(“group-A”){
emp.setemplgroup(empGrouping);
emp.setposition(“”);
emp.setidentification(“”);
}else{
Upvotes: 1