]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/core extension/org/eclipse/jdt/internal/corext/template/java/FieldResolver.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core extension / org / eclipse / jdt / internal / corext / template / java / FieldResolver.java
1 /*******************************************************************************
2  * Copyright (c) 2006, 2011 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.template.java;
12
13 import org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion.Variable;
14
15 /**
16  * Resolves a template variable to a field that is assignment-compatible
17  * with the variable instance' class parameter.
18  *
19  * @since 3.3
20  */
21 public class FieldResolver extends AbstractVariableResolver {
22
23         /**
24          * Default constructor for instantiation by the extension point.
25          */
26         public FieldResolver() {
27                 this("java.lang.Object"); //$NON-NLS-1$
28         }
29
30         FieldResolver(String defaultType) {
31                 super(defaultType);
32         }
33
34         /* (non-Javadoc)
35          * @see org.eclipse.jdt.internal.corext.template.java.AbstractVariableResolver#getVisibleVariables(java.lang.String, org.eclipse.jdt.internal.corext.template.java.JavaContext)
36          */
37         @Override
38         protected Variable[] getVisibleVariables(String type, JavaContext context) {
39                 return context.getFields(type);
40         }
41
42 }