/******************************************************************************* * Copyright (c) 2000, 2008 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 net.sourceforge.phpdt.core; /** * Represents a member-value pair of an annotation. * The {@link #getValue() value} is represented by an {@link Object}. To get the exact * type of this object, use its {@link #getValueKind() value kind}. If this value is an array, * {@link #getValue()} returns an instance of {@link Object}[] and the value kind returns * the kind of the elements in this array. *
* This interface is not intended to be implemented or extended by clients. *
* * @since 3.4 */ public interface IMemberValuePair { /** * Constant indicating that the value kind is anint
represented by
* an instance of {@link Integer}.
*/
int K_INT = 1;
/**
* Constant indicating that the value kind is a byte
represented by
* an instance of {@link Byte}.
*/
int K_BYTE = 2;
/**
* Constant indicating that the value kind is a short
represented by
* an instance of {@link Short}.
*/
int K_SHORT = 3;
/**
* Constant indicating that the value kind is a char
represented by
* an instance of {@link Character}.
*/
int K_CHAR = 4;
/**
* Constant indicating that the value kind is a float
represented by
* an instance of {@link Float}.
*/
int K_FLOAT = 5;
/**
* Constant indicating that the value kind is a double
represented by
* an instance of {@link Double}.
*/
int K_DOUBLE = 6;
/**
* Constant indicating that the value kind is a long
represented by
* an instance of {@link Long}.
*/
int K_LONG = 7;
/**
* Constant indicating that the value kind is a boolean
represented by
* an instance of {@link Boolean}.
*/
int K_BOOLEAN = 8;
/**
* Constant indicating that the value kind is a {@link String} represented by
* the corresponding {@link String}.
*/
int K_STRING = 9;
/**
* Constant indicating that the value kind is an annotation represented by
* an instance of {@link IAnnotation}.
*/
int K_ANNOTATION = 10;
/**
* Constant indicating that the value kind is a {@link Class} represented by
* the name of the class (i.e. a {@link String}. If the member-value pair is coming from
* a compilation unit, this is either a simple name (e.g. for MyType.class
,
* the name is "MyType"), or a qualified name (e.g. for x.y.MyType.MyNestedType.class
,
* the name is "x.y.MyType.MyNestedType"). If the member-value pair is coming from a class file, this is
* always a fully qualified name.
* * Note that one can use {@link IType#resolveType(String)} and e.g. * {@link IJavaProject#findType(String, String, org.eclipse.core.runtime.IProgressMonitor)} * to find the corresponding {@link IType}. *
*/ int K_CLASS = 11; /** * Constant indicating that the value is a qualified name represented by a * {@link String}. The qualified name refers to an enum constant or another * compile-time constant if the code is correct (e.g. "MyEnum.FIRST"). */ int K_QUALIFIED_NAME = 12; /** * Constant indicating that the value is a simple name represented by a * {@link String}. The simple name refers to an enum constant or another * compile-time constant if the code is correct (e.g. "FIRST" when there is * a static import for "MyEnum.FIRST"). */ int K_SIMPLE_NAME = 13; /** * Constant indicating that the value kind is unknown at this stage. The value is unknown in the * following cases: *@MyAnnot(1 + 2.3)
the kind of the expression "1 + 2.3" is
* unknown@MyAnnot({})
@MyAnnot({3.4, 1 + 2.3})
,
* the kind of the second element "1 + 2.3" is unknown.@MyAnnot(1, 2.3, "abc")
null
, or an
* array containing {@link Object}s and/or null
s for unknown elements.
*/
int K_UNKNOWN = 14;
/**
* Returns the member's name of this member-value pair.
*
* @return the member's name of this member-value pair.
*/
String getMemberName();
/**
* Returns the value of this member-value pair. The type of this value
* is function of this member-value pair's {@link #getValueKind() value kind}. It is an
* instance of {@link Object}[] if the value is an array.
*
* If the value kind is {@link #K_UNKNOWN} and the value is not an array, then the
* value is null
.
* If the value kind is {@link #K_UNKNOWN} and the value is an array, then the
* value is an array containing {@link Object}s and/or null
s for
* unknown elements.
* See {@link #K_UNKNOWN} for more details.
*