当前位置: 首页>>代码示例>>Java>>正文


Java Representation.withBean方法代码示例

本文整理汇总了Java中com.theoryinpractise.halbuilder.api.Representation.withBean方法的典型用法代码示例。如果您正苦于以下问题:Java Representation.withBean方法的具体用法?Java Representation.withBean怎么用?Java Representation.withBean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.theoryinpractise.halbuilder.api.Representation的用法示例。


在下文中一共展示了Representation.withBean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newSlotsRepresentation

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
public Representation newSlotsRepresentation(List<Slot> slots) {
UriBuilder slotsUriBuilder = newSlotsUriBuilder();

Representation rep = newRepresentation(slotsUriBuilder.build());
rep = rep.withBean(slots);

int numSlots = slots.size();
UriBuilder slotUriBuilder = newSlotUriBuilder();

for (int i = 0; i < numSlots; i++) {
    Optional<Slot> previousSlot = Optional.empty();
    Optional<Slot> nextSlot = Optional.empty();

    if (i - 1 >= 0) {
	previousSlot = Optional.of(slots.get(i - 1));
    }
    if (i + 1 < numSlots) {
	nextSlot = Optional.of(slots.get(i + 1));
    }

    rep.withRepresentation("slots",
	    newSlotRepresentation(slots.get(i), previousSlot, nextSlot));

    rep.withLink("item", slotUriBuilder.build(slots.get(i).getId())
	    .toString());
}

if (numSlots > 0) {
    rep.withLink("start", slotUriBuilder.build(slots.get(0).getId())
	    .toString());
}

return rep;
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:35,代码来源:AvailabilityRepresentationFactory.java

示例2: newAppointmentRepresentation

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
public Representation newAppointmentRepresentation(Appointment appt) {
UriBuilder apptUriBuilder = newAppointmentUriBuilder();

Representation rep = newRepresentation(apptUriBuilder.build(
	appt.getId()).toString());

rep.withLink("edit", apptUriBuilder.build(appt.getId()).toString(),
	"cancel", "cancel", null, null);

rep.withBean(appt);

return rep;
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:14,代码来源:AppointmentRepresentationFactory.java


注:本文中的com.theoryinpractise.halbuilder.api.Representation.withBean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。