com.fasterxml.jackson.annotation.JsonClassDescription Java Examples

The following examples show how to use com.fasterxml.jackson.annotation.JsonClassDescription. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Jackson2Parser.java    From typescript-generator with MIT License 5 votes vote down vote up
@Override
protected DeclarationModel parseClass(SourceType<Class<?>> sourceClass) {
    final List<String> classComments = getComments(sourceClass.type.getAnnotation(JsonClassDescription.class));
    if (sourceClass.type.isEnum()) {
        return parseEnumOrObjectEnum(sourceClass, classComments);
    } else {
        return parseBean(sourceClass, classComments);
    }
}
 
Example #2
Source File: Jackson2Parser.java    From typescript-generator with MIT License 4 votes vote down vote up
private static List<String> getComments(JsonClassDescription classDescriptionAnnotation) {
    final String propertyDescriptionValue = classDescriptionAnnotation != null ? classDescriptionAnnotation.value() : null;
    final List<String> classComments = Utils.splitMultiline(propertyDescriptionValue, false);
    return classComments;
}
 
Example #3
Source File: JacksonModule.java    From jsonschema-generator with Apache License 2.0 3 votes vote down vote up
/**
 * Determine the given type's associated "description" via the following annotation.
 * <ul>
 * <li>{@link JsonClassDescription} annotation on the targeted type's class</li>
 * </ul>
 *
 * @param scope scope for which to collect an available description
 * @return successfully looked-up description (or {@code null})
 */
protected String resolveDescriptionForType(TypeScope scope) {
    Class<?> rawType = scope.getType().getErasedType();
    JsonClassDescription classAnnotation = rawType.getAnnotation(JsonClassDescription.class);
    if (classAnnotation != null) {
        return classAnnotation.value();
    }
    return null;
}