Java Code Examples for org.eclipse.microprofile.openapi.models.info.Contact

The following examples show how to use org.eclipse.microprofile.openapi.models.info.Contact. These examples are extracted from open source projects. 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 Project: smallrye-open-api   Source File: ContactReader.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Reads an Contact annotation.
 *
 * @param annotationValue the {@literal @}Contact annotation
 * @return Contact model
 */
public static Contact readContact(final AnnotationValue annotationValue) {
    if (annotationValue == null) {
        return null;
    }
    IoLogging.log.singleAnnotation("@Contact");
    AnnotationInstance nested = annotationValue.asNested();
    Contact contact = new ContactImpl();
    contact.setName(JandexUtil.stringValue(nested, ContactConstant.PROP_NAME));
    contact.setUrl(JandexUtil.stringValue(nested, ContactConstant.PROP_URL));
    contact.setEmail(JandexUtil.stringValue(nested, ContactConstant.PROP_EMAIL));
    return contact;
}
 
Example 2
Source Project: smallrye-open-api   Source File: ContactReader.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Reads an {@link Contact} OpenAPI node.
 *
 * @param node the json node
 * @return Contact model
 */
public static Contact readContact(final JsonNode node) {
    if (node == null) {
        return null;
    }
    IoLogging.log.singleJsonNode("Contact");
    Contact contact = new ContactImpl();
    contact.setName(JsonUtil.stringProperty(node, ContactConstant.PROP_NAME));
    contact.setUrl(JsonUtil.stringProperty(node, ContactConstant.PROP_URL));
    contact.setEmail(JsonUtil.stringProperty(node, ContactConstant.PROP_EMAIL));
    ExtensionReader.readExtensions(node, contact);
    return contact;
}
 
Example 3
Source Project: smallrye-open-api   Source File: ContactWriter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Writes the {@link Contact} model to the JSON tree.
 * 
 * @param parent the parent json node
 * @param model the Contact model
 */
public static void writeContact(ObjectNode parent, Contact model) {
    if (model == null) {
        return;
    }
    ObjectNode node = JsonUtil.objectNode();
    parent.set(InfoConstant.PROP_CONTACT, node);

    JsonUtil.stringProperty(node, ContactConstant.PROP_NAME, model.getName());
    JsonUtil.stringProperty(node, ContactConstant.PROP_URL, model.getUrl());
    JsonUtil.stringProperty(node, ContactConstant.PROP_EMAIL, model.getEmail());
    ExtensionWriter.writeExtensions(node, model);
}
 
Example 4
/**
 * Test method for
 * {@link OASFactoryResolverImpl#createObject(java.lang.Class)}.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testCreateObject_All() {
    Class modelClasses[] = { APIResponse.class, APIResponses.class, Callback.class, Components.class,
            Contact.class, Content.class, Discriminator.class, Encoding.class, Example.class,
            ExternalDocumentation.class, Header.class, Info.class, License.class, Link.class, MediaType.class,
            OAuthFlow.class, OAuthFlows.class, OpenAPI.class, Operation.class, Parameter.class, PathItem.class,
            Paths.class, RequestBody.class, Schema.class, SecurityRequirement.class,
            SecurityScheme.class, Server.class, ServerVariable.class, Tag.class, XML.class };
    for (Class modelClass : modelClasses) {
        Constructible object = OASFactory.createObject(modelClass);
        Assert.assertNotNull(object);
    }
}
 
Example 5
Source Project: smallrye-open-api   Source File: InfoImpl.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.microprofile.openapi.models.info.Info#getContact()
 */
@Override
public Contact getContact() {
    return this.contact;
}
 
Example 6
Source Project: smallrye-open-api   Source File: InfoImpl.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.microprofile.openapi.models.info.Info#setContact(org.eclipse.microprofile.openapi.models.info.Contact)
 */
@Override
public void setContact(Contact contact) {
    this.contact = contact;
}
 
Example 7
@Test
public void contactTest() {
    processConstructible(Contact.class);
}
 
Example 8
Source Project: microprofile-open-api   Source File: OASFactory.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * This method creates a new {@link org.eclipse.microprofile.openapi.models.info.Contact} instance.
 *
 * @return a new Contact instance
 */
public static Contact createContact() {
    return createObject(Contact.class);
}