We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [inner-class]

An inner class or nested class is a class declared entirely within the body of another class or interface. It is distinguished from a subclass.

Filter by
Sorted by
Tagged with
1
vote
1answer
34 views

How to test an inner class?

I did my research, but could not find a clear guidelines on how to test an inner class. This is my inner class: public class ExistingAccountResult{ public String salesforceaccountid {get;set;} ...
0
votes
1answer
30 views

Invalid type when creating a map of <string, list<innerclassobject>>

Invalid type: EcPerformanceRecordList I want to create a Map of userid and list of sObject records, then loop through this map so that I can count how many apps have been submitted per user....
0
votes
0answers
26 views

Testing Inner Class [duplicate]

I have a class with an inner class: public with sharing class Response { .... public Response() {} public Response(Id testId, String testString) { ... } public class Answer { @AuraEnabled ...
0
votes
1answer
23 views

Clone a map containing an inner class so it passes by value and not reference?

I have a map<string, InnerClass>, where the inner apex class containing no sObjects, just a bunch of simple variable types like booleans, integers and strings. (It also contains another inner ...
4
votes
3answers
175 views

Adding a Wrapper Class to an External Class

I am confused about what is happening in a small section of some code. I have a class that has a wrapper class inside it. There is an external class that calls this wrapper class Models.add(new ...
3
votes
1answer
353 views

How to use inner class / wrapper class as scope in Apex Batch

I already successfully collecting the list of data from callout another system as json body to the inner class to accomodate custom information: Here is the apex class of the inner class: public ...
3
votes
1answer
880 views

Inner Classes/Interfaces

the guide says that one difference between Java and Apex is: Inner classes and interfaces can only be declared one level deep inside an outer class. Considering I know in Java what is an Inner class,...
3
votes
1answer
78 views

apex: Innerclass not not available in map in outside class

I have the following setup: public with sharing class MyOuterClass extends BaseClass { public class MyInnerClass { public Id classId {get; private set;} public MyInnerClass() {} ...
0
votes
0answers
60 views

Why do we need inner classes? [duplicate]

Can anyone give me an example when an inner class is used. I started with wrapper class and found inner class is used in that but as i am all new to this i was thinking if anyone can give me an ...
0
votes
0answers
34 views

Parsing the following JSON response

I need to parse the PRIM_CITYAC,PRIM_STATEAC,PRIM_COUNTRY_NMAC from the following response. I'm very new to REST API. I've create inner class with list in order to obtain the values. Now i got those ...
0
votes
1answer
408 views

how to intialize array for inner class and assign mulitple values to that class?

I have developed vf page which have page block table displaying 3 fields. I tried to modify it with use of apex :repeat so that i have created one inner class as public class outer{ public ...
12
votes
2answers
1k views

Confirmation that (inner) classes are still not fully supported in @AuraEnabled methods?

When writing a controller for a Lightning Component, it is convenient to add the data transfer object classes as inner classes of the controller. This works fine for sending data to the client but I ...
2
votes
1answer
1k views

Nested Inner Classes creation in an apex class

Below is the structure am trying to build. Its throwing Error: Compile Error: unexpected token: 'class' public class maincls { public class test1 { public String teststr {get; set;...
0
votes
2answers
655 views

How to increment a integer value in wrapper class

i have a scenario, i want to increment a value in wrapper class let's take testWrapper class is there , having a Integer variable called incrementX For ex 5 records are there , 1st Recorde --> ...
8
votes
1answer
300 views

Problem using Protected modifier to expose method to inner class

I have a use case where I will have an Apex Class wrapping an sObject, and I need to be able to swap out certain internal functionality based on certain conditions. My plan is to use an few inner ...
3
votes
1answer
628 views

Instance method clashes with static method

I am working with Apex inner classes and I got the limitation described below I can't name a method in my inner class with the same name I used in a static method in the containing class When I do ...
0
votes
1answer
26 views

Error in page controller [closed]

I'm new to APEX, so I'm going through the workbook. Got to the page about 'Using Inner Classes in an APEX Controller'. As far as I can tell, the code I've written replicates what the tutorial has ...
0
votes
1answer
37 views

how to retrive list from inner class

class code: public list<innerclass> inclass= new list<innerclass>(); public class innerclass { public string accountid{get; set;} public string accountname{get; set;} ...
3
votes
2answers
3k views

For loop within for loop

I have a custom object record with a start date, an end date, and a amount field. I want to be able to take the difference between the two dates in number of months, divide the amount by the ...
4
votes
1answer
662 views

Code Coverage on Inner Class/Variable Declarations

When we use an inner class, fields will not be covered unless otherwise we declare them with {get;set;}(even though they are accessible from the test class) Also these lines are not get counted as to ...
6
votes
2answers
7k views

Purpose of an inner class

I've read in the Apex Workbook and the Apex Developer Guide the mention of inner classes. What is their purpose? I see in the Apex Workbook that they used private variables and setter/getter methods ...
0
votes
1answer
282 views

how to assign data from Inner class to out class

i have succesfully parse my JSON data. but now i want data back from following APEX method "getCustomerData()" like below: DxModel[id=2, email=asd@GMAIL.COM, first_name=clerk, last_name=dx, ...
6
votes
1answer
1k views

Possible to declare static constants in an inner class?

I want to define an outer class with two inner classes, the inner classes containing specific constants related to each of them. For example: public class Stuff{ public class Letters{ ...
3
votes
1answer
321 views

Implementing CompareTo In An Inner Class That Needs Outer Class Data

I'm using Apex and VisualForce to make an "open house event check-in page" for a department. For various reasons pertaining to AppExchange plugin compatibility, we are storing a separate "Event" ...
2
votes
1answer
462 views

Why Don't Visualforce Wrapper Class Getter/Setter Methods Not Exist?

I have a wrapper/inner class like so: public class parameter{ public String source { get; set; } public Integer year { get; set; } public String field { get; set; } public parameter(...
13
votes
3answers
915 views

What's It Called: Inner Class Without Sharing?

I believe I have heard a specific term for this pattern, but I am not able to retrieve it from the foggy banks of my memory: public with sharing class OuterClass { public without sharing class ...
10
votes
1answer
563 views

Why are static variables allowed only in outer classes?

According to the documentation, static variables are allowed only in outer classes. Why is that? Is it because you'd need to instantiate the inner class first?