org.snapscript.tree.annotation.AnnotationList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.annotation;
import java.util.List;
import org.snapscript.core.Module;
import org.snapscript.core.Scope;
import org.snapscript.core.Type;
import org.snapscript.core.Value;
import org.snapscript.core.annotation.Annotation;
import org.snapscript.core.function.Function;
import org.snapscript.core.function.Parameter;
import org.snapscript.core.property.Property;
public class AnnotationList {
private final AnnotationDeclaration[] list;
public AnnotationList(AnnotationDeclaration... list) {
this.list = list;
}
public void apply(Scope scope, Module module) throws Exception {
List annotations = module.getAnnotations();
for(AnnotationDeclaration entry : list) {
Value value = entry.evaluate(scope, null);
Annotation annotation = value.getValue();
annotations.add(annotation);
}
}
public void apply(Scope scope, Type type) throws Exception {
List annotations = type.getAnnotations();
for(AnnotationDeclaration entry : list) {
Value value = entry.evaluate(scope, null);
Annotation annotation = value.getValue();
annotations.add(annotation);
}
}
public void apply(Scope scope, Property property) throws Exception {
List annotations = property.getAnnotations();
for(AnnotationDeclaration entry : list) {
Value value = entry.evaluate(scope, null);
Annotation annotation = value.getValue();
annotations.add(annotation);
}
}
public void apply(Scope scope, Function function) throws Exception {
List annotations = function.getAnnotations();
for(AnnotationDeclaration entry : list) {
Value value = entry.evaluate(scope, null);
Annotation annotation = value.getValue();
annotations.add(annotation);
}
}
public void apply(Scope scope, Parameter parameter) throws Exception {
List annotations = parameter.getAnnotations();
for(AnnotationDeclaration entry : list) {
Value value = entry.evaluate(scope, null);
Annotation annotation = value.getValue();
annotations.add(annotation);
}
}
}