本文整理匯總了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();
}
示例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();
}
示例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));
}
示例4: getLinkBuilder
import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(String relation) {
return rawResponse.getLinkBuilder(relation);
}
示例5: getLinkBuilder
import javax.ws.rs.core.Link; //導入方法依賴的package包/類
public Link.Builder getLinkBuilder(String relation) {
throw new UnsupportedOperationException();
}
示例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;
}
示例7: getLinkBuilder
import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(final String relation) {
throw new UnsupportedOperationException();
}
示例8: getLinkBuilder
import javax.ws.rs.core.Link; //導入方法依賴的package包/類
@Override
public Link.Builder getLinkBuilder(String relation) {
throw new UnsupportedOperationException("Not supported yet.");
}
示例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);