use of com.yahoo.elide.annotation.ApiVersion in project elide by yahoo.
the class NamespacePackageTest method testAnnotations.
@Test
void testAnnotations() throws Exception {
NamespaceConfig testNamespace = NamespaceConfig.builder().description("A test Namespace").name("Test").build();
NamespacePackage namespace = new NamespacePackage(testNamespace);
ReadPermission readPermission = namespace.getDeclaredAnnotation(ReadPermission.class);
assertEquals("Prefab.Role.All", readPermission.expression());
Include meta = namespace.getDeclaredAnnotation(Include.class);
assertEquals("A test Namespace", meta.description());
assertNull(meta.friendlyName());
ApiVersion apiVersion = namespace.getDeclaredAnnotation(ApiVersion.class);
assertEquals("", apiVersion.version());
}
use of com.yahoo.elide.annotation.ApiVersion in project elide by yahoo.
the class NamespacePackage method buildAnnotations.
private static Map<Class<? extends Annotation>, Annotation> buildAnnotations(NamespaceConfig namespace) {
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<>();
annotations.put(ReadPermission.class, new ReadPermission() {
@Override
public Class<? extends Annotation> annotationType() {
return ReadPermission.class;
}
@Override
public String expression() {
return namespace.getReadAccess();
}
});
annotations.put(Include.class, new Include() {
@Override
public Class<? extends Annotation> annotationType() {
return Include.class;
}
@Override
public boolean rootLevel() {
return true;
}
@Override
public String description() {
return namespace.getDescription();
}
@Override
public String friendlyName() {
return namespace.getFriendlyName();
}
@Override
public String name() {
return namespace.getName();
}
});
annotations.put(ApiVersion.class, new ApiVersion() {
@Override
public String version() {
return namespace.getApiVersion();
}
@Override
public Class<? extends Annotation> annotationType() {
return ApiVersion.class;
}
});
return annotations;
}
Aggregations