/** * @param host The Discovery server host name */ public void setHost(String host) { if (StringUtils.isNotEmpty(host)) { this.host = host; } }
private String computeClientKey(String clientId, String path) { if (StringUtils.isEmpty(clientId)) { return null; } String clientKey = clientId; if (StringUtils.isNotEmpty(path)) { clientKey = clientKey + path; } return clientKey; }
/** * Replace the dots in the property with underscore and * transform to uppercase. * * @param dottedProperty The property with dots, example - a.b.c * @return The converted value */ public static String convertDotToUnderscore(String dottedProperty) { return convertDotToUnderscore(dottedProperty, true); }
/** * @param requestURI The request URI * @return A URI that is prepended with the contextPath, if set */ protected URI resolveRequestURI(URI requestURI) { if (StringUtils.isNotEmpty(contextPath)) { try { return new URI(StringUtils.prependUri(contextPath, requestURI.toString())); } catch (URISyntaxException e) { //should never happen } } return requestURI; }
@Override public void setSecureHealthCheckUrl(String secureHealthCheckUrl) { if (!StringUtils.isEmpty(secureHealthCheckUrl)) { this.secureHealthCheckUrl = secureHealthCheckUrl; } }
if (i > -1 && resolvedProperty.endsWith("]")) { String index = resolvedProperty.substring(i + 1, resolvedProperty.length() - 1); if (StringUtils.isNotEmpty(index)) { resolvedProperty = resolvedProperty.substring(0, i); Map entries = resolveEntriesForKey(resolvedProperty, true); Object v = entries.get(resolvedProperty); if (StringUtils.isDigits(index)) { Integer number = Integer.valueOf(index); List list;
/** * Converts the given objects into a set of interned strings contained within an internal pool of lists. See {@link String#intern()}. * * <p>This method serves the purpose of reducing memory footprint by pooling common lists of annotations in compiled {@link AnnotationMetadata}</p> * * @param objects The objects * @return A unmodifiable, pooled set of strings */ @SuppressWarnings({"unused", "unchecked"}) @UsedByGeneratedCode public static List<String> internListOf(Object... objects) { if (objects == null || objects.length == 0) { return Collections.EMPTY_LIST; } Integer hash = Arrays.hashCode(objects); return INTERN_LIST_POOL.computeIfAbsent(hash, integer -> StringUtils.internListOf(objects)); }
@Override public void setHealthCheckUrl(String healthCheckUrl) { if (!StringUtils.isEmpty(healthCheckUrl)) { this.healthCheckUrl = healthCheckUrl; } }
if (i > -1 && resolvedProperty.endsWith("]")) { String index = resolvedProperty.substring(i + 1, resolvedProperty.length() - 1); if (StringUtils.isNotEmpty(index)) { resolvedProperty = resolvedProperty.substring(0, i); Map entries = resolveEntriesForKey(resolvedProperty, true); Object v = entries.get(resolvedProperty); if (StringUtils.isDigits(index)) { Integer number = Integer.valueOf(index); List list;
@Override public List<String> getAnnotationNamesByStereotype(String stereotype) { if (annotationsByStereotype != null) { List<String> annotations = annotationsByStereotype.get(stereotype); if (annotations != null) { return Collections.unmodifiableList(annotations); } } if (allAnnotations != null && allAnnotations.containsKey(stereotype)) { return StringUtils.internListOf(stereotype); } if (declaredAnnotations != null && declaredAnnotations.containsKey(stereotype)) { return StringUtils.internListOf(stereotype); } return Collections.emptyList(); }
/** * Sets the protocol to use. Default value ({@value io.micronaut.http.ssl.SslConfiguration#DEFAULT_PROTOCOL}). * * @param protocol The protocol */ public void setProtocol(String protocol) { if (!StringUtils.isNotEmpty(protocol)) { this.protocol = protocol; } }
if (StringUtils.isEmpty(beanMethod)) { throw new IllegalStateException("No bean bean method to adapt found in Adapter configuration for method: " + method); if (StringUtils.isNotEmpty(beanQualifier)) { this.executionHandle = beanContext.findExecutionHandle( beanType,
@Override public void setHomePageUrl(String homePageUrl) { if (!StringUtils.isEmpty(homePageUrl)) { this.homePageUrl = homePageUrl; } }
@Override public List<String> getAnnotationNamesByStereotype(String stereotype) { if (annotationsByStereotype != null) { List<String> annotations = annotationsByStereotype.get(stereotype); if (annotations != null) { return Collections.unmodifiableList(annotations); } } if (allAnnotations != null && allAnnotations.containsKey(stereotype)) { return StringUtils.internListOf(stereotype); } if (declaredAnnotations != null && declaredAnnotations.containsKey(stereotype)) { return StringUtils.internListOf(stereotype); } return Collections.emptyList(); }
/** * Reads the value of MICRONAUT_CONFIG_FILES environment variable. * * @return The comma-separated list of files */ protected String readPropertySourceListKeyFromEnvironment() { return System.getenv(StringUtils.convertDotToUnderscore(Environment.PROPERTY_SOURCES_KEY)); }
@Override public void setIpAddr(String ipAddr) { if (StringUtils.isNotEmpty(ipAddr)) { this.ipAddr = ipAddr; } }
preferIpAddress = false; if (StringUtils.isEmpty(appName)) { appName = applicationConfiguration.getName().orElse(Environment.DEFAULT_NAME); if (StringUtils.isEmpty(hostname)) { hostname = embeddedServer.getHost(); if (StringUtils.isEmpty(ipAddr)) { ipAddr = lookupIp(hostname); this.explicitInstanceId = StringUtils.isNotEmpty(instanceId) || preferIpAddress; if (!explicitInstanceId || StringUtils.isEmpty(instanceId)) { String appHostname = preferIpAddress ? ipAddr : hostname; instanceId = appHostname + ":" + appName + ":" + port;
@Override public void setStatusPageUrl(String statusPageUrl) { if (!StringUtils.isEmpty(statusPageUrl)) { this.statusPageUrl = statusPageUrl; } }
@Override public List<String> getDeclaredAnnotationNamesByStereotype(String stereotype) { if (annotationsByStereotype != null) { List<String> annotations = annotationsByStereotype.get(stereotype); if (annotations != null) { annotations = new ArrayList<>(annotations); if (declaredAnnotations != null) { annotations.removeIf(s -> !declaredAnnotations.containsKey(s)); return Collections.unmodifiableList(annotations); } else { // no declared return Collections.emptyList(); } } } if (declaredAnnotations != null && declaredAnnotations.containsKey(stereotype)) { return StringUtils.internListOf(stereotype); } return Collections.emptyList(); }