![JAR search and dependency download from the Maven repository](/logo.png)
it.uniroma2.art.coda.pearl.model.AnnotationDefinition_old Maven / Gradle / Ivy
package it.uniroma2.art.coda.pearl.model;
import java.util.ArrayList;
import java.util.List;
public class AnnotationDefinition {
private String name;
private List listMetaAnnotations;
public AnnotationDefinition(){
this.setName(null);
this.setListMetaAnnotations(new ArrayList());
}
public AnnotationDefinition(String name, List listMetaAnnotations){
this.setName(name);
this.setListMetaAnnotations(listMetaAnnotations);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean hasListMetaAnnotations(){
if(listMetaAnnotations == null)
return false;
if(listMetaAnnotations.isEmpty())
return false;
return true;
}
public List getListMetaAnnotations() {
return listMetaAnnotations;
}
public void setListMetaAnnotations(List listMetaAnnotations) {
this.listMetaAnnotations = listMetaAnnotations;
}
public boolean verifyTargetCompatibility(String desiredCompatibility) {
//iterate over all the metaAnnotation, looking for the @Target one
for(MetaAnnotation metaAnnotation : listMetaAnnotations){
if(metaAnnotation.getName().equals("@Target")){
//the right meta annotation has been found, now check it
return metaAnnotation.verifyTargetCompatibility(desiredCompatibility);
}
}
//if the annotation definition does not have the @Target meta annotation, then it has no
// target restriction, it can be applied to any element
return true;
}
/**
* Verify if an annotation has the metaAnnotation @Duplicate.
*
* @param annotation
* @return
*/
public boolean hasRetention() {
for(MetaAnnotation metaAnnotation : listMetaAnnotations){
if(metaAnnotation.getName().equals("@Retention")){
return true;
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy