當前位置: 首頁>>代碼示例>>Java>>正文


Java Link.Builder方法代碼示例

本文整理匯總了Java中javax.ws.rs.core.Link.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java Link.Builder方法的具體用法?Java Link.Builder怎麽用?Java Link.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.ws.rs.core.Link的用法示例。


在下文中一共展示了Link.Builder方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: unmarshal

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
public Link unmarshal(CustomJaxbLink p1) {

        Link.Builder builder = Link.fromUri(p1.getUri());
        for (Map.Entry<QName, Object> entry : p1.getParams().entrySet()) {
            builder.param(entry.getKey().getLocalPart(), entry.getValue().toString());
        }
        return builder.build();
    }
 
開發者ID:aruld,項目名稱:dropwizard-pagination,代碼行數:9,代碼來源:CustomJaxbAdapter.java

示例2: unmarshal

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
/**
 * Convert a {@link Link.JaxbLink} into a {@link Link}.
 *
 * @param v instance of type {@link Link.JaxbLink}.
 * @return mapped instance of type {@link Link.JaxbLink}
 */
@Override
public Link unmarshal(Link.JaxbLink v) {
    if (v == null) {
        return null;
    }

    Link.Builder lb = Link.fromUri(v.getUri());
    for (Map.Entry<QName, Object> e : v.getParams().entrySet()) {
        lb.param(e.getKey().getLocalPart(), e.getValue().toString());
    }
    return lb.build();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:19,代碼來源:LinkAdapter.java

示例3: testJAXRSTypes

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Test
public void testJAXRSTypes() {
    // MediaType#toString and Link.Builder call RuntimeDelegate
    final RuntimeDelegate delegateMock = mock(RuntimeDelegate.class);

    final RuntimeDelegate.HeaderDelegate<MediaType> headerDelegateMock = mock(RuntimeDelegate.HeaderDelegate.class);
    when(delegateMock.createHeaderDelegate(MediaType.class)).thenReturn(headerDelegateMock);
    final Link.Builder linkBuilderMock = mock(Link.Builder.class);
    when(delegateMock.createLinkBuilder()).thenReturn(linkBuilderMock);
    when(headerDelegateMock.toString(any())).thenReturn("application/json");
    when(linkBuilderMock.uri(anyString())).thenReturn(linkBuilderMock);
    when(linkBuilderMock.rel(anyString())).thenReturn(linkBuilderMock);
    when(linkBuilderMock.build()).thenReturn(new DummyLink("https://api.example.com/books/1", "self"),
            new DummyLink("https://api.example.com/books/123", "one", "two"));

    injectRuntimeDelegate(delegateMock);

    final String actual = Siren.createEntityBuilder()
            .setSubEntityType(MediaType.APPLICATION_JSON_TYPE)
            .setSubEntityHref(URI.create("https://api.example.com/books/1"))
            .addLink(Link.fromUri("https://api.example.com/books/1").rel("self").build())
            .addLink(Link.fromUri("https://api.example.com/books/123").rel("one two").build())
            .build().toString();
    final String expected = "{" +
            "\"type\":\"application/json\"," +
            "\"href\":\"https://api.example.com/books/1\"," +
            "\"links\":[{" +
            "\"rel\":[\"self\"]," +
            "\"href\":\"https://api.example.com/books/1\"" +
            "},{" +
            "\"rel\":[\"one\",\"two\"]," +
            "\"href\":\"https://api.example.com/books/123\"}]" +
            "}";

    assertThat(actual, is(expected));
}
 
開發者ID:sdaschner,項目名稱:siren4javaee,代碼行數:37,代碼來源:EntityBuilderTest.java

示例4: getLinkBuilder

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(String relation) {
  return rawResponse.getLinkBuilder(relation);
}
 
開發者ID:cerner,項目名稱:beadledom,代碼行數:5,代碼來源:BuiltGenericResponse.java

示例5: getLinkBuilder

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
public Link.Builder getLinkBuilder(String relation) {
    throw new UnsupportedOperationException();
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:4,代碼來源:TestResponse.java

示例6: PaginationHelper

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
public PaginationHelper(
    Supplier<UriBuilder> uriBuilderSupplier, Function<Link.Builder, Link> linkCreator) {

  this.uriBuilderSupplier = uriBuilderSupplier;
  this.linkCreator = linkCreator;
}
 
開發者ID:Nexmo,項目名稱:comms-router,代碼行數:7,代碼來源:PaginationHelper.java

示例7: getLinkBuilder

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(final String relation) {
    throw new UnsupportedOperationException();
}
 
開發者ID:minijax,項目名稱:minijax,代碼行數:5,代碼來源:MinijaxResponse.java

示例8: getLinkBuilder

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(String relation) {
    throw new UnsupportedOperationException("Not supported yet."); 
}
 
開發者ID:gopaycommunity,項目名稱:gopay-java-api,代碼行數:5,代碼來源:APIResponse.java

示例9: getLinkBuilder

import javax.ws.rs.core.Link; //導入方法依賴的package包/類
/**
 * Returns a link builder for the relation, {@code null} if not present.
 * @see Response#getLinkBuilder(String)
 */
Link.Builder getLinkBuilder(String relation);
 
開發者ID:cerner,項目名稱:beadledom,代碼行數:6,代碼來源:GenericResponse.java


注:本文中的javax.ws.rs.core.Link.Builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。