當前位置: 首頁>>代碼示例>>Java>>正文


Java CsdlTerm.setScale方法代碼示例

本文整理匯總了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);

}
 
開發者ID:apache,項目名稱:olingo-odata4,代碼行數:35,代碼來源:EdmTermImplTest.java

示例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;
}
 
開發者ID:apache,項目名稱:olingo-odata4,代碼行數:36,代碼來源:MetadataParser.java


注:本文中的org.apache.olingo.commons.api.edm.provider.CsdlTerm.setScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。