Skip to main content
summaryrefslogtreecommitdiffstats
blob: 69304437b0ccb4535d709414f623f3430f48e788 (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
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2013 IBM Corporation and others.
 * 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.e4.tools.event.spy.internal.model;

import org.eclipse.e4.tools.event.spy.internal.util.MultilineFormatter;

public class Parameter implements IEventItem {
	private static final String EMPTY_VALUE = "";

	private final String name;
	private final Object value;

	private String formattedValue;

	public Parameter(String name, Object value) {
		this.name = name;
		this.value = value;
	}

	@Override
	public String getName() {
		return name;
	}

	public Object getValue() {
		return value;
	}

	@Override
	public String getParam1() {
		if (value == null) {
			return SpecialValue.Null.toString();
		}
		if (formattedValue == null) {
			formattedValue = MultilineFormatter.format(value.toString(), 70);
		}
		return formattedValue;
	}

	@Override
	public String getParam2() {
		return EMPTY_VALUE;
	}
}

Back to the top