当前位置: 首页>>代码示例>>Java>>正文


Java EdmEnumType类代码示例

本文整理汇总了Java中org.apache.olingo.commons.api.edm.EdmEnumType的典型用法代码示例。如果您正苦于以下问题:Java EdmEnumType类的具体用法?Java EdmEnumType怎么用?Java EdmEnumType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EdmEnumType类属于org.apache.olingo.commons.api.edm包,在下文中一共展示了EdmEnumType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cacheEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Test
public void cacheEnumType() {
  EdmEnumType enumType = edm.getEnumType(NAME1);
  assertNotNull(enumType);

  EdmEnumType cachedType = edm.getEnumType(NAME1);
  assertNotNull(cachedType);

  assertTrue(enumType == cachedType);
  assertEquals(enumType, cachedType);

  EdmEnumType enumType2 = edm.getEnumType(NAME2);
  assertNotNull(enumType2);

  assertNotSame(enumType, enumType2);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmImplCachingTest.java

示例2: termWithEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Test
public void termWithEnumType() {
  CsdlTerm csdlTerm = new CsdlTerm();
  FullQualifiedName csdlTerm1Name = new FullQualifiedName("namespace", "name1");
  csdlTerm.setName(csdlTerm1Name.getName());
  String namespaceAndName = "mySchema.Enum";
  String name = "Enum";
  csdlTerm.setType(namespaceAndName);
  Edm edm = mock(Edm.class);
  EdmEnumType typeMock = mock(EdmEnumType.class);
  when(typeMock.getName()).thenReturn(name);
  when(edm.getEnumType(new FullQualifiedName(namespaceAndName))).thenReturn(typeMock);
  EdmTerm localTerm = new EdmTermImpl(edm, "namespace", csdlTerm);
  assertNotNull(localTerm.getType());
  assertEquals(name, localTerm.getType().getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmTermImplTest.java

示例3: appendEnumTypes

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
private void appendEnumTypes(JsonGenerator json, List<EdmEnumType> enumTypes) 
    throws SerializerException, IOException {
  for (EdmEnumType enumType : enumTypes) {
    json.writeObjectFieldStart(enumType.getName());
    json.writeStringField(KIND, Kind.EnumType.name());
    json.writeBooleanField(IS_FLAGS, enumType.isFlags());
    json.writeStringField(UNDERLYING_TYPE, getFullQualifiedName(enumType.getUnderlyingType()));

    for (String memberName : enumType.getMemberNames()) {

      EdmMember member = enumType.getMember(memberName);
      if (member.getValue() != null) {
        json.writeStringField(memberName, member.getValue());
      }

      appendAnnotations(json, member, memberName);
    }
    json.writeEndObject();
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:MetadataDocumentJsonSerializer.java

示例4: appendEnumTypes

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
private void appendEnumTypes(final XMLStreamWriter writer, final List<EdmEnumType> enumTypes)
    throws XMLStreamException {
  for (EdmEnumType enumType : enumTypes) {
    writer.writeStartElement(XML_ENUM_TYPE);
    writer.writeAttribute(XML_NAME, enumType.getName());
    writer.writeAttribute(XML_IS_FLAGS, Boolean.toString(enumType.isFlags()));
    writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(enumType.getUnderlyingType(), false));

    for (String memberName : enumType.getMemberNames()) {
      writer.writeStartElement(XML_MEMBER);
      writer.writeAttribute(XML_NAME, memberName);

      EdmMember member = enumType.getMember(memberName);
      if (member.getValue() != null) {
        writer.writeAttribute(XML_VALUE, member.getValue());
      }

      appendAnnotations(writer, member);
      writer.writeEndElement();
    }

    writer.writeEndElement();
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:MetadataDocumentXmlSerializer.java

示例5: visitEnum

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public Object visitEnum(
    EdmEnumType type,
    List<String> enumValues) throws ExpressionVisitException, ODataApplicationException {

  throw new NotImplementedException("visitEnum not implemented");
}
 
开发者ID:pukkaone,项目名称:odata-spring-boot-starter,代码行数:8,代码来源:ElasticsearchExpressionVisitor.java

示例6: visitEnum

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Object visitEnum(EdmEnumType type, List enumValues)
		throws ExpressionVisitException, ODataApplicationException {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:8,代码来源:SparqlExpressionVisitor.java

示例7: vocabularies

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Test
public void vocabularies() {
  final Edm edm = client.getRetrieveRequestFactory().
      getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody();
  assertNotNull(edm);

  final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core", "IsLanguageDependent"));
  assertNotNull(isLanguageDependent);
  assertTrue(isLanguageDependent.getAppliesTo().contains(TargetType.Property));
  assertTrue(isLanguageDependent.getAppliesTo().contains(TargetType.Term));
  assertEquals(edm.getTypeDefinition(new FullQualifiedName("Core", "Tag")), isLanguageDependent.getType());
  assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean),
      ((EdmTypeDefinition) isLanguageDependent.getType()).getUnderlyingType());

  final EdmTerm permissions = edm.getTerm(new FullQualifiedName("Core", "Permissions"));
  assertNotNull(permissions);
  assertTrue(permissions.getType() instanceof EdmEnumType);

  // 2. measures
  final EdmSchema measures = edm.getSchema("UoM");
  assertNotNull(measures);

  final EdmTerm scale = edm.getTerm(new FullQualifiedName("UoM", "Scale"));
  assertNotNull(scale);

  final EdmAnnotation requiresTypeInScale =
      scale.getAnnotation(edm.getTerm(new FullQualifiedName("Core", "RequiresType")), null);
  assertNotNull(requiresTypeInScale);
  assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValueAsString());

  // 3. capabilities
  final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities", "DeleteRestrictions"));
  assertNotNull(deleteRestrictions);
  assertEquals(deleteRestrictions.getType().getFullQualifiedName(),
      edm.getComplexType(new FullQualifiedName("Capabilities", "DeleteRestrictionsType")).getFullQualifiedName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:37,代码来源:MetadataTestITCase.java

示例8: visitEnum

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public VisitorOperand visitEnum(final EdmEnumType type, final List<String> enumValues)
    throws ExpressionVisitException, ODataApplicationException {
  Long result = null;
  try {
    for (final String enumValue : enumValues) {
      final Long value = type.valueOfString(enumValue, null, null, null, null, null, Long.class);
      result = result == null ? value : result | value;
    }
  } catch (final EdmPrimitiveTypeException e) {
    throw new ODataApplicationException("Illegal enum value.",
        HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT, e);
  }
  return new TypedOperand(result, type);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:16,代码来源:ExpressionVisitorImpl.java

示例9: createEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public EdmEnumType createEnumType(final FullQualifiedName enumName) {
  try {
    CsdlEnumType enumType = provider.getEnumType(enumName);
    if (enumType != null) {
      return new EdmEnumTypeImpl(this, enumName, enumType);
    }
    return null;
  } catch (ODataException e) {
    throw new EdmException(e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:13,代码来源:EdmProviderImpl.java

示例10: createEnumTypes

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
protected List<EdmEnumType> createEnumTypes() {
  final List<EdmEnumType> enumTyps = new ArrayList<EdmEnumType>();
  final List<CsdlEnumType> providerEnumTypes = schema.getEnumTypes();
  if (providerEnumTypes != null) {
    for (CsdlEnumType enumType : providerEnumTypes) {
      FullQualifiedName enumName = new FullQualifiedName(namespace, enumType.getName());
      EdmEnumType enumTypeImpl = new EdmEnumTypeImpl(edm, enumName, enumType);
      enumTyps.add(enumTypeImpl);
      edm.cacheEnumType(enumName, enumTypeImpl);
    }
  }
  return enumTyps;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:14,代码来源:EdmSchemaImpl.java

示例11: equals

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public boolean equals(final Object obj) {
  return obj != null
      && (obj == this
      || obj instanceof EdmEnumType
          && getFullQualifiedName().equals(((EdmEnumType) obj).getFullQualifiedName()));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:8,代码来源:EdmEnumTypeImpl.java

示例12: getEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
  final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
  EdmEnumType enumType = enumTypes.get(fqn);
  if (enumType == null) {
    enumType = createEnumType(fqn);
    if (enumType != null) {
      enumTypes.put(fqn, enumType);
    }
  }
  return enumType;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:13,代码来源:AbstractEdm.java

示例13: callCreateEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Test
public void callCreateEnumType() {
  EdmEnumType enumType = edm.getEnumType(FQN);
  assertNotNull(enumType);
  assertEquals(FQN.getNamespace(), enumType.getNamespace());
  assertEquals(FQN.getName(), enumType.getName());

  assertNull(edm.getEnumType(WRONG_FQN));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:10,代码来源:EdmImplCallCreateTest.java

示例14: createEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public EdmEnumType createEnumType(final FullQualifiedName fqn) {
  if (FQN.getNamespace().equals(fqn.getNamespace()) && FQN.getName().equals(fqn.getName())) {
    EdmEnumType enumType = mock(EdmEnumType.class);
    when(enumType.getNamespace()).thenReturn(fqn.getNamespace());
    when(enumType.getName()).thenReturn(fqn.getName());
    return enumType;
  }
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:11,代码来源:EdmImplCallCreateTest.java

示例15: createEnumType

import org.apache.olingo.commons.api.edm.EdmEnumType; //导入依赖的package包/类
@Override
public EdmEnumType createEnumType(final FullQualifiedName fqn) {
  if (NAME1.equals(fqn) || NAME2.equals(fqn)) {
    EdmEnumType enumType = mock(EdmEnumType.class);
    when(enumType.getNamespace()).thenReturn(fqn.getNamespace());
    when(enumType.getName()).thenReturn(fqn.getName());
    return enumType;
  }
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:11,代码来源:EdmImplCachingTest.java


注:本文中的org.apache.olingo.commons.api.edm.EdmEnumType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。