Last active
July 10, 2019 08:31
-
-
Save MrMjauh/0e0ce61ba890776152a910e1fc07b7b7 to your computer and use it in GitHub Desktop.
Resource file
This file contains hidden or 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
package com.codecamos.timetracking.config; | |
public final class Resource { | |
private Resource() { } | |
/** | |
* @param activeProfiles The current active profiles this application was started with, {@link Profile} for available profiles | |
* @return returns true if we are in dev or stage | |
*/ | |
public static Boolean isInDevOrStage(final String[] activeProfiles) { | |
for (String profile : activeProfiles) { | |
if (profile.equals(Profile.DEVELOPMENT) || profile.equals(Profile.STAGE)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
public static class Profile { | |
public static final String DEVELOPMENT = "dev"; | |
public static final String PRODUCTION = "prod"; | |
public static final String STAGE = "stage"; | |
} | |
/** | |
* This class holds are the error codes present in the application and is used | |
* in conjuction with a {@link BaseException} | |
* | |
*/ | |
public static class ErrorCode { | |
/** | |
* Generic error code, use as little as possible | |
*/ | |
public static final long GENERIC_CODE = 9999; | |
/** | |
* Code used for accessing an endpoint that does not exist, is missing or is forbidden | |
*/ | |
public static final long FORBIDDEN_MISSING_OR_MOVE = 9990; | |
} | |
public static final ApiError GENERIC_ERROR = new ApiError(ErrorCode.GENERIC_CODE, "Generic error message"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment