Tabnine Logo
MimeType$Facet
Code IndexAdd Tabnine to your IDE (free)

How to use
MimeType$Facet
in
com.nike.riposte.server.http.mimetype

Best Java code snippets using com.nike.riposte.server.http.mimetype.MimeType$Facet (Showing top 8 results out of 315)

origin: Nike-Inc/riposte

  @Override
  public String toString() {
    if (toStringCache == null) {
      toStringCache =
        type.getName() +
        "/" +
        subType.getFacet().getRegistrationTreeName().map(tree -> tree + ".").orElse("") +
        subType.getName() +
        subType.getSuffix().map(suffix -> "+" + suffix).orElse("") +
        parameters.entrySet().stream().map(entry -> ";" + entry.getKey() + "=" + entry.getValue())
             .collect(Collectors.joining());
    }
    return toStringCache;
  }
}
origin: Nike-Inc/riposte

@Test
public void test_facet_lookup_works () {
  final Optional<Facet> vendorFacet = Facet.forRegistrationTreeName("vnd");
  assertThat(vendorFacet).isNotNull();
  assertThat(vendorFacet.isPresent()).isTrue();
  assertThat(vendorFacet.get()).isNotNull();
  assertThat(vendorFacet.get()).isEqualTo(Facet.VENDOR);
}
origin: Nike-Inc/riposte

Facet givenFacet = Facet.forRegistrationTreeName(facetString).orElse(Facet.STANDARD);
Optional<String> givenSuffix =  (suffixString == null || suffixString.isEmpty()) ?  Optional.empty() : Optional.of(suffixString);
origin: Nike-Inc/riposte

  @Override
  public String toString() {
    if (toStringCache == null) {
      toStringCache = subType.getFacet().getRegistrationTreeName().map(tree -> tree + ".").orElse("") +
              subType.getName() +
              subType.getSuffix().map(suffix -> "+" + suffix).orElse("");
    }
    return toStringCache;
  }
}
origin: Nike-Inc/riposte

@Test
public void test_facet_lookup_with_null_name_fails () {
  final Optional<Facet> vendorFacet = Facet.forRegistrationTreeName(null);
  assertThat(vendorFacet).isNotNull();
  assertThat(vendorFacet.isPresent()).isFalse();
}
origin: Nike-Inc/riposte

private MediaRangeSubType mrSubType(String typeString) {
  if (MediaRange.WILDCARD_SUBTYPE.toString().equals(typeString))
    return MediaRange.WILDCARD_SUBTYPE;
  MimeType.Facet facet = MimeType.Facet.STANDARD;
  if (typeString.startsWith(MimeType.Facet.VENDOR.getRegistrationTreeName().get()))
    facet = MimeType.Facet.VENDOR;
  Optional<String> suffix = Optional.empty();
  if (typeString.endsWith("+json"))
    suffix = Optional.of("json");
  return new MimeMediaRangeSubType(MimeType.SubType.of(facet, typeString, suffix));
}
origin: Nike-Inc/riposte

  @Test
  public void test_facet_lookup_with_unknown_name_fails () {
    final Optional<Facet> vendorFacet = Facet.forRegistrationTreeName("tacos");
    assertThat(vendorFacet).isNotNull();
    assertThat(vendorFacet.isPresent()).isFalse();
  }
}
origin: Nike-Inc/riposte

  @Override
  public int hashCode() {
    int result = getFacet().hashCode();
    result = 122949829 * result + getName().hashCode();
    result = 122949829 * result + getSuffix().hashCode();
    return result;
  }
}
com.nike.riposte.server.http.mimetypeMimeType$Facet

Javadoc

Models the registration tree names (facets) defined by RFC-6838

Most used methods

  • getRegistrationTreeName
    The registration tree name for this Facet, if one exits.
  • forRegistrationTreeName
    Attempts to find a a Facet by its registrationTreeName.
  • hashCode

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JTable (javax.swing)
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now