Java Code Examples for io.micronaut.core.util.StringUtils#EMPTY_STRING_ARRAY
The following examples show how to use
io.micronaut.core.util.StringUtils#EMPTY_STRING_ARRAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MicronautBeanFactory.java From micronaut-spring with Apache License 2.0 | 6 votes |
@Override public @Nonnull String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) { // ignore certain common cases if (type == null || Object.class == type || List.class == type || beanExcludes.contains(type)) { return StringUtils.EMPTY_STRING_ARRAY; } String[] names = beanNamesForTypeCache.get(type); if (names == null) { final String[] superResult = MicronautBeanFactory.super.getBeanNamesForType(type, includeNonSingletons, allowEagerInit); if (ArrayUtils.isNotEmpty(superResult)) { names = superResult; } else { final Collection<? extends BeanDefinition<?>> beanDefinitions = beanContext.getBeanDefinitions(type); names = beansToNames(beanDefinitions); } beanNamesForTypeCache.put(type, names); } return names; }
Example 2
Source File: AbstractQueryInterceptor.java From micronaut-data with Apache License 2.0 | 5 votes |
@Override public String[] getParameterNames() { if (parameterNames == null) { return StringUtils.EMPTY_STRING_ARRAY; } return this.parameterNames; }
Example 3
Source File: AbstractQueryInterceptor.java From micronaut-data with Apache License 2.0 | 5 votes |
@Override public String[] getIndexedParameterPaths() { if (parameterPaths != null) { return parameterPaths; } return StringUtils.EMPTY_STRING_ARRAY; }
Example 4
Source File: MicronautBeanFactory.java From micronaut-spring with Apache License 2.0 | 5 votes |
@Override public @Nonnull String[] getBeanNamesForType(@Nonnull ResolvableType type) { final Class<?> resolved = type.resolve(); if (resolved != null) { return getBeanNamesForType(resolved); } return StringUtils.EMPTY_STRING_ARRAY; }
Example 5
Source File: UpdateByMethod.java From micronaut-data with Apache License 2.0 | 4 votes |
@Nullable @Override protected MethodMatchInfo buildInfo( MethodMatchContext matchContext, @NonNull ClassElement queryResultType, @Nullable QueryModel query) { if (query == null) { matchContext.fail("Cannot implement batch update operation that doesn't perform a query"); return null; } if (CollectionUtils.isNotEmpty(query.getProjections())) { matchContext.fail("Projections are not supported on batch updates"); return null; } String[] updateProperties; if (!(query instanceof RawQuery)) { List<QueryModel.Criterion> criterionList = query.getCriteria().getCriteria(); if (CollectionUtils.isEmpty(criterionList)) { matchContext.fail("Cannot implement batch update operation that doesn't perform a query"); return null; } Set<String> queryParameters = new HashSet<>(); for (QueryModel.Criterion criterion : criterionList) { if (criterion instanceof QueryModel.PropertyCriterion) { QueryModel.PropertyCriterion pc = (QueryModel.PropertyCriterion) criterion; Object v = pc.getValue(); if (v instanceof QueryParameter) { queryParameters.add(((QueryParameter) v).getName()); } } } List<Element> updateParameters = Arrays.stream(matchContext.getParameters()).filter(p -> !queryParameters.contains(p.getName())) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(updateParameters)) { matchContext.fail("At least one parameter required to update"); return null; } Element element = matchContext.getParametersInRole().get(TypeRole.LAST_UPDATED_PROPERTY); if (element instanceof PropertyElement) { updateParameters.add(element); } SourcePersistentEntity entity = matchContext.getRootEntity(); updateProperties = new String[updateParameters.size()]; for (int i = 0; i < updateProperties.length; i++) { Element parameter = updateParameters.get(i); String parameterName = parameter.stringValue(Parameter.class).orElse(parameter.getName()); Optional<String> path = entity.getPath(parameterName); if (path.isPresent()) { updateProperties[i] = path.get(); } else { matchContext.fail("Cannot perform batch update for non-existent property: " + parameterName); return null; } } } else { updateProperties = StringUtils.EMPTY_STRING_ARRAY; } return new MethodMatchInfo( queryResultType, query, getInterceptorElement(matchContext, UpdateMethod.pickUpdateInterceptor(matchContext.getReturnType())), MethodMatchInfo.OperationType.UPDATE, updateProperties ); }
Example 6
Source File: StoredQuery.java From micronaut-data with Apache License 2.0 | 4 votes |
/** * @return The parameter names the case where named parameters are supported */ default String[] getParameterNames() { return StringUtils.EMPTY_STRING_ARRAY; }
Example 7
Source File: StoredQuery.java From micronaut-data with Apache License 2.0 | 4 votes |
/** * @return The indexed parameter paths. */ default String[] getIndexedParameterPaths() { return StringUtils.EMPTY_STRING_ARRAY; }
Example 8
Source File: MicronautEnvironment.java From micronaut-spring with Apache License 2.0 | 4 votes |
@Override public String[] getDefaultProfiles() { return StringUtils.EMPTY_STRING_ARRAY; }