Questions tagged [refactoring]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
90 views

How to do a refactor for if's, any ideas?

I want to make a refactor of this code, because the if's are nested and according to good practices its difficult to read, anyone has an idea? I can't think of one :c For me is for me it's ...
Moon's user avatar
  • 9
-1 votes
1 answer
5k views

Method does not exist or incorrect signature: void getOppty(Id) from the type classname (108:19)

I want to do a refactor from this map, so I try with a method, this is how I try: private static Map<Id,Opportunity> getOppty (Set<Id> solutionId) { Map<Id, Opportunity> oppties = ...
Moon's user avatar
  • 9
0 votes
1 answer
30 views

Use Set instead of iterating in List

I have to refactor this code by using Sets instead of a combination of List and for loop. As in replace the below code with just a couple lines. But with Sets I cannot check if the elements contain a ...
user avatar
2 votes
1 answer
1k views

If I know the class type of an Enum, how can I get a list of the values?

I have the following method: public XAP_ENUM_EnumConverter put(Type enumType, XAP_ENUM_EnumWrapper enumWrapper) { ENUM_WRAPPERS_BY_TYPE_MAP.put(enumType, enumWrapper); return this;...
Brian Kessler's user avatar
1 vote
1 answer
126 views

Automatically set a value on an attribute sobject field

I have a class with more than 10 attributes (fields). Each attribute is filled depending of a context (conditions "if"): if(value == '1'){ myobject.attribute1 = value; }else if(value == '2'){ ...
Oupat's user avatar
  • 723
1 vote
1 answer
127 views

Moving code to trigger for Lightning and And Visualforce

I have a vf page that accepts few url query parameters. When a submit button is clicked, the apex controller takes the parameter and depending upon the parameter values different sorts of SOQL and DML ...
lambad's user avatar
  • 385
0 votes
1 answer
633 views

Type name already in use - Unable to use Rename Symbol command to correct Apex class name capitalisation

I use Apex PMD, one of the rules is: Class names should begin with an uppercase character (rule: Code Style-ClassNamingConventions) See: https://pmd.github.io/latest/pmd_rules_apex_codestyle.html#...
Robs's user avatar
  • 9,187