EclipseJDT Source Viewer

Home|eclipse_jdt/src/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java
1/*******************************************************************************
2 * Copyright (c) 2005, 2013 BEA Systems, Inc.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 *    tyeung@bea.com - initial API and implementation
13 *    IBM Corporation - implemented methods from IBinding
14 *    IBM Corporation - renamed from ResolvedDefaultValuePair to DefaultValuePairBinding
15 *    IBM Corporation - Fix for 328969
16 *******************************************************************************/
17package org.eclipse.jdt.core.dom;
18
19/**
20 * Member value pair which compose of default values.
21 */
22class DefaultValuePairBinding extends MemberValuePairBinding {
23
24    private org.eclipse.jdt.internal.compiler.lookup.MethodBinding method;
25
26    DefaultValuePairBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding bindingBindingResolver resolver) {
27        super(nullresolver);
28        this.method = binding;
29        this.value = MemberValuePairBinding.buildDOMValue(binding.getDefaultValue(), resolver);
30        if (binding.returnType != null && binding.returnType.isArrayType()) {
31            // wrap into an array
32            if (this.value == null) {
33                this.value = new Object[0];
34            } else if (!this.value.getClass().isArray()) {
35                this.value = new Object[] { this.value };
36            }
37        }
38    }
39
40    @Override
41    public IMethodBinding getMethodBinding() {
42        return this.bindingResolver.getMethodBinding(this.method);
43    }
44
45    @Override
46    public String getName() {
47        return new String(this.method.selector);
48    }
49
50    @Override
51    public Object getValue() {
52        return this.value;
53    }
54
55    @Override
56    public boolean isDefault() {
57        return true;
58    }
59
60    @Override
61    public boolean isDeprecated() {
62        return this.method.isDeprecated();
63    }
64}
65
MembersX
DefaultValuePairBinding:getMethodBinding
DefaultValuePairBinding:isDefault
DefaultValuePairBinding:getName
DefaultValuePairBinding:getValue
DefaultValuePairBinding:method
DefaultValuePairBinding:isDeprecated
DefaultValuePairBinding:DefaultValuePairBinding
Members
X