blob: 62806ff80d503b78b3d0163de90a0dfc46c11e69 [file] [log] [blame]
/*
* 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 java.util.List;
import java.util.ArrayList;
/**
* <p><b>Purpose</b>: Base class for Sequence, Choice and All
* @see org.eclipse.persistence.internal.oxm.schema.model.Sequence
* @see org.eclipse.persistence.internal.oxm.schema.model.Choice
* @see org.eclipse.persistence.internal.oxm.schema.model.All
*/
public abstract class TypeDefParticle {
private TypeDefParticleOwner owner;
private String minOccurs;
private String maxOccurs;
private java.util.List<Element> elements;
//Group??
protected TypeDefParticle() {
}
public void addElement(Element elem) {
getElements().add(elem);
}
public void setElements(List<Element> elements) {
this.elements = elements;
}
public List<Element> getElements() {
if (elements == null) {
elements = new ArrayList<>();
}
return elements;
}
public void setMinOccurs(String minOccurs) {
this.minOccurs = minOccurs;
}
public String getMinOccurs() {
return minOccurs;
}
public void setMaxOccurs(String maxOccurs) {
this.maxOccurs = maxOccurs;
}
public String getMaxOccurs() {
return maxOccurs;
}
public void setOwner(TypeDefParticleOwner owner) {
this.owner = owner;
}
public TypeDefParticleOwner getOwner() {
return owner;
}
public String getOwnerName() {
if (owner == null) {
return null;
} else if (owner instanceof TypeDefParticle) {
return ((TypeDefParticle)owner).getOwnerName();
} else if (owner instanceof ComplexType) {
return ((ComplexType)owner).getNameOrOwnerName();
}
return null;
}
}