com.rhcloud.mongo.AnnotationScanner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongo-api Show documentation
Show all versions of mongo-api Show documentation
Lightweight set of APIs for MongoDB
The newest version!
package com.rhcloud.mongo;
import java.lang.annotation.Annotation;
import com.rhcloud.mongo.annotation.Document;
public class AnnotationScanner {
/**
* getCollectionName
*
* @param clazz
* @return T
*/
public static String getCollectionName(Class clazz) {
Annotation annotation = clazz.getAnnotation(Document.class);
if (annotation == null) {
throw new RuntimeException("Class must be annotated with the Document annotation");
}
Document document = (Document) annotation;;
return document.collectionName();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy