/** * Register a media type as a known type that can later be retrieved using * {@link #valueOf(String)}. If the type already exists, the existing type * is returned, otherwise a new instance is created. * * @param name * The name. * @param description * The description. * @return The registered media type */ public static synchronized MediaType register(String name, String description) { if (!getTypes().containsKey(name)) { final MediaType type = new MediaType(name, description); getTypes().put(name, type); } return getTypes().get(name); }
/** * Register a media type as a known type that can later be retrieved using * {@link #valueOf(String)}. If the type already exists, the existing type * is returned, otherwise a new instance is created. * * @param name * The name. * @param description * The description. * @return The registered media type */ public static synchronized MediaType register(String name, String description) { if (!getTypes().containsKey(name)) { final MediaType type = new MediaType(name, description); getTypes().put(name, type); } return getTypes().get(name); }
/** * Register a media type as a known type that can later be retrieved using * {@link #valueOf(String)}. If the type already exists, the existing type * is returned, otherwise a new instance is created. * * @param name * The name. * @param description * The description. * @return The registered media type */ public static synchronized MediaType register(String name, String description) { if (!getTypes().containsKey(name)) { final MediaType type = new MediaType(name, description); getTypes().put(name, type); } return getTypes().get(name); }
/** * Returns the media type associated to a name. If an existing constant * exists then it is returned, otherwise a new instance is created. * * @param name * The name. * @return The associated media type. */ public static MediaType valueOf(String name) { MediaType result = null; if ((name != null) && !name.equals("")) { result = getTypes().get(name); if (result == null) { result = new MediaType(name); } } return result; }
/** * Returns the media type associated to a name. If an existing constant * exists then it is returned, otherwise a new instance is created. * * @param name * The name. * @return The associated media type. */ public static MediaType valueOf(String name) { MediaType result = null; if ((name != null) && !name.equals("")) { result = getTypes().get(name); if (result == null) { result = new MediaType(name); } } return result; }
/** * Returns the media type associated to a name. If an existing constant * exists then it is returned, otherwise a new instance is created. * * @param name * The name. * @return The associated media type. */ public static MediaType valueOf(String name) { MediaType result = null; if (!StringUtils.isNullOrEmpty(name)) { result = getTypes().get(name); if (result == null) { result = new MediaType(name); } } return result; }