Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9efd7a0f4769be501ce1e6d9a7bb154317e6bcef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
 * Copyright (c) 2016 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.common.utility.internal.transformer.int_;

import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.transformer.IntTransformer;
import org.eclipse.jpt.common.utility.transformer.Transformer;

/**
 * Adapt an <code>int</code> transformer to the standard object transformer
 * interface.
 * 
 * @param <I> input: the type of the object passed to the transformer
 * 
 * @see IntTransformer
 */
public class IntObjectTransformerAdapter<I>
	implements Transformer<I, Integer>
{
	private final IntTransformer<? super I> intTransformer;

	public IntObjectTransformerAdapter(IntTransformer<? super I> intTransformer) {
		super();
		if (intTransformer == null) {
			throw new NullPointerException();
		}
		this.intTransformer = intTransformer;
	}

	public Integer transform(I input) {
		return Integer.valueOf(this.intTransformer.transform(input));
	}

	@Override
	public String toString() {
		return ObjectTools.toString(this, this.intTransformer);
	}
}

Back to the top