public static void noNulls(Object... objects) { noNullsWithMsg(NO_NULLS, objects); }
/** * <code>group</code> is optional * * <pre> * metainf.[prefix].[group].[suffix] * * metainf.[prefix].[suffix] * </pre> */ public static String getKey(String prefix, MetaInfGroup group, String suffix) { Assert.noNullsWithMsg("prefix and suffix are required", prefix, suffix); StringBuilder sb = new StringBuilder(); sb.append(MetaInfUtils.PROPERTY_PREFIX); sb.append("."); sb.append(prefix); if (group != null) { sb.append("."); sb.append(group.name().toLowerCase()); } sb.append("."); sb.append(suffix); return sb.toString(); }
/** * Examine both system properties and environment variables to get a value for <code>key</code>. Return <code>defaultValue</code> if nothing is found * * <pre> * foo.bar -> System property check for "foo.bar" * foo.bar -> Environment check for "FOO_BAR" * </pre> */ public static final String getGlobalProperty(String key, String defaultValue) { Assert.noNullsWithMsg("key is required", key); // Check to see if there is a system property for this key String systemValue = System.getProperty(key); // If so, we are done if (systemValue != null) { return systemValue; } // Reformat the key as an environment variable key String environmentVariable = convertToEnvironmentVariable(key); // Check to see if we have a match for an environment variable String environmentValue = System.getenv(environmentVariable); if (environmentValue != null) { // If so, return the value of the environment variable return environmentValue; } else { // If not, return the default value return defaultValue; } }