-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: HttpClient, String&Date Utility classes, Transformer + updates …
…to QueryBuilder and SObjectSelector (#70) * add generic httpclient * update QueryBuilder with filter list * Add utility classes for strings and dates * add httpclient test class * add transformer class and interface * update sobjectselector
- Loading branch information
Showing
23 changed files
with
1,422 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
public class DateFormatUtility { | ||
public class FormattingException extends Exception { | ||
} | ||
|
||
public static String formatDateTimeToString(DateTime inputDate) { | ||
String formattedDate = DateTime.ValueOf(inputDate) | ||
.format('dd MMM yyyy HH:mm'); | ||
return formattedDate; | ||
} | ||
|
||
public static String formatDateToString(Date inputDate, String dateFormat) { | ||
return DateTime.newInstance( | ||
inputDate.year(), | ||
inputDate.month(), | ||
inputDate.day() | ||
) | ||
.format(dateFormat); | ||
} | ||
|
||
public static DateTime parseDateTimeFromString(String dateString) { | ||
if (dateString != null) { | ||
return (DateTime) JSON.deserialize( | ||
'"' + dateString + '"', | ||
DateTime.class | ||
); | ||
} | ||
return null; | ||
} | ||
|
||
public static Date parseDateFromString(String dateString) { | ||
if (dateString != null) { | ||
return (Date) JSON.deserialize('"' + dateString + '"', Date.class); | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* @description Takes in a list of strings and returns a date object. The list should contain the day, month and year in that order. | ||
* | ||
* @param dateList - A list of strings containing the day, month and year in that order. | ||
*/ | ||
public static Date parseDateFromString(String dateString, String format) { | ||
if (format == 'dd.MM.yyyy') { | ||
List<String> dateList = dateString.split('\\.'); | ||
|
||
return Date.newInstance( | ||
Integer.valueOf(dateList[2]), | ||
Integer.valueOf(dateList[1]), | ||
Integer.valueOf(dateList[0]) | ||
); | ||
} | ||
|
||
return parseDateFromString(dateString); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
Oops, something went wrong.