Code example for Joiner

Methods: join

0
        ResourceMetadata r = m_cache.getIfPresent(key(context, resourceId));
        return (r != null) ? Optional.of(r) : Optional.<ResourceMetadata>absent();
    } 
 
    private String key(Context context, Resource resource) {
        return m_keyJoiner.join(context.getId(), resource.getId());
    } 
 
    @Override 
    public void merge(Context context, Resource resource, ResourceMetadata metadata) {
 
        Optional<ResourceMetadata> o = get(context, resource);
 
        if (!o.isPresent()) {
            ResourceMetadata newMetadata = new ResourceMetadata(m_metricReqs, m_attributeReqs, m_metricMisses, m_attributeMisses);
            newMetadata.merge(metadata);
            m_cache.put(key(context, resource), newMetadata);
            return; 
        }