@Override public boolean isEarlyExitAnnotatedElement(Object element) { return (element instanceof JvmAnnotationTarget) && (this.annotations.findAnnotation((JvmAnnotationTarget) element, EarlyExit.class) != null); }
public JvmAnnotationReference findOrAddAnnotation(/* @NonNull */ JvmAnnotationTarget annotationTarget, /* @NonNull */ Notifier context, /* @NonNull */ Class<? extends Annotation> type) { JvmAnnotationReference result = findAnnotation(annotationTarget, type); if (result != null) return result; JvmAnnotationType annotationType = findAnnotationType(type, context); if (annotationType != null) { result = typesFactory.createJvmAnnotationReference(); result.setAnnotation(annotationType); return result; } return null; }
protected boolean isExtensionProvider(JvmAnnotationTarget annotatedElement) { // coding style to simplify debugging if (annotationLookup.findAnnotation(annotatedElement, Extension.class) != null) { return true; } return false; }
@Nullable public JvmAnnotationReference findOrAddAnnotation(@NonNull JvmAnnotationTarget annotationTarget, @NonNull Notifier context, @NonNull Class<? extends Annotation> type) { JvmAnnotationReference result = findAnnotation(annotationTarget, type); if (result != null) return result; JvmAnnotationType annotationType = findAnnotationType(type, context); if (annotationType != null) { result = typesFactory.createJvmAnnotationReference(); result.setAnnotation(annotationType); return result; } return null; }
protected boolean isExtension(JvmIdentifiableElement jvmIdentifiableElement){ if(jvmIdentifiableElement instanceof JvmAnnotationTarget){ return annotationLookup.findAnnotation((JvmAnnotationTarget) jvmIdentifiableElement, Extension.class) != null; } return false; }
@Override public boolean hasFormalParameterDefaultValue(int position) { final JvmFormalParameter parameter = this.parameters.get(position); return this.annotationFinder.findAnnotation(parameter, DefaultValue.class) != null; }
@Override public boolean isPureOperation(JvmOperation operation) { if (operation == null) { return false; } return this.annotations.findAnnotation(operation, Pure.class) != null || evaluatePureAnnotationAdapters(operation); }
/** Extract the string value of the given annotation, if it exists. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the value of the annotation, or {@code null} if no annotation or no * value. */ public String findStringValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findStringValue(reference); } return null; }
/** Extract the type values of the given annotation, if they exist. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the values of the annotation, never {@code null}. */ public List<JvmTypeReference> findTypeValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findTypeValues(reference); } return null; }
/** Extract the boolean values of the given annotation, if they exist. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the values of the annotation, never {@code null}. * @since 0.6 */ public List<Boolean> findBooleanValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findBooleanValues(reference); } return null; }
/** Extract the string values of the given annotation, if they exist. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the values of the annotation, never {@code null}. */ public List<String> findStringValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findStringValues(reference); } return null; }
/** Extract the integer values of the given annotation, if they exist. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the values of the annotation, never {@code null}. * @since 0.6 */ public List<Integer> findIntValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValues(reference); } return null; }
/** Extract the boolean value of the given annotation, if it exists. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the value of the annotation, or {@code null} if no annotation or no * value. * @since 0.6 */ public Boolean findBooleanValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findBooleanValue(reference); } return null; }
/** Extract the integer value of the given annotation, if it exists. * * @param op the annotated element. * @param annotationType the type of the annotation to consider * @return the value of the annotation, or {@code null} if no annotation or no * value. * @since 0.6 */ public Integer findIntValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValue(reference); } return null; }
public JvmAnnotationReference removeAnnotation(/* @NonNull */ JvmAnnotationTarget annotationTarget, /* @NonNull */ Class<? extends Annotation> type) { JvmAnnotationReference result = findAnnotation(annotationTarget, type); if (result != null) { annotationTarget.getAnnotations().remove(result); return result; } return null; }
/** Append the @FunctionalInterface to the given type if it is a functional interface according * to the Java 8 specification definition. * * @param type the type to update. */ protected void appendFunctionalInterfaceAnnotation(JvmGenericType type) { if (type != null && Utils.isFunctionalInterface(type, this.sarlSignatureProvider) && this.annotationFinder.findAnnotation(type, FunctionalInterface.class) == null) { addAnnotationSafe(type, FunctionalInterface.class); } }
@Nullable public JvmAnnotationReference removeAnnotation(@NonNull JvmAnnotationTarget annotationTarget, @NonNull Class<? extends Annotation> type) { JvmAnnotationReference result = findAnnotation(annotationTarget, type); if (result != null) { annotationTarget.getAnnotations().remove(result); return result; } return null; }
private boolean isEqualityTestValidField(JvmField field) { return !field.isStatic() && !Utils.isHiddenMember(field.getSimpleName()) && this.annotationFinder.findAnnotation(field, NoEqualityTestFunctionsGeneration.class) == null; }
/** Replies the type of the field that represents a SARL capacity buffer. * * @param resolvedTypes the resolver of types. * @param field the field. * @return the type, never {@code null}. */ protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) { // For capacity call redirection LightweightTypeReference fieldType = resolvedTypes.getActualType(field); final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0); fieldType = resolvedTypes.getActualType(ref.getType()); } return fieldType; }
/** Create the extension provider dedicated to the access to the used capacity functions. * * @param thisFeature the current object. * @param field the extension field. * @return the SARL capacity extension provider, or {@code null}. */ protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) { // For capacity call redirection if (thisFeature instanceof JvmDeclaredType) { final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName( field.getSimpleName()); final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName); if (callerOperation != null) { final XbaseFactory baseFactory = getXbaseFactory(); final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall(); extensionProvider.setFeature(callerOperation); final XFeatureCall thisAccess = baseFactory.createXFeatureCall(); thisAccess.setFeature(thisFeature); extensionProvider.setMemberCallTarget(thisAccess); return extensionProvider; } } } return null; }