Does consume if the resource and the origin (if given) matches.

@param resource the actual resource to be consumed
@return boolean
331364
@Override
    public boolean doesConsume(Resource<ResourceType> resource) {
        boolean resourceMatches = consumption.doesConsume(resource);
        boolean originMatches = false;
        if(resourceMatches)
            originMatches = (justification == null) || justification.equals(resource.getSource());
        return resourceMatches && originMatches;
    }
227201
public static function isEmpty($resource)
    {
        if (!self::isValid($resource) &&
            null !== $resource) {
            return false;
        }

        return String::isEmpty($resource);
    }
1326718
public static boolean isValid(Resource resource) {
        return resource instanceof ResourceHandle
                ? ((ResourceHandle) resource).isValid()
                : resource != null && resource.getResourceResolver().getResource(resource.getPath()) != null;
    }
1248889
public static function isNotEmpty($resource)
    {
        if (!self::isValid($resource) &&
            null !== $resource) {
            return false;
        }

        return ($resource !== null && $resource !== '');
    }
767859
public static boolean isJavaArtifact(IResource resource) {
        if (resource == null || (resource.getType() != IResource.FILE)) {
            return false;
        }
        String ex = resource.getFileExtension();
        if ("java".equalsIgnoreCase(ex) || "class".equalsIgnoreCase(ex)) {
            return true;
        }
        String name = resource.getName();
        return Archive.isArchiveFileName(name);
    }
96344
private boolean containsIncompatibleResourceType() {
    if (queryByResourceType && queryByPermission) {
      Resource[] resources = resourcesIntersection.toArray(new Resource[resourcesIntersection.size()]);
      return !ResourceTypeUtil.resourceIsContainedInArray(resourceType, resources);
    }
    return false;
  }
1280061
public function claimUsedResourceIdentifier(ResourceInterface $resource) {
		if ($resource->getResource()->hasIdentification() === false) {
			throw new InputException('can not validate resource without identifier, set type and id first');
		}
		
		$resourceKey = $resource->getResource()->getIdentificationKey();
		if (isset($this->usedResourceIdentifiers[$resourceKey]) === false) {
			$this->usedResourceIdentifiers[$resourceKey] = true;
			return;
		}
		
		throw new DuplicateException('can not have multiple resources with the same identification');
	}
450456
protected function resourceExists($resource)
    {
        /** @var \DreamFactory\Core\Contracts\ServiceResponseInterface $rs */
        $rs = ServiceManager::handleRequest($this->service->getName(), Verbs::GET, $resource);
        if ($rs->getStatusCode() === HttpStatusCodes::HTTP_NOT_FOUND) {
            return false;
        }

        return true;
    }
947131
public function hasSharedLock($resource = null): bool
    {
        if (null !== $resource) {
            return isset($this->sharedLock[$this->getResourceId($resource)]);
        }

        return !empty($this->sharedLock);
    }
107045
public function hasResource($resource) {

		if(null !== $resource && false === is_string($resource)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($resource)), E_USER_ERROR);
		}

		return true === array_key_exists($resource, $this -> resources);
	}
1117883
private boolean hasContentInVfsOrImport(CmsResource resource) {

        if (m_contentFiles.contains(resource.getResourceId())) {
            return true;
        }
        try {
            List<CmsResource> resources = getCms().readSiblings(resource, CmsResourceFilter.ALL);
            if (!resources.isEmpty()) {
                return true;
            }
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        return false;

    }
1230075
protected function resourceExists($resource)
    {
        if (!$resource) {
            return false;
        }
        if ($resource instanceof ModuleResource) {
            return $resource->exists();
        }
        $base = rtrim(Director::baseFolder(), '/');
        return file_exists($base . '/' . $resource);
    }
216043
public boolean destinationMatches(DestinationHandler destinationHandlerToCompare,
                                    JSConsumerManager consumerDispatcher)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "destinationMatches", new Object[] {destinationHandlerToCompare, consumerDispatcher});

    //For remote get, at the destination localising ME, the destination attached
    //to is never an alias as the alias resolution is done at the getting ME
    boolean matches = (consumerDispatcher.getDestination() == destinationHandlerToCompare);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "destinationMatches", Boolean.valueOf(matches));

    return matches;
  }
92025
@Override
	public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
		if (!Constants.PARAM_HISTORY.equals(theRequest.getOperation())) {
			return false;
		}
		if (theRequest.getResourceName() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_SYSTEM;
		}
		if (!StringUtils.equals(theRequest.getResourceName(), myResourceName)) {
			return false;
		}

		boolean haveIdParam = theRequest.getId() != null && !theRequest.getId().isEmpty();
		boolean wantIdParam = myIdParamIndex != null;
		if (haveIdParam != wantIdParam) {
			return false;
		}

		if (theRequest.getId() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_TYPE;
		} else if (theRequest.getId().hasVersionIdPart()) {
			return false;
		}

		return true;
	}
1005382
protected function isRequested($resource = null): bool
    {
        $requestKey = config('fractal.auto_includes.request_key');

        if (! config('fractal.auto_includes.enabled')) {
            return false;
        }

        if (! $includes = app('request')->get($requestKey)) {
            return false;
        }

        $includes = explode(',', $includes);

        if (! \is_array($includes)) {
            return false;
        }

        if (! \in_array($resource, $includes, false)) {
            return false;
        }

        return true;
    }
604985
public function isGranted($resource)
    {
        foreach ($this->roles as $role) {
            if (true === $role->hasResource($resource)) {
                return true;
            }
        }

        return false;
    }
735539
public function consume()
	{
		if (isset($this->data[$this->position]))
		{
			$this->consumed .= $this->data[$this->position];
			return $this->data[$this->position++];
		}
		else
		{
			return false;
		}
	}