本文整理汇总了Java中org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty.setPartner方法的典型用法代码示例。如果您正苦于以下问题:Java CsdlNavigationProperty.setPartner方法的具体用法?Java CsdlNavigationProperty.setPartner怎么用?Java CsdlNavigationProperty.setPartner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty
的用法示例。
在下文中一共展示了CsdlNavigationProperty.setPartner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navigationPropertyWithPartner
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的package包/类
@Test
public void navigationPropertyWithPartner() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
CsdlEntityType entityTypeProvider = new CsdlEntityType();
entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
List<CsdlNavigationProperty> navigationProperties = new ArrayList<CsdlNavigationProperty>();
navigationProperties.add(new CsdlNavigationProperty().setName("partnerName").setType(entityTypeName));
entityTypeProvider.setNavigationProperties(navigationProperties);
when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
propertyProvider.setType(entityTypeName);
propertyProvider.setNullable(false);
propertyProvider.setPartner("partnerName");
EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
EdmNavigationProperty partner = property.getPartner();
assertNotNull(partner);
// Caching
assertTrue(partner == property.getPartner());
}
示例2: navigationPropertyWithNonexistentPartner
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的package包/类
@Test(expected = EdmException.class)
public void navigationPropertyWithNonexistentPartner() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
CsdlEntityType entityTypeProvider = new CsdlEntityType();
entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
List<CsdlNavigationProperty> navigationProperties = new ArrayList<CsdlNavigationProperty>();
navigationProperties.add(new CsdlNavigationProperty().setName("partnerName").setType(entityTypeName));
entityTypeProvider.setNavigationProperties(navigationProperties);
when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
propertyProvider.setType(entityTypeName);
propertyProvider.setNullable(false);
propertyProvider.setPartner("wrong");
EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
property.getPartner();
}
示例3: doDeserialize
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的package包/类
@Override
protected CsdlNavigationProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
final CsdlNavigationProperty property = new ClientCsdlNavigationProperty();
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
final JsonToken token = jp.getCurrentToken();
if (token == JsonToken.FIELD_NAME) {
if ("Name".equals(jp.getCurrentName())) {
property.setName(jp.nextTextValue());
} else if ("Type".equals(jp.getCurrentName())) {
String metadataTypeName = jp.nextTextValue();
if (metadataTypeName.startsWith("Collection(")) {
property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
metadataTypeName.length() - 1));
property.setCollection(true);
} else {
property.setType(metadataTypeName);
property.setCollection(false);
}
} else if ("Nullable".equals(jp.getCurrentName())) {
property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
} else if ("Partner".equals(jp.getCurrentName())) {
property.setPartner(jp.nextTextValue());
} else if ("ContainsTarget".equals(jp.getCurrentName())) {
property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
} else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
jp.nextToken();
property.getReferentialConstraints().add(jp.readValueAs(ClientCsdlReferentialConstraint.class));
} else if ("OnDelete".equals(jp.getCurrentName())) {
jp.nextToken();
property.setOnDelete(jp.readValueAs(ClientCsdlOnDelete.class));
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
property.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class));
}
}
}
return property;
}