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


Java SchemaType.LIST属性代码示例

本文整理汇总了Java中org.apache.xmlbeans.SchemaType.LIST属性的典型用法代码示例。如果您正苦于以下问题:Java SchemaType.LIST属性的具体用法?Java SchemaType.LIST怎么用?Java SchemaType.LIST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.xmlbeans.SchemaType的用法示例。


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

示例1: getBaseClass

String getBaseClass(SchemaType sType) {
  SchemaType baseType = findBaseType(sType.getBaseType());

  switch (sType.getSimpleVariety()) {
  case SchemaType.NOT_SIMPLE:
    // non-simple-content: inherit from base type impl
    if (!XmlObject.type.equals(baseType))
      return baseType.getFullJavaImplName();
    return "org.apache.xmlbeans.impl.values.XmlComplexContentImpl";

  case SchemaType.ATOMIC:
    // We should only get called for restrictions
    assert(!sType.isBuiltinType());
    return getAtomicRestrictionType(sType);

  case SchemaType.LIST:
    return "org.apache.xmlbeans.impl.values.XmlListImpl";

  case SchemaType.UNION:
    return "org.apache.xmlbeans.impl.values.XmlUnionImpl";

  default:
    throw new IllegalStateException();
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:25,代码来源:XteeSchemaCodePrinter.java

示例2: printInnerTypeJavaDoc

void printInnerTypeJavaDoc(SchemaType sType) throws IOException {
  QName name = sType.getName();
  if (name == null) {
    if (sType.isDocumentType())
      name = sType.getDocumentElementName();
    else if (sType.isAttributeType())
      name = sType.getAttributeTypeAttributeName();
    else if (sType.getContainerField() != null)
      name = sType.getContainerField().getName();
  }

  emit("/**");
  if (sType.isDocumentType())
    emit(" * A document containing one " + prettyQName(name) + " element.");
  else if (sType.isAttributeType())
    emit(" * A document containing one " + prettyQName(name) + " attribute.");
  else if (name != null)
    emit(" * An XML " + prettyQName(name) + ".");
  else
    emit(" * An anonymous inner XML type.");
  emit(" *");
  switch (sType.getSimpleVariety()) {
  case SchemaType.NOT_SIMPLE:
    emit(" * This is a complex type.");
    break;
  case SchemaType.ATOMIC:
    emit(" * This is an atomic type that is a restriction of " + getFullJavaName(sType) + ".");
    break;
  case SchemaType.LIST:
    emit(" * This is a list type whose items are " + sType.getListItemType().getFullJavaName() + ".");
    break;
  case SchemaType.UNION:
    emit(" * This is a union type. Instances are of one of the following types:");
    SchemaType[] members = sType.getUnionConstituentTypes();
    for (int i = 0; i < members.length; i++)
      emit(" *     " + members[i].getFullJavaName());
    break;
  }
  emit(" */");
}
 
开发者ID:nortal,项目名称:j-road,代码行数:40,代码来源:XteeSchemaCodePrinter.java

示例3: describeSchema

public String describeSchema(SchemaType sType, int indentLvl) {
	String repr = "";
	String indent = "";
	for (int i=0; i<indentLvl; i++)
		indent += "\t";
	
	String name = "";
	String namespace = "";
	if (sType.getName() != null) {
		name = sType.getName().getLocalPart();
		namespace = sType.getName().getNamespaceURI();
	}
	if (sType.isSimpleType()) {
		repr += indent + "<simpleType name=\"" + name + "\" namespace=\"" + namespace + "\" ";
		// Don't bother describing primitive types further
		if (sType.getSimpleVariety() == SchemaType.ATOMIC && sType.isPrimitiveType())
			return repr + "/>\n";
		repr += ">\n";
		switch (sType.getSimpleVariety()) {
			case SchemaType.ATOMIC:
				repr += indent + "\t<restriction base=\"" + sType.getPrimitiveType().getName() + "\" ";
				if (!facetRestrictions.isEmpty()) {
					repr +=  ">\n";
					for (Map.Entry<String, String[]> entry : facetRestrictions.entrySet()) {
						for (String val : entry.getValue())
							repr += indent + "\t\t<" + entry.getKey() + " value=\"" + val + "\" />\n";
					}
					repr += indent + "\t</restriction>\n";
				} else
					repr += "/>\n";
				break;
			case SchemaType.LIST:
				repr += indent + "\t<list>\n";
				repr += indent + describeSchema(sType.getListItemType(), (indentLvl + 1));
				repr += indent + "\t</list>\n";
				break;
			case SchemaType.UNION:
				repr += indent + "\t<union>\n";
				for (SchemaType memberType : sType.getUnionMemberTypes())
					repr += describeSchema(memberType, (indentLvl + 2));
				repr += indent + "\t</union>\n";
				break;
			default:
				repr += indent + "\tERROR";
				break;
		}
		repr += indent + "</simpleType>\n";
	} else { // Complex type
		repr += indent + "<complexType name=\"" + name + "\" namespace=\"" + namespace + "\" ";
		if (sType.getContentType() == SchemaType.MIXED_CONTENT)
			repr += "mixed=\"true\" ";
		repr += ">\n";
		for (MSPSchemaTypeAttribute attr : attributeProperties) {
			repr += indent + "\t<attribute " + attr.toString() + ">\n";
			repr += attr.getSchemaType().toString((indentLvl + 2));
			repr += indent + "\t</attribute>\n";
		}
		switch (sType.getContentType()) {
			case SchemaType.EMPTY_CONTENT:
				repr += indent + "\t<!-- Empty Content -->\n";
				break;
			case SchemaType.SIMPLE_CONTENT:
				repr += indent + "\t<simpleContent>\n";
				repr += describeSchema(sType.getContentBasedOnType(), (indentLvl + 2));
				repr += indent + "\t</simpleContent>\n";
				break;
			default: //Element or Mixed Content
				repr += indent + "\t<complexContent>\n";
				for (MSPSchemaTypeElement elmt : elementProperties) {
					repr += indent +  "\t\t<element " + elmt.toString() + ">\n";
					repr += elmt.getSchemaType().toString((indentLvl + 3));
					repr += indent + "\t\t</element>\n";
				}
				repr += indent + "\t</complexContent>\n";
				break;
		}
		repr += indent + "</complexType>\n";
	}
	return repr;
}
 
开发者ID:dpinney,项目名称:essence,代码行数:80,代码来源:MSSchemaTypeParser.java

示例4: emitSpecializedAccessors

private void emitSpecializedAccessors(SchemaType sType) throws IOException {
  if (sType.getSimpleVariety() == SchemaType.ATOMIC
      && sType.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL) {
    int bits = sType.getDecimalSize();
    int parentBits = sType.getBaseType().getDecimalSize();
    if (bits != parentBits || sType.getBaseType().getFullJavaName() == null) {
      if (bits == SchemaType.SIZE_BIG_INTEGER) {
        emit("java.math.BigInteger getBigIntegerValue();");
        emit("void setBigIntegerValue(java.math.BigInteger bi);");
        emit("/** @deprecated */");
        emit("java.math.BigInteger bigIntegerValue();");
        emit("/** @deprecated */");
        emit("void set(java.math.BigInteger bi);");
      } else if (bits == SchemaType.SIZE_LONG) {
        emit("long getLongValue();");
        emit("void setLongValue(long l);");
        emit("/** @deprecated */");
        emit("long longValue();");
        emit("/** @deprecated */");
        emit("void set(long l);");
      } else if (bits == SchemaType.SIZE_INT) {
        emit("int getIntValue();");
        emit("void setIntValue(int i);");
        emit("/** @deprecated */");
        emit("int intValue();");
        emit("/** @deprecated */");
        emit("void set(int i);");
      } else if (bits == SchemaType.SIZE_SHORT) {
        emit("short getShortValue();");
        emit("void setShortValue(short s);");
        emit("/** @deprecated */");
        emit("short shortValue();");
        emit("/** @deprecated */");
        emit("void set(short s);");
      } else if (bits == SchemaType.SIZE_BYTE) {
        emit("byte getByteValue();");
        emit("void setByteValue(byte b);");
        emit("/** @deprecated */");
        emit("byte byteValue();");
        emit("/** @deprecated */");
        emit("void set(byte b);");
      }
    }
  }

  if (sType.getSimpleVariety() == SchemaType.UNION) {
    emit("java.lang.Object getObjectValue();");
    emit("void setObjectValue(java.lang.Object val);");
    emit("/** @deprecated */");
    emit("java.lang.Object objectValue();");
    emit("/** @deprecated */");
    emit("void objectSet(java.lang.Object val);");
    emit("org.apache.xmlbeans.SchemaType instanceType();");
    SchemaType ctype = sType.getUnionCommonBaseType();
    if (ctype != null && ctype.getSimpleVariety() != SchemaType.UNION)
      ;
    emitSpecializedAccessors(ctype);
  }

  if (sType.getSimpleVariety() == SchemaType.LIST) {
    emit("java.util.List getListValue();");
    emit("java.util.List xgetListValue();");
    emit("void setListValue(java.util.List list);");
    emit("/** @deprecated */");
    emit("java.util.List listValue();");
    emit("/** @deprecated */");
    emit("java.util.List xlistValue();");
    emit("/** @deprecated */");
    emit("void set(java.util.List list);");
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:71,代码来源:XteeSchemaCodePrinter.java


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