本文整理汇总了Java中org.eclipse.jdt.core.IMemberValuePair类的典型用法代码示例。如果您正苦于以下问题:Java IMemberValuePair类的具体用法?Java IMemberValuePair怎么用?Java IMemberValuePair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMemberValuePair类属于org.eclipse.jdt.core包,在下文中一共展示了IMemberValuePair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSilencedGeneratedAnnotation
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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.IMemberValuePair; //导入依赖的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.IMemberValuePair; //导入依赖的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.IMemberValuePair; //导入依赖的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.IMemberValuePair; //导入依赖的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: appendAnnotationValue
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的package包/类
private void appendAnnotationValue(Object value, int valueKind) throws JavaModelException {
if (value instanceof Object[]) {
Object[] objects = (Object[]) value;
fBuffer.append('{');
for (Object object : objects) {
appendAnnotationValue(object, valueKind);
fBuffer.append(',');
}
if (objects.length > 0) fBuffer.deleteCharAt(fBuffer.length() - 1);
fBuffer.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_ANNOTATION:
appendAnnotation((IAnnotation) value);
break;
case IMemberValuePair.K_STRING:
fBuffer.append('"').append(value).append('"');
break;
default:
fBuffer.append(value);
break;
}
}
}
示例7: appendAnnotationLabel
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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(')');
}
示例8: getNegativeAnnotationMemberValue
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的package包/类
public static Object getNegativeAnnotationMemberValue(
MemberValuePair memberValuePair, Constant constant) {
if (constant == null) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
switch (constant.typeID()) {
case TypeIds.T_int:
memberValuePair.valueKind = IMemberValuePair.K_INT;
return new Integer(constant.intValue() * -1);
case TypeIds.T_float:
memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
return new Float(constant.floatValue() * -1.0f);
case TypeIds.T_double:
memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
return new Double(constant.doubleValue() * -1.0);
case TypeIds.T_long:
memberValuePair.valueKind = IMemberValuePair.K_LONG;
return new Long(constant.longValue() * -1L);
default:
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
示例9: appendAnnotationLabel
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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(')');
}
示例10: sameAnnotationStringValue
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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;
}
示例11: appendAnnotation
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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');
}
示例12: appendAnnotationLabel
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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(')');
}
示例13: getAnnotationMemberValue
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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;
}
示例14: matches
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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;
}
示例15: getAliasAnnotationValue
import org.eclipse.jdt.core.IMemberValuePair; //导入依赖的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;
}