List of usage examples for org.apache.commons.collections4 SetUtils unmodifiableSet
public static <E> Set<E> unmodifiableSet(final Set<? extends E> set)
From source file:com.github.rvesse.airline.model.ArgumentsMetadata.java
public ArgumentsMetadata(Iterable<String> titles, String description, Iterable<ArgumentsRestriction> restrictions, Iterable<Field> path) { //@formatter:on if (titles == null) throw new NullPointerException("title cannot be null"); if (path == null) throw new NullPointerException("path cannot be null"); if (!path.iterator().hasNext()) throw new IllegalArgumentException("path cannot be empty"); this.titles = ListUtils.unmodifiableList(IteratorUtils.toList(titles.iterator())); this.description = description; this.restrictions = restrictions != null ? AirlineUtils.unmodifiableListCopy(restrictions) : Collections.<ArgumentsRestriction>emptyList(); this.accessors = SetUtils.unmodifiableSet(AirlineUtils.singletonSet(new Accessor(path))); }
From source file:com.github.rvesse.airline.model.OptionMetadata.java
public OptionMetadata(OptionType optionType, Iterable<String> options, String title, String description, int arity, boolean hidden, boolean overrides, boolean sealed, Iterable<OptionRestriction> restrictions, Iterable<Field> path) { //@formatter:on if (optionType == null) throw new NullPointerException("optionType cannot be null"); if (options == null) throw new NullPointerException("options cannot be null"); if (!options.iterator().hasNext()) throw new NullPointerException("options cannot be empty"); if (title == null) throw new NullPointerException("title cannot be null"); this.optionType = optionType; this.options = AirlineUtils.unmodifiableSetCopy(options); this.title = title; this.description = description; this.arity = arity; this.hidden = hidden; this.overrides = overrides; this.sealed = sealed; this.restrictions = restrictions != null ? AirlineUtils.unmodifiableListCopy(restrictions) : Collections.<OptionRestriction>emptyList(); if (path != null) { this.accessors = SetUtils.unmodifiableSet(AirlineUtils.singletonSet(new Accessor(path))); }/* w w w . java 2 s.c o m*/ }
From source file:com.github.sevntu.checkstyle.ordering.MethodOrder.java
public MethodOrder(Dependencies dependencies) { this.methods = MapUtils.unmodifiableMap(getAllMethods(dependencies)); this.initialOrdering = ListUtils.unmodifiableList(getInitialMethodOrdering(methods)); this.currentOrdering = this.initialOrdering; final Map<ResolvedCall, MethodInvocation> callsToInvocations = getAllInvocations(dependencies, methods); this.invocations = SetUtils.unmodifiableSet(new HashSet<>(callsToInvocations.values())); this.invocationNesting = MultiMapUtils .unmodifiableMultiValuedMap(getMethodInvocationsNesting(callsToInvocations)); }
From source file:com.github.rvesse.airline.model.ArgumentsMetadata.java
public ArgumentsMetadata(Iterable<ArgumentsMetadata> arguments) { if (arguments == null) throw new NullPointerException("arguments cannot be null"); if (!arguments.iterator().hasNext()) throw new IllegalArgumentException("arguments cannot be empty"); ArgumentsMetadata first = arguments.iterator().next(); this.titles = first.titles; this.description = first.description; this.restrictions = first.restrictions; Set<Accessor> accessors = new HashSet<>(); for (ArgumentsMetadata other : arguments) { if (!first.equals(other)) throw new IllegalArgumentException( String.format("Conflicting arguments definitions: %s, %s", first, other)); accessors.addAll(other.getAccessors()); }/* ww w.ja va 2 s. co m*/ this.accessors = SetUtils.unmodifiableSet(accessors); }
From source file:com.github.rvesse.airline.model.OptionMetadata.java
public OptionMetadata(Iterable<OptionMetadata> options) { if (options == null) throw new NullPointerException("options cannot be null"); if (!options.iterator().hasNext()) throw new IllegalArgumentException("options cannot be empty"); OptionMetadata option = options.iterator().next(); this.optionType = option.optionType; this.options = option.options; this.title = option.title; this.description = option.description; this.arity = option.arity; this.hidden = option.hidden; this.overrides = option.overrides; this.sealed = option.sealed; this.restrictions = option.restrictions; Set<Accessor> accessors = new LinkedHashSet<Accessor>(); for (OptionMetadata other : options) { if (!option.equals(other)) throw new IllegalArgumentException( String.format("Duplicate options definitions: %s, %s", option, other)); accessors.addAll(other.getAccessors()); }//from w ww . j av a 2 s. c o m this.accessors = SetUtils.unmodifiableSet(accessors); }
From source file:pt.ua.dicoogle.sdk.utils.TagsStruct.java
/** * Gets a read-only view of the DIM Fields * @return */ public Set<TagValue> getDIMFields() { return SetUtils.unmodifiableSet(this.nDIMFields); }
From source file:pt.ua.dicoogle.sdk.utils.TagsStruct.java
/** * @return a Read-only view of all fields. *//* w ww.j a v a2 s .c om*/ public Set<TagValue> getAllFields() { return SetUtils.unmodifiableSet(new HashSet<>(tagValueMappings.values())); }
From source file:pt.ua.dicoogle.sdk.utils.TagsStruct.java
/** * @return a Read only view of the Private Fields */ public Set<TagValue> getPrivateFields() { return SetUtils.unmodifiableSet(nPrivateFields); }
From source file:pt.ua.dicoogle.sdk.utils.TagsStruct.java
/** * @return a Read-only view of the Modalities. */ public Set<String> getModalities() { return SetUtils.unmodifiableSet(modalitiesSet); }