| /******************************************************************************* |
| * Copyright (c) 2000, 2008 IBM Corporation and others. |
| * |
| * This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| * Fraunhofer FIRST - extended API and implementation |
| * Technical University Berlin - extended API and implementation |
| *******************************************************************************/ |
| package org.eclipse.jdt.internal.core; |
| |
| import org.eclipse.jdt.core.Signature; |
| import org.eclipse.jdt.internal.compiler.env.ISourceField; |
| import org.eclipse.objectteams.otdt.internal.core.compiler.util.TypeAnalyzer; |
| |
| /** |
| * Element info for IField elements. |
| */ |
| |
| public class SourceFieldElementInfo extends AnnotatableInfo implements ISourceField { |
| |
| /** |
| * The type name of this field. |
| */ |
| protected char[] typeName; |
| |
| /** |
| * The field's initializer string (if the field is a constant). |
| */ |
| protected char[] initializationSource; |
| |
| /* |
| * Returns the initialization source for this field. |
| * Returns null if the field is not a constant or if it has no initialization. |
| */ |
| @Override |
| public char[] getInitializationSource() { |
| return this.initializationSource; |
| } |
| /** |
| * Returns the type name of the field. |
| */ |
| @Override |
| public char[] getTypeName() { |
| return this.typeName; |
| } |
| /** |
| * Returns the type signature of the field. |
| * |
| * @see Signature |
| */ |
| protected String getTypeSignature() { |
| return Signature.createTypeSignature(this.typeName, false); |
| } |
| |
| /** |
| * Sets the type name of the field. |
| */ |
| protected void setTypeName(char[] typeName) { |
| //{ObjectTeams: treat _OT$base.Type: |
| //orig: this.typeName = typeName; |
| this.typeName = TypeAnalyzer.stripTypeName(typeName); |
| // SH} |
| } |
| } |