@Override public Collection<String> getPropertyNames() { return Lists.newLinkedList(new Iterable<String>() { @Override @SuppressWarnings("unchecked") public Iterator<String> iterator() { return Iterators.forEnumeration(request.getAttributeNames()); } }); }
@Override public Collection<String> getPropertyNames() { return Lists.newLinkedList(new Iterable<String>() { @Override @SuppressWarnings("unchecked") public Iterator<String> iterator() { return Iterators.forEnumeration(request.getAttributeNames()); } }); }
@Override public Collection<String> getPropertyNames() { return Lists.newLinkedList(new Iterable<String>() { @Override @SuppressWarnings("unchecked") public Iterator<String> iterator() { return Iterators.forEnumeration(request.getAttributeNames()); } }); }
/** * Provides resource methods and resource locator are available on the resource. The list is ordered so that resource * methods are positioned first before resource locator. * * @return List of resource methods and resource locator. */ public List<ResourceMethod> getAllMethods() { final LinkedList<ResourceMethod> methodsAndLocators = Lists.newLinkedList(getResourceMethods()); final ResourceMethod loc = getResourceLocator(); if (loc != null) { methodsAndLocators.add(loc); } return methodsAndLocators; }
/** * Provides resource methods and resource locator are available on the resource. The list is ordered so that resource * methods are positioned first before resource locator. * * @return List of resource methods and resource locator. */ public List<ResourceMethod> getAllMethods() { final LinkedList<ResourceMethod> methodsAndLocators = Lists.newLinkedList(getResourceMethods()); final ResourceMethod loc = getResourceLocator(); if (loc != null) { methodsAndLocators.add(loc); } return methodsAndLocators; }
/** * Provides resource methods and resource locator are available on the resource. The list is ordered so that resource * methods are positioned first before resource locator. * * @return List of resource methods and resource locator. */ public List<ResourceMethod> getAllMethods() { final LinkedList<ResourceMethod> methodsAndLocators = Lists.newLinkedList(getResourceMethods()); final ResourceMethod loc = getResourceLocator(); if (loc != null) { methodsAndLocators.add(loc); } return methodsAndLocators; }
/** * Copy constructor. * * @param config configurable to copy class properties from. */ public CommonConfig(final CommonConfig config) { this.type = config.type; this.properties = new HashMap<String, Object>(config.properties.size()); this.immutablePropertiesView = Collections.unmodifiableMap(this.properties); this.immutablePropertyNames = Collections.unmodifiableCollection(this.properties.keySet()); this.componentBag = config.componentBag.copy(); this.newFeatureRegistrations = Lists.newLinkedList(); this.enabledFeatureClasses = Sets.newIdentityHashSet(); this.enabledFeatures = Sets.newHashSet(); copy(config, false); }
/** * Copy constructor. * * @param config configurable to copy class properties from. */ public CommonConfig(final CommonConfig config) { this.type = config.type; this.properties = new HashMap<String, Object>(config.properties.size()); this.immutablePropertiesView = Collections.unmodifiableMap(this.properties); this.immutablePropertyNames = Collections.unmodifiableCollection(this.properties.keySet()); this.componentBag = config.componentBag.copy(); this.newFeatureRegistrations = Lists.newLinkedList(); this.enabledFeatureClasses = Sets.newIdentityHashSet(); this.enabledFeatures = Sets.newHashSet(); copy(config, false); }
/** * Copy constructor. * * @param config configurable to copy class properties from. */ public CommonConfig(final CommonConfig config) { this.type = config.type; this.properties = new HashMap<String, Object>(config.properties.size()); this.immutablePropertiesView = Collections.unmodifiableMap(this.properties); this.immutablePropertyNames = Collections.unmodifiableCollection(this.properties.keySet()); this.componentBag = config.componentBag.copy(); this.newFeatureRegistrations = Lists.newLinkedList(); this.enabledFeatureClasses = Sets.newIdentityHashSet(); this.enabledFeatures = Sets.newHashSet(); copy(config, false); }
/** * Merge and sort given providers with {@link RankedComparator ranked comparator}. * * @param comparator comparator to sort the providers with. * @param providerIterables providers to be sorted. * @param <T> service provider contract Java type. * @return merged and sorted {@link Iterable iterable} instance containing given providers. * The returned value is never {@code null}. */ @SuppressWarnings("TypeMayBeWeakened") public static <T> Iterable<T> mergeAndSortRankedProviders(final RankedComparator<T> comparator, final Iterable<Iterable<RankedProvider<T>>> providerIterables) { final List<RankedProvider<T>> rankedProviders = Lists.newArrayList(); for (final Iterable<RankedProvider<T>> providers : providerIterables) { rankedProviders.addAll(Lists.<RankedProvider<T>>newLinkedList(providers)); } Collections.sort(rankedProviders, comparator); return Collections2.transform(rankedProviders, new Function<RankedProvider<T>, T>() { @Override public T apply(final RankedProvider<T> input) { return input.getProvider(); } }); }
/** * Merge and sort given providers with {@link RankedComparator ranked comparator}. * * @param comparator comparator to sort the providers with. * @param providerIterables providers to be sorted. * @param <T> service provider contract Java type. * @return merged and sorted {@link Iterable iterable} instance containing given providers. * The returned value is never {@code null}. */ @SuppressWarnings("TypeMayBeWeakened") public static <T> Iterable<T> mergeAndSortRankedProviders(final RankedComparator<T> comparator, final Iterable<Iterable<RankedProvider<T>>> providerIterables) { final List<RankedProvider<T>> rankedProviders = Lists.newArrayList(); for (final Iterable<RankedProvider<T>> providers : providerIterables) { rankedProviders.addAll(Lists.<RankedProvider<T>>newLinkedList(providers)); } Collections.sort(rankedProviders, comparator); return Collections2.transform(rankedProviders, new Function<RankedProvider<T>, T>() { @Override public T apply(final RankedProvider<T> input) { return input.getProvider(); } }); }
/** * Merge and sort given providers with {@link RankedComparator ranked comparator}. * * @param comparator comparator to sort the providers with. * @param providerIterables providers to be sorted. * @param <T> service provider contract Java type. * @return merged and sorted {@link Iterable iterable} instance containing given providers. * The returned value is never {@code null}. */ @SuppressWarnings("TypeMayBeWeakened") public static <T> Iterable<T> mergeAndSortRankedProviders(final RankedComparator<T> comparator, final Iterable<Iterable<RankedProvider<T>>> providerIterables) { final List<RankedProvider<T>> rankedProviders = Lists.newArrayList(); for (final Iterable<RankedProvider<T>> providers : providerIterables) { rankedProviders.addAll(Lists.<RankedProvider<T>>newLinkedList(providers)); } Collections.sort(rankedProviders, comparator); return Collections2.transform(rankedProviders, new Function<RankedProvider<T>, T>() { @Override public T apply(final RankedProvider<T> input) { return input.getProvider(); } }); }
private Builder(final Resource.Builder parentResource) { this.methodBuilders = Sets.newLinkedHashSet(); this.childResourceBuilders = Sets.newLinkedHashSet(); this.childResources = Lists.newLinkedList(); this.resourceMethods = Lists.newLinkedList(); this.handlerClasses = Sets.newIdentityHashSet(); this.handlerInstances = Sets.newIdentityHashSet(); this.parentResource = parentResource; name("[unnamed]"); }
private Builder(final Resource.Builder parentResource) { this.methodBuilders = Sets.newLinkedHashSet(); this.childResourceBuilders = Sets.newLinkedHashSet(); this.childResources = Lists.newLinkedList(); this.resourceMethods = Lists.newLinkedList(); this.handlerClasses = Sets.newIdentityHashSet(); this.handlerInstances = Sets.newIdentityHashSet(); this.parentResource = parentResource; name("[unnamed]"); }
private Builder(final Resource.Builder parentResource) { this.methodBuilders = Sets.newLinkedHashSet(); this.childResourceBuilders = Sets.newLinkedHashSet(); this.childResources = Lists.newLinkedList(); this.resourceMethods = Lists.newLinkedList(); this.handlerClasses = Sets.newIdentityHashSet(); this.handlerInstances = Sets.newIdentityHashSet(); this.parentResource = parentResource; name("[unnamed]"); }
/** * Creates a <i>mutable</i> {@code LinkedList} instance containing the given * elements; a very thin shortcut for creating an empty list then calling * {@link Iterables#addAll}. * * <p><b>Note:</b> if mutability is not required and the elements are * non-null, use {@link ImmutableList#copyOf(Iterable)} instead. (Or, change * {@code elements} to be a {@link FluentIterable} and call * {@code elements.toList()}.) * * <p><b>Performance note:</b> {@link ArrayList} and {@link * java.util.ArrayDeque} consistently outperform {@code LinkedList} except in * certain rare and specific situations. Unless you have spent a lot of time * benchmarking your specific needs, use one of those instead. * * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link * Collection}, you don't need this method. Use the {@code LinkedList} * {@linkplain LinkedList#LinkedList(Collection) constructor} directly, taking * advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList( Iterable<? extends E> elements) { LinkedList<E> list = newLinkedList(); Iterables.addAll(list, elements); return list; }
/** * Creates a <i>mutable</i> {@code LinkedList} instance containing the given * elements; a very thin shortcut for creating an empty list then calling * {@link Iterables#addAll}. * * <p><b>Note:</b> if mutability is not required and the elements are * non-null, use {@link ImmutableList#copyOf(Iterable)} instead. (Or, change * {@code elements} to be a {@link FluentIterable} and call * {@code elements.toList()}.) * * <p><b>Performance note:</b> {@link ArrayList} and {@link * java.util.ArrayDeque} consistently outperform {@code LinkedList} except in * certain rare and specific situations. Unless you have spent a lot of time * benchmarking your specific needs, use one of those instead. * * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link * Collection}, you don't need this method. Use the {@code LinkedList} * {@linkplain LinkedList#LinkedList(Collection) constructor} directly, taking * advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList( Iterable<? extends E> elements) { LinkedList<E> list = newLinkedList(); Iterables.addAll(list, elements); return list; }
private Request generateRequest(org.glassfish.jersey.server.model.Resource parentResource, final org.glassfish.jersey.server.model.ResourceMethod resourceMethod, Map<String, Param> wadlResourceParams) { try { final List<Parameter> requestParams = Lists.newLinkedList(resourceMethod.getInvocable().getParameters()); // Adding handler instance parameters to the list of potential request parameters. requestParams.addAll(resourceMethod.getInvocable().getHandler().getParameters()); if (requestParams.isEmpty()) { return null; } Request wadlRequest = _wadlGenerator.createRequest(parentResource, resourceMethod); processRequestParameters(parentResource, resourceMethod, wadlResourceParams, requestParams, wadlRequest); if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0) { return null; } else { return wadlRequest; } } catch (Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_REQUEST( resourceMethod, parentResource), e); } }
private Request generateRequest(org.glassfish.jersey.server.model.Resource parentResource, final org.glassfish.jersey.server.model.ResourceMethod resourceMethod, Map<String, Param> wadlResourceParams) { try { final List<Parameter> requestParams = Lists.newLinkedList(resourceMethod.getInvocable().getParameters()); // Adding handler instance parameters to the list of potential request parameters. requestParams.addAll(resourceMethod.getInvocable().getHandler().getParameters()); if (requestParams.isEmpty()) { return null; } Request wadlRequest = _wadlGenerator.createRequest(parentResource, resourceMethod); processRequestParameters(parentResource, resourceMethod, wadlResourceParams, requestParams, wadlRequest); if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0) { return null; } else { return wadlRequest; } } catch (Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_REQUEST( resourceMethod, parentResource), e); } }
private Request generateRequest(org.glassfish.jersey.server.model.Resource parentResource, final org.glassfish.jersey.server.model.ResourceMethod resourceMethod, Map<String, Param> wadlResourceParams) { try { final List<Parameter> requestParams = Lists.newLinkedList(resourceMethod.getInvocable().getParameters()); // Adding handler instance parameters to the list of potential request parameters. requestParams.addAll(resourceMethod.getInvocable().getHandler().getParameters()); if (requestParams.isEmpty()) { return null; } Request wadlRequest = _wadlGenerator.createRequest(parentResource, resourceMethod); processRequestParameters(parentResource, resourceMethod, wadlResourceParams, requestParams, wadlRequest); if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0) { return null; } else { return wadlRequest; } } catch (Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_REQUEST( resourceMethod, parentResource), e); } }