com.atlassian.jira.util
Interface Function<D,R>

Type Parameters:
D - the descriptor type.
R - the resource type it resolves to.
All Superinterfaces:
com.atlassian.util.concurrent.Function<D,R>
All Known Subinterfaces:
Resolver<I,O>
All Known Implementing Classes:
EnclosedIterable.ListResolver

public interface Function<D,R>
extends com.atlassian.util.concurrent.Function<D,R>

A Function that resolves Descriptors (of type D) to a Resource (of type R).

Semantically, this could be a Factory, Generator, Builder, Closure, Transformer, Resolver or something else entirely. No particular guarantees are implied by this interface apart from idempotence (see below). Specifically, implementations may or may not return or accept null and can optionally block until elements are available or throw runtime exceptions if the input is not acceptable for some reason. Any clients that require a firmer contract should subclass this interface and document their requirements.

It is expected that for any two calls to get(Object) D the returned resource will be semantically the same, ie. that the call is effectively idempotent. Any implementation that violates this should document the fact. It is not necessary that the resolved object is the same instance or even implements #equals(Object) and #hashCode() however.

As this interface requires idempotence implementations should be reentrant and thread-safe.


Method Summary
 R get(D input)
          Resolves an output where an input is given.
 

Method Detail

get

R get(D input)
Resolves an output where an input is given.

Specified by:
get in interface com.atlassian.util.concurrent.Function<D,R>
Parameters:
input - an object of type D.
Returns:
the output of type R.


Copyright © 2002-2012 Atlassian. All Rights Reserved.