本文整理了Java中io.yawp.repository.Yawp
类的一些代码示例,展示了Yawp
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yawp
类的具体详情如下:
包路径:io.yawp.repository.Yawp
类名称:Yawp
暂无
代码示例来源:origin: feroult/yawp
public T get() {
if (object == null && json == null) {
return null;
}
if (object == null) {
object = (T) JsonUtils.from(Yawp.yawp(), json, type);
}
return object;
}
代码示例来源:origin: feroult/yawp
public static Repository yawp() {
init();
return yawp.get();
}
代码示例来源:origin: feroult/yawp
@Override
public void destroy() {
super.destroy();
Yawp.destroyFeatures();
}
代码示例来源:origin: feroult/yawp
protected Repository initYawp() {
String appPackage = getAppPackage();
if (appPackage != null) {
Yawp.init(appPackage);
}
return Yawp.yawp();
}
代码示例来源:origin: feroult/yawp
private static void init() {
if (yawp.get() != null) {
return;
}
if (features == null) {
safeLoadFeaturesFromConfig();
}
yawp.set(Repository.r().setFeatures(features));
}
代码示例来源:origin: feroult/yawp
@Test
public void testSimpleRepositoryAccess() {
Yawp.yawp.save(new BasicObject("xpto"));
BasicObject retrievedObject = Yawp.yawp(BasicObject.class).first();
assertEquals("xpto", retrievedObject.getStringValue());
}
代码示例来源:origin: feroult/yawp
private Set<Class<?>> scanEndpointClazzes() {
WebConfiguration webConfiguration = new WebConfiguration(getWebConfigFile());
if (webConfiguration.getPackagePrefix() != null) {
Yawp.init(webConfiguration.getPackagePrefix());
}
return yawp.getFeatures().getEndpointClazzes();
}
代码示例来源:origin: feroult/yawp
/**
* @deprecated in 2.0, yawp will be configured only by yawp.yml
*/
@Deprecated
private void initYawp(String packagePrefix) {
if (packagePrefix == null) {
return;
}
Yawp.init(packagePrefix);
}
代码示例来源:origin: feroult/yawp
public static void init(String packagePrefix) {
if (yawp.get() != null) {
return;
}
if (features == null) {
safeLoadFeatures(packagePrefix);
}
yawp.set(Repository.r().setFeatures(features));
}
代码示例来源:origin: feroult/yawp
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (!enableFixtures()) {
response(resp, new ExceptionResponse(403));
return;
}
Yawp.yawp.namespace(req.getHeader("namespace"));
super.service(req, resp);
}
代码示例来源:origin: feroult/yawp
public HttpResponse execute(RequestContext ctx) {
try {
Cache.clearAll();
Repository r = getRepository(ctx);
EndpointRouter router = EndpointRouter.parse(r, ctx);
if (!router.isValid()) {
throw new HttpException(400, "Invalid route. Please check uri, json format, object ids and parent structure, etc.");
}
return router.executeRestAction(enableShields);
} finally {
Yawp.dispose();
}
}
代码示例来源:origin: feroult/yawp
public IdRef<?> getSinkId() {
if (sinkId == null) {
sinkId = IdRef.parse(yawp(), sinkUri);
}
return sinkId;
}
代码示例来源:origin: feroult/yawp
@Override
public <T> T fetch(IdRef<T> id) {
init();
return get().fetch(id);
}
代码示例来源:origin: feroult/yawp
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
String uri = (String) in.readObject();
IdRef<T> idRef = (IdRef<T>) parse(yawp(), uri);
this.r = idRef.r;
this.clazz = idRef.clazz;
this.model = idRef.model;
this.id = idRef.id;
this.name = idRef.name;
this.parentId = idRef.parentId;
}
代码示例来源:origin: feroult/yawp
@Override
public String currentNamespace() {
init();
return get().currentNamespace();
}
代码示例来源:origin: feroult/yawp
private void init(Class<? extends Pipe> pipeClazz, String cursor) {
this.r = yawp();
this.pipeClazz = pipeClazz;
this.sourceClazz = ReflectionUtils.getFeatureEndpointClazz(pipeClazz);
this.cursor = cursor;
}
代码示例来源:origin: feroult/yawp
@Override
public AsyncRepository async() {
init();
return get().async();
}
代码示例来源:origin: feroult/yawp
private List<T> readObjects(ObjectInputStream in) throws IOException, ClassNotFoundException {
List<String> jsonList = (List<String>) in.readObject();
List<T> objects = new ArrayList<>();
for (String json : jsonList) {
objects.add((T) JsonUtils.from(Yawp.yawp(), json, clazz));
}
return objects;
}
代码示例来源:origin: feroult/yawp
@Override
public <T> QueryBuilder<T> query(Class<T> clazz) {
init();
return get().query(clazz);
}
代码示例来源:origin: feroult/yawp
private void init(Class<? extends Pipe> pipeClazz, String sourceUri) {
this.r = yawp();
this.pipeClazz = pipeClazz;
this.sourceId = IdRef.parse(r, sourceUri);
}
内容来源于网络,如有侵权,请联系作者删除!