org.eclipse.xsd.XSDAttributeUse.getUse()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.eclipse.xsd.XSDAttributeUse.getUse()方法的一些代码示例,展示了XSDAttributeUse.getUse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDAttributeUse.getUse()方法的具体详情如下:
包路径:org.eclipse.xsd.XSDAttributeUse
类名称:XSDAttributeUse
方法名:getUse

XSDAttributeUse.getUse介绍

[英]Returns the value of the 'Use' attribute. The literals are from the enumeration org.eclipse.xsd.XSDAttributeUseCategory.

This concrete attribute represents the value of the use attribute.
[中]返回“Use”属性的值。文本来自枚举组织。日食xsd。XSDAttributeUseCategory。
这个具体属性表示use属性的值。

代码示例

代码示例来源:origin: geotools/geotools

@Override
public boolean isIdentifiable(XSDComplexTypeDefinition typeDefinition) {
  List attributeUses = typeDefinition.getAttributeUses();
  final String idAttName = getId().getLocalPart();
  for (Iterator it = attributeUses.iterator(); it.hasNext(); ) {
    XSDAttributeUse use = (XSDAttributeUse) it.next();
    XSDAttributeUseCategory useCategory = use.getUse();
    XSDAttributeDeclaration idAtt = use.getAttributeDeclaration();
    String targetNamespace = idAtt.getTargetNamespace();
    String name = idAtt.getName();
    if (getNameSpace().equals(targetNamespace) && idAttName.equals(name)) {
      if (XSDAttributeUseCategory.REQUIRED_LITERAL.equals(useCategory)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.emf/org.eclipse.xsd.edit

if (XSDAttributeUseCategory.REQUIRED_LITERAL != xsdAttributeUse.getUse())
    (XSDAttributeUseCategory.PROHIBITED_LITERAL == xsdAttributeUse.getUse() ?
     "Zero" : 
     XSDAttributeUseCategory.REQUIRED_LITERAL == xsdAttributeUse.getUse() ?
      "One" : 
      "ZeroToOne");

代码示例来源:origin: org.eclipse/org.eclipse.xsd

protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributes(Collection<XSDAttributeGroupContent> xsdAttributeContents)
{
 Map<String, XSDAttributeDeclaration> result = new HashMap<String, XSDAttributeDeclaration>();
 for (XSDAttributeGroupContent xsdAttributeGroupContent :  xsdAttributeContents)
 {
  if (xsdAttributeGroupContent instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition)xsdAttributeGroupContent;
   result.putAll(getProhibitedAttributes(xsdAttributeGroupDefinition.getContents()));
  }
  else
  {
   XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)xsdAttributeGroupContent;
   if (xsdAttributeUse.getUse() == XSDAttributeUseCategory.PROHIBITED_LITERAL)
   {
    XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
    result.put(xsdAttributeDeclaration.getURI(), xsdAttributeDeclaration);
   }
  }
 }
 return result;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributes(Collection<XSDAttributeGroupContent> xsdAttributeContents)
{
 Map<String, XSDAttributeDeclaration> result = new HashMap<String, XSDAttributeDeclaration>();
 for (XSDAttributeGroupContent xsdAttributeGroupContent :  xsdAttributeContents)
 {
  if (xsdAttributeGroupContent instanceof XSDAttributeGroupDefinition)
  {
   XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition)xsdAttributeGroupContent;
   result.putAll(getProhibitedAttributes(xsdAttributeGroupDefinition.getContents()));
  }
  else
  {
   XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)xsdAttributeGroupContent;
   if (xsdAttributeUse.getUse() == XSDAttributeUseCategory.PROHIBITED_LITERAL)
   {
    XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
    result.put(xsdAttributeDeclaration.getURI(), xsdAttributeDeclaration);
   }
  }
 }
 return result;
}

代码示例来源:origin: org.geotools/gt-app-schema

/**
 * Determines if elements of the given complex type definition are required to have an
 * identifier by looking for a child element of <code>typeDefinition</code> of the form
 * <code>&lt;xs:attribute ref=&quot;gml:id&quot; use=&quot;required&quot; /&gt;</code>
 * 
 * @param typeDefinition
 * @return
 */
private boolean isIdentifiable(XSDComplexTypeDefinition typeDefinition) {
  List attributeUses = typeDefinition.getAttributeUses();
  final String idAttName = GML.getId().getLocalPart();
  for (Iterator it = attributeUses.iterator(); it.hasNext();) {
    XSDAttributeUse use = (XSDAttributeUse) it.next();
    XSDAttributeUseCategory useCategory = use.getUse();
    XSDAttributeDeclaration idAtt = use.getAttributeDeclaration();
    String targetNamespace = idAtt.getTargetNamespace();
    String name = idAtt.getName();
    if (GML.getNameSpace().equals(targetNamespace) && idAttName.equals(name)) {
      if (XSDAttributeUseCategory.REQUIRED_LITERAL.equals(useCategory)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

if (xsdAttributeUse.getUse() != XSDAttributeUseCategory.PROHIBITED_LITERAL)

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

if (xsdAttributeUse.getUse() != XSDAttributeUseCategory.PROHIBITED_LITERAL)

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

public void execute()
{
 Element element = component.getElement();
 try
 {
  beginRecording(element);
  String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
  removeMinOccursAttribute = (currentMin == null) ? true : false;
  if (component instanceof XSDParticle)
  {
   oldMinOccurs = ((XSDParticle) component).getMinOccurs();
   ((XSDParticle) component).setMinOccurs(newMinOccurs);
  }
  else if (component instanceof XSDAttributeUse)
  {
   oldMinOccurs = (((XSDAttributeUse) component).getUse() == XSDAttributeUseCategory.REQUIRED_LITERAL ? 1 : 0);
   if (newMinOccurs == 1)
    ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
   else
    ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL);
  }
 }
 finally
 {
  endRecording();
 }
}

相关文章