本文整理汇总了Java中org.eclipse.jdt.core.IAnnotation.getMemberValuePairs方法的典型用法代码示例。如果您正苦于以下问题:Java IAnnotation.getMemberValuePairs方法的具体用法?Java IAnnotation.getMemberValuePairs怎么用?Java IAnnotation.getMemberValuePairs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IAnnotation
的用法示例。
在下文中一共展示了IAnnotation.getMemberValuePairs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSilencedGeneratedAnnotation
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private static boolean isSilencedGeneratedAnnotation(IAnnotation annotation) throws JavaModelException {
if ("javax.annotation.Generated".equals(annotation.getElementName())) {
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair m : memberValuePairs) {
if ("value".equals(m.getMemberName()) && IMemberValuePair.K_STRING == m.getValueKind()) {
if (m.getValue() instanceof String) {
return SILENCED_CODEGENS.contains(m.getValue());
} else if (m.getValue() instanceof Object[]) {
for (Object val : (Object[]) m.getValue()) {
if (SILENCED_CODEGENS.contains(val)) {
return true;
}
}
}
}
}
}
return false;
}
示例2: isSilencedGeneratedAnnotation
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private static boolean isSilencedGeneratedAnnotation(IAnnotation annotation) throws JavaModelException {
if ("javax.annotation.Generated".equals(annotation.getElementName())) {
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair m : memberValuePairs) {
if ("value".equals(m.getMemberName())
&& IMemberValuePair.K_STRING == m.getValueKind()) {
if (m.getValue() instanceof String) {
return SILENCED_CODEGENS.contains(m.getValue());
} else if (m.getValue() instanceof Object[]) {
for (Object val : (Object[])m.getValue()) {
if(SILENCED_CODEGENS.contains(val)) {
return true;
}
}
}
}
}
}
return false;
}
示例3: appendAnnotationLabel
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
fBuilder.append('@');
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
if (memberValuePairs.length == 0) {
return;
}
fBuilder.append('(');
for (int i= 0; i < memberValuePairs.length; i++) {
if (i > 0) {
fBuilder.append(JavaElementLabels.COMMA_STRING);
}
IMemberValuePair memberValuePair= memberValuePairs[i];
fBuilder.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
fBuilder.append('=');
appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
}
fBuilder.append(')');
}
示例4: appendAnnotationLabel
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags, StringBuilder builder)
throws JavaModelException {
builder.append('@');
appendTypeSignatureLabel(
annotation,
Signature.createTypeSignature(annotation.getElementName(), false),
flags,
builder);
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
if (memberValuePairs.length == 0) return;
builder.append('(');
for (int i = 0; i < memberValuePairs.length; i++) {
if (i > 0) builder.append(JavaElementLabels.COMMA_STRING);
IMemberValuePair memberValuePair = memberValuePairs[i];
builder.append(
getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
builder.append('=');
appendAnnotationValue(
annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags, builder);
}
builder.append(')');
}
示例5: appendAnnotation
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
String name = annotation.getElementName();
if (!fStubInvisible && name.startsWith("sun.")) // $NON-NLS-1$
return; // skip Sun-internal annotations
fBuffer.append('@');
fBuffer.append(name);
fBuffer.append('(');
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair pair : memberValuePairs) {
fBuffer.append(pair.getMemberName());
fBuffer.append('=');
appendAnnotationValue(pair.getValue(), pair.getValueKind());
fBuffer.append(',');
}
if (memberValuePairs.length > 0) fBuffer.deleteCharAt(fBuffer.length() - 1);
fBuffer.append(')').append('\n');
}
示例6: appendAnnotationLabel
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
fBuffer.append('@');
appendTypeSignatureLabel(
annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
if (memberValuePairs.length == 0) return;
fBuffer.append('(');
for (int i = 0; i < memberValuePairs.length; i++) {
if (i > 0) fBuffer.append(JavaElementLabels.COMMA_STRING);
IMemberValuePair memberValuePair = memberValuePairs[i];
fBuffer.append(
getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
fBuffer.append('=');
appendAnnotationValue(
annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
}
fBuffer.append(')');
}
示例7: appendAnnotationLabel
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
fBuffer.append('@');
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
if (memberValuePairs.length == 0)
return;
fBuffer.append('(');
for (int i= 0; i < memberValuePairs.length; i++) {
if (i > 0)
fBuffer.append(COMMA_STRING);
IMemberValuePair memberValuePair= memberValuePairs[i];
fBuffer.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
fBuffer.append('=');
appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
}
fBuffer.append(')');
}
示例8: sameAnnotationStringValue
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private boolean sameAnnotationStringValue(IAnnotation annotation,
String actionValue) throws JavaModelException {
boolean res = false;
if (annotation.exists()) {
IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair valuePair : valuePairs) {
res = valuePair.getValueKind() == IMemberValuePair.K_STRING
&& valuePair.getValue() instanceof String
&& ANNOTATION_VALUE.equals(valuePair.getMemberName())
&& actionValue.equals(valuePair.getValue());
if (res) {
break;
}
}
}
return res;
}
示例9: appendAnnotation
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
String name= annotation.getElementName();
if (!fStubInvisible && name.startsWith("sun.")) //$NON-NLS-1$
return; // skip Sun-internal annotations
fBuffer.append('@');
fBuffer.append(name);
fBuffer.append('(');
IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
for (IMemberValuePair pair : memberValuePairs) {
fBuffer.append(pair.getMemberName());
fBuffer.append('=');
appendAnnotationValue(pair.getValue(), pair.getValueKind());
fBuffer.append(',');
}
if (memberValuePairs.length > 0)
fBuffer.deleteCharAt(fBuffer.length() - 1);
fBuffer.append(')').append('\n');
}
示例10: appendAnnotationLabel
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
fBuffer.append('@');
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
if (memberValuePairs.length == 0)
return;
fBuffer.append('(');
for (int i= 0; i < memberValuePairs.length; i++) {
if (i > 0)
fBuffer.append(JavaElementLabels.COMMA_STRING);
IMemberValuePair memberValuePair= memberValuePairs[i];
fBuffer.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
fBuffer.append('=');
appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
}
fBuffer.append(')');
}
示例11: getAnnotationMemberValue
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public static String getAnnotationMemberValue(IAnnotation annotation, String memberName)
{
try
{
IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair valuePair : valuePairs)
{
if (memberName.equals(valuePair.getMemberName()))
{
return (String)valuePair.getValue();
}
}
}
catch (JavaModelException e)
{
Activator.log(Status.ERROR, "Failed to get member value pairs.", e);
}
return null;
}
示例12: matches
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
@Override
public boolean matches(IMethod method) throws JavaModelException
{
for (IAnnotation annotation : method.getAnnotations())
{
String annotationName = annotation.getElementName();
if (MybatipseConstants.ANNOTATION_RESULTS.equals(annotationName))
{
IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
for (IMemberValuePair valuePair : valuePairs)
{
if ("id".equals(valuePair.getMemberName()))
{
String resultsId = (String)valuePair.getValue();
return nameMatches(resultsId, matchString, exactMatch);
}
}
}
}
return false;
}
示例13: getAliasAnnotationValue
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private String getAliasAnnotationValue(IType foundType) throws JavaModelException
{
String alias = null;
IAnnotation[] annotations = foundType.getAnnotations();
for (IAnnotation annotation : annotations)
{
if ("Alias".equals(annotation.getElementName()))
{
IMemberValuePair[] params = annotation.getMemberValuePairs();
if (params.length > 0)
{
alias = (String)params[0].getValue();
}
}
}
return alias;
}
示例14: appendAnnotation
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
fBuffer.append('@');
fBuffer.append(annotation.getElementName());
fBuffer.append('(');
IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
for (IMemberValuePair pair : memberValuePairs) {
fBuffer.append(pair.getMemberName());
fBuffer.append('=');
appendAnnotationValue(pair.getValue(), pair.getValueKind());
fBuffer.append(',');
}
if (memberValuePairs.length > 0)
fBuffer.deleteCharAt(fBuffer.length() - 1);
fBuffer.append(')').append('\n');
}
示例15: createComponentFromInjection
import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private Component createComponentFromInjection(IType type, final IField field, IAnnotation annotation) throws JavaModelException
{
Component component = new Component();
component.setSpecification(this);
component.setName(field.getElementName());
component.setNameRange(field.getNameRange());
component.setJavadocValue(new LazyValue<String>()
{
@Override
protected String eval() throws CoreException
{
return JavadocContentAccess2.getHTMLContent(field, true);
}
});
for (IMemberValuePair pair : annotation.getMemberValuePairs())
{
component.setId(String.valueOf(pair.getValue()));
}
setComponentDefaults(type, field, component);
return component;
}