Created
November 6, 2019 00:38
-
-
Save ZergyPoo/9442469217473403ebad5ef5e8841d79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderBy { | |
@TestVisible | |
private String orderDirection; | |
private String fieldName; | |
public OrderBy(String orderDirection, String fieldName) { | |
this.orderDirection = orderDirection; | |
this.fieldName = fieldName; | |
} | |
public OrderBy(String orderDirection, Schema.SObjectField field) { | |
this(orderDirection, field.getDescribe().getName()); | |
} | |
public OrderBy(Schema.SObjectField field) { | |
this('ASC', field); | |
} | |
public String generateString() { | |
return String.format( | |
'{0} {1}', | |
new List<String> { | |
this.fieldName, | |
this.orderDirection | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment