Skip to main content
summaryrefslogtreecommitdiffstats
blob: ef519af1ba538d2bc1b22e7f7da46e8042f8b301 (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
53
54
55
56
57
58
59
60
61
/***********************************************************************
 * Copyright (c) 2008 by SAP AG, Walldorf. 
 * 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:
 *     SAP AG - initial API and implementation
 ***********************************************************************/
package org.eclipse.jst.jee.model.internal.common;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

import org.eclipse.jdt.core.IType;
import org.eclipse.jst.javaee.core.JavaEEObject;

/**
 * @author Kiril Mitov k.mitov@sap.com
 * 
 */
public class Result {

	private Collection<IType> dependedTypes;

	private Collection<JavaEEObject> modelObjects;

	private JavaEEObject mainObject;

	public Result() {
		dependedTypes = new HashSet<IType>();
		// most of the time there will be only one object in the model objects
		// list. Exceptions are made for results that will contain security
		// roles for example. This is way here the modelObjects collection is
		// ArrayList with size 1
		modelObjects = new ArrayList<JavaEEObject>(1);
	}

	public JavaEEObject getMainObject() {
		return mainObject;
	}

	public void setMainObject(JavaEEObject mainObject) {
		this.mainObject = mainObject;
		modelObjects.add(mainObject);
	}

	public Collection<JavaEEObject> getAdditional() {
		return modelObjects;
	}

	public Collection<IType> getDependedTypes() {
		return dependedTypes;
	}
	
	public boolean isEmpty() {
		return mainObject == null && getAdditional().isEmpty();
	}
}

Back to the top