Olingo (OData 4) 如何为 entityType 创建注解?
Olingo (OData 4) How to create annotations for entityType?
如何从代码中注释 entityTypes 是这样的:
http://services.odata.org/OData/OData.svc/$metadata ?
提前致谢。
@EdmEntityType(name = "Team")
@EdmEntitySet(name = "Teams")
public class Team extends RefBase {
@EdmProperty(type = EdmType.BOOLEAN)
private Boolean isScrumTeam;
@EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees")
private List<Employee> employees = new ArrayList<Employee>();
只需查看 here 文档以获取完整详细信息。
收到答复。在这里:
1. EdmProvider 中的注释集,位于 EntitySets:
public CsdlEntitySet getEntitySet(...) throws ... {
...
return new CsdlEntitySet()
.setName(...)
.setType(...)
.setAnnotations(Arrays.asList(new CsdlAnnotation()
.setTerm("termName").setExpression(
new CsdlConstantExpression(CsdlConstantExpression
.ConstantExpressionType.String, "someInfo"))));
...
}
2。术语可以在单独的 TermProvider 中定义。
如何从代码中注释 entityTypes 是这样的:
http://services.odata.org/OData/OData.svc/$metadata ?
提前致谢。
@EdmEntityType(name = "Team")
@EdmEntitySet(name = "Teams")
public class Team extends RefBase {
@EdmProperty(type = EdmType.BOOLEAN)
private Boolean isScrumTeam;
@EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees")
private List<Employee> employees = new ArrayList<Employee>();
只需查看 here 文档以获取完整详细信息。
收到答复。在这里:
1. EdmProvider 中的注释集,位于 EntitySets:
public CsdlEntitySet getEntitySet(...) throws ... {
...
return new CsdlEntitySet()
.setName(...)
.setType(...)
.setAnnotations(Arrays.asList(new CsdlAnnotation()
.setTerm("termName").setExpression(
new CsdlConstantExpression(CsdlConstantExpression
.ConstantExpressionType.String, "someInfo"))));
...
}
2。术语可以在单独的 TermProvider 中定义。