本文整理汇总了Java中org.apache.olingo.commons.api.edm.provider.CsdlTerm.setScale方法的典型用法代码示例。如果您正苦于以下问题:Java CsdlTerm.setScale方法的具体用法?Java CsdlTerm.setScale怎么用?Java CsdlTerm.setScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.provider.CsdlTerm
的用法示例。
在下文中一共展示了CsdlTerm.setScale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTypes
import org.apache.olingo.commons.api.edm.provider.CsdlTerm; //导入方法依赖的package包/类
@Before
public void setupTypes() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
CsdlTerm csdlTerm = new CsdlTerm();
FullQualifiedName csdlTerm1Name = new FullQualifiedName("namespace", "name1");
csdlTerm.setName(csdlTerm1Name.getName());
csdlTerm.setType("Edm.String");
when(provider.getTerm(csdlTerm1Name)).thenReturn(csdlTerm);
initialTerm = new EdmTermImpl(edm, "namespace", csdlTerm);
CsdlTerm derivedCsdlTerm = new CsdlTerm();
FullQualifiedName derivedTermName = new FullQualifiedName("namespace", "name2");
derivedCsdlTerm.setName(derivedTermName.getName());
derivedCsdlTerm.setType("Edm.String");
derivedCsdlTerm.setBaseTerm("namespace.name1");
List<String> appliesTo = new ArrayList<String>();
appliesTo.add("Property");
derivedCsdlTerm.setAppliesTo(appliesTo);
List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
csdlAnnotations.add(new CsdlAnnotation().setTerm("name1"));
derivedCsdlTerm.setAnnotations(csdlAnnotations);
derivedCsdlTerm.setNullable(false);
derivedCsdlTerm.setMaxLength(new Integer(15));
derivedCsdlTerm.setDefaultValue("abc");
derivedCsdlTerm.setPrecision(new Integer(14));
derivedCsdlTerm.setScale(new Integer(13));
when(provider.getTerm(derivedTermName)).thenReturn(derivedCsdlTerm);
derivedTerm = new EdmTermImpl(edm, "namespace", derivedCsdlTerm);
}
示例2: readTerm
import org.apache.olingo.commons.api.edm.provider.CsdlTerm; //导入方法依赖的package包/类
private CsdlTerm readTerm(XMLEventReader reader, StartElement element) throws XMLStreamException {
CsdlTerm term = new CsdlTerm();
term.setName(attr(element, "Name"));
term.setType(attr(element, "Type"));
if (attr(element, "BaseTerm") != null) {
term.setBaseTerm(attr(element, "BaseTerm"));
}
if (attr(element, "DefaultValue") != null) {
term.setDefaultValue(attr(element, "DefaultValue"));
}
if (attr(element, "AppliesTo") != null) {
String[] appliesTo = attr(element, "AppliesTo").split("\\s+");
term.setAppliesTo(Arrays.asList(appliesTo));
}
term.setNullable(Boolean.parseBoolean(attr(element, "Nullable")));
String maxLength = attr(element, "MaxLength");
if (maxLength != null) {
term.setMaxLength(Integer.parseInt(maxLength));
}
String precision = attr(element, "Precision");
if (precision != null) {
term.setPrecision(Integer.parseInt(precision));
}
String scale = attr(element, "Scale");
if (scale != null) {
term.setScale(Integer.parseInt(scale));
}
String srid = attr(element, "SRID");
if (srid != null) {
term.setSrid(SRID.valueOf(srid));
}
peekAnnotations(reader, "Term", term);
return term;
}