/*
(non-Javadoc)
@see org.springframework.hateoas.server.core.DefaultLinkRelationProvider#getCollectionResourceRelFor(java.lang.Class)
437224
@Override
	public LinkRelation getCollectionResourceRelFor(Class<?> type) {
		return LinkRelation.of(English.plural(getItemResourceRelFor(type).value()));
	}
168726
protected CmsResource getNextResource() {

        if ((m_collectorResult != null) && (m_collectorResult.size() > 0)) {

            m_contentInfoBean.incResultIndex();
            return m_collectorResult.remove(0);
        }

        return null;
    }
940713
public List<String> getResources() {

        List<String> res = new ArrayList<String>();
        for (I_CmsEditableGroupRow row : m_resourcesGroup.getRows()) {
            res.add(((CmsPathSelectField)row.getComponent()).getValue());
        }
        return res;
    }
873756
public ResourceEntry getResourceEntryList(int i) {
    if (ConceptMention_Type.featOkTst && ((ConceptMention_Type)jcasType).casFeat_resourceEntryList == null)
      jcasType.jcas.throwFeatMissing("resourceEntryList", "de.julielab.jules.types.ConceptMention");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i);
    return (ResourceEntry)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i)));}
1157953
@SuppressWarnings("unchecked")
  @Override
  public <T> List<T> getCollection(Class<T> entityClass) {
    String collectionName = Util.determineCollectionName(entityClass);
    Map<Object, T> collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    if (null == collection) {
      createCollection(collectionName);
      collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    }

    CollectionMetaData cmd = cmdMap.get(collectionName);
    List<T> newCollection = new ArrayList<T>();
    try {
      for (T document : collection.values()) {
        Object obj = Util.deepCopy(document);
        if(encrypted && cmd.hasSecret() && null != obj) {
          CryptoUtil.decryptFields(obj, cmd, dbConfig.getCipher());
        }
        newCollection.add((T) obj);
      }
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      logger.error("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
      throw new JsonDBException("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
    }
    return newCollection;
  }
530400
public MessageResourcesModel getDefaultMessageResources()
    {
        for ( java.util.Iterator ii = _messageResources.iterator(); ii.hasNext(); )  
        {
            MessageResourcesModel i = ( MessageResourcesModel ) ii.next();
            if ( i.getKey() == null ) return i;
        }
        
        return null;
    }
700054
@Override
  public URL getResource(String name) {

    URL result = null;

    if (bestCandidate != null) {
      result = bestCandidate.getResource(name);
      if (result == null) {
        bestCandidate = null;
      }
    }

    ClassLoadHelper loadHelper = null;

    Iterator<ClassLoadHelper> iter = loadHelpers.iterator();
    while (iter.hasNext()) {
      loadHelper = iter.next();

      result = loadHelper.getResource(name);
      if (result != null) {
        break;
      }
    }

    bestCandidate = loadHelper;
    return result;
  }
26814
public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) {
        Collection<?> collection = new ArrayList<>();
        if (List.class.isAssignableFrom(collectionInterface)) {
            collection = new ArrayList<>();
        } else if (NavigableSet.class.isAssignableFrom(collectionInterface)) {
            collection = new TreeSet<>();
        } else if (SortedSet.class.isAssignableFrom(collectionInterface)) {
            collection = new TreeSet<>();
        } else if (Set.class.isAssignableFrom(collectionInterface)) {
            collection = new HashSet<>();
        } else if (BlockingDeque.class.isAssignableFrom(collectionInterface)) {
            collection = new LinkedBlockingDeque<>();
        } else if (Deque.class.isAssignableFrom(collectionInterface)) {
            collection = new ArrayDeque<>();
        } else if (TransferQueue.class.isAssignableFrom(collectionInterface)) {
            collection = new LinkedTransferQueue<>();
        } else if (BlockingQueue.class.isAssignableFrom(collectionInterface)) {
            collection = new LinkedBlockingQueue<>();
        } else if (Queue.class.isAssignableFrom(collectionInterface)) {
            collection = new LinkedList<>();
        }
        return collection;
    }
1326109
public Collection<CollectionConfig> getCollectionConfigs() throws InvalidProtocolBufferException {
        List<CollectionConfig> ret = new LinkedList<>();
        for (org.hyperledger.fabric.protos.common.Collection.CollectionConfig collectionConfig : getCollectionConfigPackage().getConfigList()) {
            ret.add(new CollectionConfig(collectionConfig));

        }
        return ret;

    }
639316
protected List<CmsResource> getCategoryItems() {

        List<CmsResource> result = Collections.emptyList();
        if (CmsStringUtil.isNotEmpty(getParamGalleryPath())) {
            try {
                CmsCategoryService service = CmsCategoryService.getInstance();
                // get the edited resource if present
                String editedResource = "/";
                if (CmsStringUtil.isNotEmpty(getParamResource())) {
                    editedResource = CmsResource.getFolderPath(getParamResource());
                }
                // read the matching resources for the category
                result = service.readCategoryResources(getCms(), getParamGalleryPath(), true, editedResource);
                // filter the matched resources to get only the specific items as result
                int resTypeId = getGalleryItemsTypeId();
                if (resTypeId != -1) {
                    List<CmsResource> unfiltered = new ArrayList<CmsResource>(result);
                    result = new ArrayList<CmsResource>(unfiltered.size());
                    Iterator<CmsResource> i = unfiltered.iterator();
                    while (i.hasNext()) {
                        CmsResource res = i.next();
                        if (res.getTypeId() == resTypeId) {
                            result.add(res);
                        }
                    }
                }
            } catch (CmsException e) {
                // error reading resources
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            } catch (NullPointerException e) {
                // ignore this exception
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
        return result;
    }
612932
public @NotNull List<Resource> getResources() {
    return getResources((Predicate<Resource>)null, (Resource)null);
  }
1155562
public List getCollectionDescriptors(boolean withInherited)
    {
        if(withInherited && getSuperClassDescriptor() != null)
        {
            List result = new ArrayList(m_CollectionDescriptors);
            result.addAll(getSuperClassDescriptor().getCollectionDescriptors(true));
            return result;
        }
        else
        {
            return m_CollectionDescriptors;
        }
    }
373433
@Override
	public LinkRelation getCollectionResourceRelFor(java.lang.Class<?> type) {

		LookupContext context = LookupContext.forCollectionResourceRelLookup(type);

		return providers.getRequiredPluginFor(context).getCollectionResourceRelFor(type);
	}
1107844
@SuppressWarnings("unchecked")
    public static Collection<Object> getCollectionObj(Class<?> clazz) {
        if (clazz.isInterface()) {
            if (clazz.isAssignableFrom(List.class))
                return new ArrayList<>();
            else if (clazz.isAssignableFrom(Set.class))
                return new HashSet<>();
            else if (clazz.isAssignableFrom(Queue.class))
                return new ArrayDeque<>();
            else if (clazz.isAssignableFrom(SortedSet.class))
                return new TreeSet<>();
            else if (clazz.isAssignableFrom(BlockingQueue.class))
                return new LinkedBlockingDeque<>();
            else
                return null;
        } else {
            Collection<Object> collection = null;
            try {
                collection = (Collection<Object>) clazz.newInstance();
            } catch (Exception e) {
                System.err.println("new collection instance exception, " + e.getMessage());
            }
            return collection;
        }
    }
382843
def provides_collection_resource(obj):
    
    if isinstance(obj, type):
        obj = object.__new__(obj)
    return ICollectionResource in provided_by(obj)
1195940
@Override
	public Link linkToItemResource(Class<?> entity, Object id) {
		return linkFor(entity).slash(id).withSelfRel();
	}
899260
@SuppressWarnings({
			"unchecked", "rawtypes"
	})
	public Collection<String> getStringCollection(final Class<? extends Collection> clazz) {
		try {
			final Collection<String> collection = clazz.newInstance();
			final int len = getVInt();
			for (int i = 0; i < len; i++) {
				collection.add(getString());
			}
			return collection;
		} catch (InstantiationException e) {
			throw new IllegalArgumentException("Invalid class", e);
		} catch (IllegalAccessException e) {
			throw new IllegalArgumentException("Invalid class", e);
		}
	}