Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import javax.xml.bind.annotation.XmlRootElement;

import java.util.Optional;

public class Main {
    private static <T> String elementNameFrom(final Class<T> clazz) {
        return Optional.ofNullable(clazz.getAnnotation(XmlRootElement.class)).map(XmlRootElement::name)
                .orElseGet(clazz::getSimpleName);
    }
}