| /* |
| * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0, |
| * or the Eclipse Distribution License v. 1.0 which is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| */ |
| |
| // Contributors: |
| // Oracle - initial API and implementation from Oracle TopLink |
| package org.eclipse.persistence.internal.oxm.schema.model; |
| |
| import javax.xml.namespace.QName; |
| import java.util.ArrayList; |
| import java.util.HashMap; |
| import java.util.List; |
| import java.util.Map; |
| |
| /** |
| * A Value Object class representing XML Schema's complexType. |
| */ |
| public final class ComplexType implements TypeDefParticleOwner { |
| private String name; |
| private boolean mixed; |
| private boolean abstractValue; |
| private AnyAttribute anyAttribute; |
| private TypeDefParticle typeDefParticle; |
| private Choice choice; |
| private Sequence sequence; |
| private All all; |
| private Element owner; |
| //simple content or complex content or typedef and attrDecls |
| private ComplexContent complexContent; |
| private SimpleContent simpleContent; |
| private Map<QName, String> attributesMap; |
| private Annotation annotation; |
| private java.util.List<Attribute> orderedAttributes; |
| |
| public ComplexType() { |
| orderedAttributes = new ArrayList<>(); |
| attributesMap = new HashMap<>(); |
| } |
| |
| public void setName(String name) { |
| this.name = name; |
| } |
| |
| public String getName() { |
| return name; |
| } |
| |
| public void setMixed(boolean mixed) { |
| this.mixed = mixed; |
| } |
| |
| public boolean isMixed() { |
| return mixed; |
| } |
| |
| public void setAbstractValue(boolean abstractValue) { |
| this.abstractValue = abstractValue; |
| } |
| |
| public boolean isAbstractValue() { |
| return abstractValue; |
| } |
| |
| |
| public void setAnyAttribute(AnyAttribute anyAttribute) { |
| this.anyAttribute = anyAttribute; |
| } |
| |
| public AnyAttribute getAnyAttribute() { |
| return anyAttribute; |
| } |
| |
| public void setChoice(Choice choice) { |
| this.choice = choice; |
| if (choice != null) { |
| choice.setOwner(this); |
| this.typeDefParticle = choice; |
| } |
| } |
| |
| public Choice getChoice() { |
| return choice; |
| } |
| |
| public void setSequence(Sequence sequence) { |
| this.sequence = sequence; |
| if (sequence != null) { |
| sequence.setOwner(this); |
| this.typeDefParticle = sequence; |
| } |
| } |
| |
| public Sequence getSequence() { |
| return sequence; |
| } |
| |
| public void setAll(All all) { |
| this.all = all; |
| if (all != null) { |
| all.setOwner(this); |
| this.typeDefParticle = all; |
| } |
| } |
| |
| public All getAll() { |
| return all; |
| } |
| |
| public void setTypeDefParticle(TypeDefParticle typeDefParticle) { |
| this.typeDefParticle = typeDefParticle; |
| if (typeDefParticle instanceof Choice) { |
| setChoice((Choice)typeDefParticle); |
| } else if (typeDefParticle instanceof Sequence) { |
| setSequence((Sequence)typeDefParticle); |
| } else { |
| setAll((All)typeDefParticle); |
| } |
| } |
| |
| public TypeDefParticle getTypeDefParticle() { |
| return typeDefParticle; |
| } |
| |
| public void setComplexContent(ComplexContent complexContent) { |
| if (complexContent != null) { |
| complexContent.setOwner(this); |
| } |
| this.complexContent = complexContent; |
| } |
| |
| public ComplexContent getComplexContent() { |
| return complexContent; |
| } |
| |
| public void setSimpleContent(SimpleContent simpleContent) { |
| if (simpleContent != null) { |
| simpleContent.setOwner(this); |
| } |
| this.simpleContent = simpleContent; |
| } |
| |
| public SimpleContent getSimpleContent() { |
| return simpleContent; |
| } |
| |
| public String getNameOrOwnerName() { |
| if (getName() != null) { |
| return getName(); |
| } else if (getOwner() != null) { |
| return getOwner().getName(); |
| } |
| return null; |
| } |
| |
| public Element getOwner() { |
| return owner; |
| } |
| |
| public void setOwner(Element owner) { |
| this.owner = owner; |
| } |
| |
| public void setAttributesMap(Map<QName, String> attributesMap) { |
| this.attributesMap = attributesMap; |
| } |
| |
| public Map<QName, String> getAttributesMap() { |
| return attributesMap; |
| } |
| |
| public void setAnnotation(Annotation annotation) { |
| this.annotation = annotation; |
| } |
| |
| public Annotation getAnnotation() { |
| return annotation; |
| } |
| |
| public void setOrderedAttributes(List<Attribute> orderedAttributes) { |
| this.orderedAttributes = orderedAttributes; |
| } |
| |
| public List<Attribute> getOrderedAttributes() { |
| return orderedAttributes; |
| } |
| } |