private <E extends AnnotationTargetSource<O, T>> E removeAnnotation(final E target, final List<?> modifiers, final Annotation<O> annotation) { for (Object object : modifiers) { if (object.equals(annotation.getInternal())) { modifiers.remove(object); break; } } return target; }
String literalValue = this.annotationSource.getLiteralValue(methodName);
@SuppressWarnings("unchecked") public static <T extends Annotation> T newInstance( final org.jboss.forge.roaster.model.Annotation<?> annotationSource) { try { Class<T> annotationClass = (Class<T>) Class.forName(annotationSource.getQualifiedName()); // TODO: test this not using annotationSource.getClass().getClassLoader() (will require integration test) return (T) java.lang.reflect.Proxy.newProxyInstance( annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationProxy<T>(annotationClass, annotationSource)); } catch (Exception e) { throw InspectorException.newException(e); } }
public static String getEntityTable(final JavaClass<?> entity) { String table = entity.getName(); if (entity.hasAnnotation(Entity.class)) { Annotation<?> a = entity.getAnnotation(Entity.class); if (!Strings.isNullOrEmpty(a.getStringValue("name"))) { table = a.getStringValue("name"); } else if (!Strings.isNullOrEmpty(a.getStringValue())) { table = a.getStringValue(); } } return table; }
description = sourceProp.getAnnotation(UriPath.class).getStringValue("description"); description = sourceProp.getAnnotation(UriParam.class).getStringValue("description"); description = sourceProp.getAnnotation(Metadata.class).getStringValue("description"); optionName = sourceProp.getAnnotation(UriParam.class).getStringValue("name"); } else { optionName = sourceProp.getAnnotation(UriPath.class).getStringValue("name");
private <E extends AnnotationTargetSource<O, T>> E removeAnnotation(final E target, final List<?> modifiers, final Annotation<O> annotation) { for (Object object : modifiers) { if (object.equals(annotation.getInternal())) { modifiers.remove(object); break; } } return target; }
@SuppressWarnings("unchecked") public static <T extends Annotation> T newInstance( final org.jboss.forge.roaster.model.Annotation<?> annotationSource) { try { Class<T> annotationClass = (Class<T>) Class.forName(annotationSource.getQualifiedName()); // TODO: test this not using annotationSource.getClass().getClassLoader() (will require integration test) return (T) java.lang.reflect.Proxy.newProxyInstance( annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationProxy<T>(annotationClass, annotationSource)); } catch (Exception e) { throw InspectorException.newException(e); } }
String literalValue = this.annotationSource.getLiteralValue(methodName);
@SuppressWarnings("unlikely-arg-type") private <E extends AnnotationTargetSource<O, T>> E removeAnnotation(final E target, final List<?> modifiers, final Annotation<O> annotation) { for (Object object : modifiers) { if (object.equals(annotation.getInternal())) { modifiers.remove(object); break; } } return target; }
if (element.getInternal().equals(expr)) arrayInit.expressions().remove(element.getInternal());
JavaClass<?> temp = Roaster.parse(JavaClass.class, stub); NormalAnnotation anno = (NormalAnnotation) temp.getAnnotations().get(0).getInternal(); MemberValuePair mvp = (MemberValuePair) anno.values().get(0);
if (element.getInternal().equals(expr)) arrayInit.expressions().remove(element.getInternal());
@Override public AnnotationSource<O> removeAnnotationValue(Annotation<O> element) { Assert.notNull(element, "Cannot remove null element"); if (isSingleValue()) { if (element.getInternal().equals(((SingleMemberAnnotation) annotation).getValue())) { convertTo(AnnotationType.MARKER); } else if (((SingleMemberAnnotation) annotation).getValue() instanceof ArrayInitializer) { final ArrayInitializer arrayInit = (ArrayInitializer) ((SingleMemberAnnotation) annotation).getValue(); if (arrayInit.expressions().remove(element.getInternal())) { if (arrayInit.expressions().isEmpty()) { convertTo(AnnotationType.MARKER); } else if (arrayInit.expressions().size() == 1) { ((SingleMemberAnnotation) annotation).setValue((Expression) ASTNode.copySubtree(ast, (ASTNode) arrayInit.expressions().get(0))); } } } return this; } return removeAnnotationValue(DEFAULT_VALUE, element); }
JavaClass<?> temp = Roaster.parse(JavaClass.class, stub); NormalAnnotation anno = (NormalAnnotation) temp.getAnnotations().get(0).getInternal(); MemberValuePair mvp = (MemberValuePair) anno.values().get(0);
JavaClass<?> temp = Roaster.parse(JavaClass.class, stub); NormalAnnotation anno = (NormalAnnotation) temp.getAnnotations().get(0).getInternal(); MemberValuePair mvp = (MemberValuePair) anno.values().get(0);
JavaClass<?> temp = Roaster.parse(JavaClass.class, stub); NormalAnnotation anno = (NormalAnnotation) temp.getAnnotations().get(0).getInternal(); MemberValuePair mvp = (MemberValuePair) anno.values().get(0);
@Override public AnnotationSource<O> removeAnnotationValue(Annotation<O> element) { Assert.notNull(element, "Cannot remove null element"); if (isSingleValue()) { if (element.getInternal().equals(((SingleMemberAnnotation) annotation).getValue())) { convertTo(AnnotationType.MARKER); } else if (((SingleMemberAnnotation) annotation).getValue() instanceof ArrayInitializer) { final ArrayInitializer arrayInit = (ArrayInitializer) ((SingleMemberAnnotation) annotation).getValue(); if (arrayInit.expressions().remove(element.getInternal())) { if (arrayInit.expressions().isEmpty()) { convertTo(AnnotationType.MARKER); } else if (arrayInit.expressions().size() == 1) { ((SingleMemberAnnotation) annotation).setValue((Expression) ASTNode.copySubtree(ast, (ASTNode) arrayInit.expressions().get(0))); } } } return this; } return removeAnnotationValue(DEFAULT_VALUE, element); }
JavaClass<?> temp = Roaster.parse(JavaClass.class, stub); NormalAnnotation anno = (NormalAnnotation) temp.getAnnotations().get(0).getInternal(); MemberValuePair mvp = (MemberValuePair) anno.values().get(0);