/** * @return all the chunks in a single list */ public List<DiffChunk> getUnifiedChunks() { return CollectionUtil.copyAsImmutableList(chunks); }
CompositeTimedTestListener(final Collection<? extends TimedTestListener> listeners) { this.listeners = CollectionUtil.copyAsImmutableList(listeners); }
Map<String, List<ClauseHandler>> createHandlerIndex() { final Map<String, List<ClauseHandler>> tmpHandlerIndex = new HashMap<String, List<ClauseHandler>>(); for (final Map.Entry<String, Set<ClauseHandler>> entry : handlerIndex.entrySet()) { tmpHandlerIndex.put(entry.getKey(), copyAsImmutableList(entry.getValue())); } return Collections.unmodifiableMap(tmpHandlerIndex); }
Map<String, List<SearchHandler.SearcherRegistration>> createSearcherJqlNameIndex() { final HashMap<String, List<SearchHandler.SearcherRegistration>> tmpHandlerIndex = new HashMap<String, List<SearchHandler.SearcherRegistration>>(); for (final Map.Entry<String, Set<SearchHandler.SearcherRegistration>> entry : searcherClauseNameIndex.entrySet()) { tmpHandlerIndex.put(entry.getKey(), copyAsImmutableList(entry.getValue())); } return Collections.unmodifiableMap(tmpHandlerIndex); }
public OrderByImpl(final Collection<SearchSort> searchSorts) { this.searchSorts = CollectionUtil.copyAsImmutableList(containsNoNulls("searchSorts", searchSorts)); }
/** * Create a new handler. * * @param fieldIndexers the indexers to associate with the handler. May not be null. * @param searcherRegistration the registration to associate with the handler. May be null. * @param clauseRegistrations the JQL clauses to associate with the chanler. May not be null. */ public SearchHandler(final List<FieldIndexer> fieldIndexers, final SearcherRegistration searcherRegistration, final List<ClauseRegistration> clauseRegistrations) { this.clauseRegistrations = CollectionUtil.copyAsImmutableList(containsNoNulls("clauseRegistrations", clauseRegistrations)); this.fieldIndexers = CollectionUtil.copyAsImmutableList(containsNoNulls("fieldIndexers", fieldIndexers)); this.searcherRegistration = searcherRegistration; }
public JiraDataTypeImpl(final Collection<? extends Class<?>> types) { notNull("types", types); not("types", types.isEmpty()); this.types = CollectionUtil.copyAsImmutableList(types); final Collection<String> strTypes = Lists.newArrayListWithCapacity(types.size()); for (final Class<?> type : types) { strTypes.add(type.getName()); } stringTypes = Collections.unmodifiableCollection(strTypes); }
void setProjectsWithBrowsePermission(final ApplicationUser user, final Collection<GenericValue> projectsWithBrowsePermission) { //JRA-16757: Make an immutable copy of the returned list and return it. This will give a runtime exception anyone that is trying //to modify the list inline. final CacheKey cacheKey = new CacheKey(user); projectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.copyAsImmutableList(projectsWithBrowsePermission)); projectObjectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.transform(projectsWithBrowsePermission, gvToProjectTransformer)); }
public CustomFieldSearcherInformation(final String id, final String nameKey, final List<? extends FieldIndexer> indexers, final AtomicReference<CustomField> fieldReference) { super(id, nameKey, Collections.<Class<? extends FieldIndexer>>emptyList(), fieldReference, SearcherGroupType.CUSTOM); this.indexers = CollectionUtil.copyAsImmutableList(Assertions.notNull("indexers", indexers)); Assertions.stateTrue("indexers", !this.indexers.isEmpty()); this.fieldReference = fieldReference; }
void setProjectObjectsWithBrowsePermission(final ApplicationUser user, final Collection<Project> projectsWithBrowsePermission) { //JRA-16757: Make an immutable copy of the returned list and return it. This will give a runtime exception anyone that is trying //to modify the list inline. final CacheKey cacheKey = new CacheKey(user); projectObjectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.copyAsImmutableList(projectsWithBrowsePermission)); projectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.transform(projectsWithBrowsePermission, projectToGVTransformer)); }
/** * @see #getFilteredList(java.util.List, java.util.Set) * @param source the list of chunks to filter * @param excludedTypes the diff types to exclude * @return an unmodifiable list of the remaining chunks */ private static List<CharacterChunk> getFilteredListOfCharacterChunks(final List<CharacterChunk> source, final Set<DiffType> excludedTypes) { if (source != null) { final List<CharacterChunk> result = new ArrayList<CharacterChunk>(source.size()); for (CharacterChunk chunk : source) { if (!excludedTypes.contains(chunk.getType())) { result.add(chunk); } } return CollectionUtil.copyAsImmutableList(result); } return Collections.emptyList(); }
public SearcherRegistration(final IssueSearcher<?> searcher, final List<ClauseRegistration> clauseRegistrations) { this.searcher = notNull("searcher", searcher); this.clauseRegistrations = CollectionUtil.copyAsImmutableList(containsNoNulls("clauseRegistrations", clauseRegistrations)); }
public FunctionOperand(String name, Collection<String> args) { this.name = Assertions.notNull("name", name); this.args = CollectionUtil.copyAsImmutableList(Assertions.notNull("args", args)); }
public JqlParseErrorMessage(final String key, final int lineNumber, final int columnNumber, final Collection<?> arguments) { containsNoNulls("arguments", arguments); this.key = notBlank("key", key); this.arguments = CollectionUtil.copyAsImmutableList(arguments); this.lineNumber = lineNumber <= 0 ? -1 : lineNumber; this.columnNumber = columnNumber <= 0 ? -1 : columnNumber; }
public SearcherGroup(SearcherGroupType type, Collection<IssueSearcher<?>> searchers) { this.type = notNull("type", type); this.printHeader = StringUtils.isNotBlank(type.getI18nKey()); this.searchers = CollectionUtil.copyAsImmutableList(containsNoNulls("searchers", searchers)); }
@Override public CacheObject<List<FieldConfigScheme>> load(@Nonnull final String fieldId) { ConfigurableField field = (ConfigurableField) ComponentAccessor.getFieldManager().getField(fieldId); List<FieldConfigScheme> schemes = CollectionUtil.copyAsImmutableList(CachedFieldConfigSchemePersister.super.getConfigSchemesForCustomField(field)); return CacheObject.wrap(schemes); } }
public MultiValueOperand(Collection<? extends Operand> values) { containsNoNulls("values", values); not("values is empty", values.isEmpty()); this.values = CollectionUtil.copyAsImmutableList(values); this.hashcode = calculateHashCode(this.values); }
public GenericClauseQueryFactory(final String documentFieldName, List<OperatorSpecificQueryFactory> operatorQueryFactories, JqlOperandResolver operandResolver) { this.documentFieldName = notNull("documentFieldName", documentFieldName); this.operandResolver = notNull("operandResolver", operandResolver); this.operatorQueryFactories = CollectionUtil.copyAsImmutableList(notNull("operatorQueryFactories", operatorQueryFactories)); }
/** * Filters some source chunks based on a set of excluded {@link com.atlassian.diff.DiffType}s. * Will go down into the {@link com.atlassian.diff.CharacterChunk} level as well. * * @param source the list of chunks to filter * @param excludedTypes the diff types to exclude * @return an unmodifiable list of the remaining chunks */ static List<DiffChunk> getFilteredList(final List<DiffChunk> source, final Set<DiffType> excludedTypes) { final List<DiffChunk> result = new ArrayList<DiffChunk>(source.size()); for (DiffChunk chunk : source) { if (!excludedTypes.contains(chunk.getType())) { // Now run through and make sure there are no invalid subchunks if (chunk instanceof WordChunk) { WordChunk wordChunk = (WordChunk)chunk; if (wordChunk.getCharacterChunks() != null) { final List<CharacterChunk> notDeletedChunks = getFilteredListOfCharacterChunks(wordChunk.getCharacterChunks(), excludedTypes); chunk = new WordChunk(wordChunk.getType(), notDeletedChunks); } } result.add(chunk); } } return CollectionUtil.copyAsImmutableList(result); }