All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.konohiroaki.deepinitializer.swagger.SwaggerByteInitializer Maven / Gradle / Ivy

The newest version!
package io.github.konohiroaki.deepinitializer.swagger;

import java.lang.reflect.Field;

import io.github.konohiroaki.deepinitializer.BaseFieldInitializer;
import io.github.konohiroaki.deepinitializer.ByteTypeInitializer;
import io.swagger.annotations.ApiModelProperty;

public class SwaggerByteInitializer extends BaseFieldInitializer {

    @Override public Byte init(Field field) {
        ApiModelProperty property = field.getAnnotation(ApiModelProperty.class);
        if (property != null && !property.example().equals("")) {
            try {
                return Byte.valueOf(property.example());
            } catch (NumberFormatException ignored) {
            }
        }
        return new ByteTypeInitializer().init(Byte.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy