net.sf.eos
Interface Function<F,T>

Type Parameters:
F - the from type to handle in the function
T - the to type results from apply(F)
All Known Implementing Classes:
ConfigurationKeyIntrospectorFunction, DefaultValueConfigurationKeyFunction, Fahrenheit2Celsius, UserQueryParser

@Experimental
public interface Function<F,T>

A Function provides a transformation on an object and returns the resulting object. For example, a StringToIntegerFunction may implement Function<String,Integer> and transform integers in String format to Integer format.

The transformation on the source object does not necessarily result in an object of a different type. For example, a MeterToFeetFunction may implement Function<Integer, Integer>.

Implementations which may cause side effects upon evaluation are strongly encouraged to state this fact clearly in their API documentation.

Note: experimental - inspired by guice

Since:
0.1.0
Author:
Sascha Kohlmann

Method Summary
 T apply(F from)
          Applies the function to an object of type F, resulting in an object of type T.
 boolean equals(Object obj)
          Indicates whether some other object is equal to this Function.
 

Method Detail

apply

T apply(@Nullable
        F from)
Applies the function to an object of type F, resulting in an object of type T. Note that types F and T may or may not be the same.

Parameters:
from - The source object.
Returns:
The resulting object.

equals

boolean equals(Object obj)
Indicates whether some other object is equal to this Function. This method can return true only if the specified object is also a Function and, for every input object o, it returns exactly the same value. Thus, function1.equals(function2) implies that either function1.apply(o) and function1.apply(o) are both null, or function1.apply(o).equals(function2.apply(o)).

Note that it is always safe not to override Object.equals(Object).

Overrides:
equals in class Object


Copyright © 2008. All Rights Reserved.