Method from org.apache.xmlbeans.impl.inst2xsd.util.Type Detail: |
public void addAllEnumerationsFrom(Type from) {
assert _kind==SIMPLE_TYPE_SIMPLE_CONTENT || _kind==COMPLEX_TYPE_SIMPLE_CONTENT : "Enumerations possible only on simple content";
ensureEnumerationValues();
if (_name.equals(XmlQName.type.getName()) && from._name.equals(XmlQName.type.getName()))
{
for (int i = 0; i < from.getEnumerationValues().size(); i++)
{
String enumValue = (String) from.getEnumerationValues().get(i);
QName enumQNameValue = (QName) from.getEnumerationQNames().get(i);
if (_acceptsEnumerationValue && !_enumerationQNames.contains(enumQNameValue))
{
_enumerationValues.add(enumValue);
_enumerationQNames.add(enumQNameValue);
}
}
}
else
{
for (int i = 0; i < from.getEnumerationValues().size(); i++)
{
String enumValue = (String) from.getEnumerationValues().get(i);
if (_acceptsEnumerationValue && !_enumerationValues.contains(enumValue))
{
_enumerationValues.add(enumValue);
}
}
}
}
|
public void addAttribute(Attribute attribute) {
ensureAttributes();
_attributes.add(attribute);
}
|
public void addElement(Element element) {
ensureElements();
_elements.add(element);
}
|
public void addEnumerationValue(String enumerationValue,
XmlCursor xc) {
assert _kind==SIMPLE_TYPE_SIMPLE_CONTENT || _kind==COMPLEX_TYPE_SIMPLE_CONTENT : "Enumerations possible only on simple content";
ensureEnumerationValues();
if (_acceptsEnumerationValue && !_enumerationValues.contains(enumerationValue))
{
_enumerationValues.add(enumerationValue);
if (_name.equals(XmlQName.type.getName()))
{
// check for QName
PrefixResolver prefixResolver = new PrefixResolver()
{
public String getNamespaceForPrefix(String prefix)
{ return xc.namespaceForPrefix(prefix); }
};
QName qname = XmlQNameImpl.validateLexical(enumerationValue, null, prefixResolver);
assert qname!=null : "The check for QName should allready have happened.";
_enumerationQNames.add(qname);
}
}
}
|
public void closeEnumeration() {
_acceptsEnumerationValue=false;
}
|
public static Type createNamedType(QName name,
int contentType) {
assert name!=null;
Type type = new Type();
type.setName(name);
type.setContentType(contentType);
return type;
}
|
public static Type createUnnamedType(int contentType) {
assert contentType==SIMPLE_TYPE_SIMPLE_CONTENT ||
contentType==COMPLEX_TYPE_SIMPLE_CONTENT ||
contentType==COMPLEX_TYPE_COMPLEX_CONTENT ||
contentType==COMPLEX_TYPE_MIXED_CONTENT ||
contentType==COMPLEX_TYPE_EMPTY_CONTENT: "Unknown contentType: " + contentType;
Type type = new Type();
type.setContentType(contentType);
return type;
}
|
public Attribute getAttribute(QName name) {
for (int i = 0; i < _attributes.size(); i++)
{
Attribute attribute = (Attribute) _attributes.get(i);
if (attribute.getName().equals(name))
return attribute;
}
return null;
}
|
public List getAttributes() {
ensureAttributes();
return _attributes;
}
|
public int getContentType() {
return _kind;
}
|
public List getElements() {
ensureElements();
return _elements;
}
|
public List getEnumerationQNames() {
ensureEnumerationValues();
return _enumerationQNames;
}
|
public List getEnumerationValues() {
ensureEnumerationValues();
return _enumerationValues;
}
|
public Type getExtensionType() {
return _extensionType;
}
|
public QName getName() {
return _name;
}
|
public int getTopParticleForComplexOrMixedContent() {
return _topParticleForComplexOrMixedContent;
}
|
public boolean hasSimpleContent() {
return (_kind==SIMPLE_TYPE_SIMPLE_CONTENT ||
_kind==COMPLEX_TYPE_SIMPLE_CONTENT);
}
|
public boolean isComplexType() {
return (_kind==COMPLEX_TYPE_COMPLEX_CONTENT ||
_kind==COMPLEX_TYPE_MIXED_CONTENT||
_kind==COMPLEX_TYPE_SIMPLE_CONTENT);
}
|
public boolean isEnumeration() {
return _acceptsEnumerationValue && _enumerationValues!=null && _enumerationValues.size() >1;
}
|
public boolean isGlobal() {
return _isGlobal;
}
|
public boolean isQNameEnumeration() {
return isEnumeration() && _name.equals(XmlQName.type.getName()) && _enumerationQNames!=null && _enumerationQNames.size() >1;
}
|
public void setContentType(int kind) {
this._kind = kind;
}
|
public void setElements(List elements) {
ensureElements();
_elements.clear();
_elements.addAll(elements);
}
|
public void setExtensionType(Type extendedType) {
assert _kind == COMPLEX_TYPE_SIMPLE_CONTENT : "Extension used only for type which are COMPLEX_TYPE_SIMPLE_CONTENT";
assert extendedType!=null && extendedType.getName()!=null : "Extended type must be a named type.";
_extensionType = extendedType;
}
|
public void setGlobal(boolean isGlobal) {
assert isGlobal && getName()!=null;
_isGlobal = isGlobal;
}
|
public void setName(QName name) {
this._name = name;
}
|
public void setTopParticleForComplexOrMixedContent(int topParticleForComplexOrMixedContent) {
this._topParticleForComplexOrMixedContent = topParticleForComplexOrMixedContent;
}
|
public String toString() {
return "Type{" +
"_name = " + _name +
", _extensionType = " + _extensionType +
", _kind = " + _kind +
", _elements = " + _elements +
", _attributes = " + _attributes +
"}";
}
|