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


Java EmbeddedWrapper類代碼示例

本文整理匯總了Java中org.springframework.hateoas.core.EmbeddedWrapper的典型用法代碼示例。如果您正苦於以下問題:Java EmbeddedWrapper類的具體用法?Java EmbeddedWrapper怎麽用?Java EmbeddedWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getDefaultedRelFor

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
private String getDefaultedRelFor(EmbeddedWrapper wrapper, boolean forCollection) {

		String valueRel = wrapper.getRel();

		if (StringUtils.hasText(valueRel)) {
			return valueRel;
		}

		if (provider == null) {
			return DEFAULT_REL;
		}

		Class<?> type = wrapper.getRelTargetType();

		if (type == null) {
			throw new IllegalStateException(String.format(INVALID_EMBEDDED_WRAPPER, wrapper));
		}

		String rel = forCollection ? provider.getCollectionResourceRelFor(type) : provider.getItemResourceRelFor(type);

		if (curieProvider != null) {
			rel = curieProvider.getNamespacedRelFor(rel);
		}

		return rel == null ? DEFAULT_REL : rel;
	}
 
開發者ID:mockitoo,項目名稱:spring-data-rest-android,代碼行數:27,代碼來源:HalEmbeddedBuilder.java

示例2: instantiateResource

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
@Override
protected FooResource instantiateResource(Foo entity) {

	BarResource bar1 = new BarResourceAssembler().toResource(new Bar(Url62.decode("bar1"), "bar one", entity));
	BarResource bar2 = new BarResourceAssembler().toResource(new Bar(Url62.decode("bar2"), "bar two", entity));

	EmbeddedWrappers wrappers = new EmbeddedWrappers(true);
	List<EmbeddedWrapper> embeddeds = Arrays.asList(wrappers.wrap(bar1), wrappers.wrap(bar2));
	FooResource fooResource = new FooResource(entity.getId(), entity.getName());
	fooResource.setEmbeddeds(new Resources(embeddeds));
	return fooResource;
}
 
開發者ID:Devskiller,項目名稱:friendly-id,代碼行數:13,代碼來源:FooResourceAssembler.java

示例3: add

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
/**
 * Adds the given value to the embeddeds. Will skip doing so if the value is {@literal null} or the content of a
 * {@link Resource} is {@literal null}.
 * 
 * @param source can be {@literal null}.
 */
public void add(Object source) {

	EmbeddedWrapper wrapper = wrappers.wrap(source);

	if (wrapper == null) {
		return;
	}

	String collectionRel = getDefaultedRelFor(wrapper, true);
	String collectionOrItemRel = collectionRel;

	if (!embeddeds.containsKey(collectionRel)) {
		collectionOrItemRel = getDefaultedRelFor(wrapper, wrapper.isCollectionValue());
	}

	Object currentValue = embeddeds.get(collectionOrItemRel);
	Object value = wrapper.getValue();

	if (currentValue == null && !wrapper.isCollectionValue()) {
		embeddeds.put(collectionOrItemRel, value);
		return;
	}

	List<Object> list = new ArrayList<Object>();
	list.addAll(asCollection(currentValue));
	list.addAll(asCollection(wrapper.getValue()));

	embeddeds.remove(collectionOrItemRel);
	embeddeds.put(collectionRel, list);
}
 
開發者ID:mockitoo,項目名稱:spring-data-rest-android,代碼行數:37,代碼來源:HalEmbeddedBuilder.java

示例4: getEmbeddeds

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
public Resources<EmbeddedWrapper> getEmbeddeds() {
	return embeddeds;
}
 
開發者ID:Devskiller,項目名稱:friendly-id,代碼行數:4,代碼來源:FooResource.java

示例5: setEmbeddeds

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
public void setEmbeddeds(Resources<EmbeddedWrapper> embeddeds) {
	this.embeddeds = embeddeds;
}
 
開發者ID:Devskiller,項目名稱:friendly-id,代碼行數:4,代碼來源:FooResource.java

示例6: ProfileResource

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
public ProfileResource(String firstName, String lastName, Resources<EmbeddedWrapper> embeddeds) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.embeddeds = embeddeds;
}
 
開發者ID:dschulten,項目名稱:hydra-java,代碼行數:6,代碼來源:SirenUtilsTest.java

示例7: getEmbeddeds

import org.springframework.hateoas.core.EmbeddedWrapper; //導入依賴的package包/類
public Resources<EmbeddedWrapper> getEmbeddeds() {
    return embeddeds;
}
 
開發者ID:dschulten,項目名稱:hydra-java,代碼行數:4,代碼來源:SirenUtilsTest.java


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