![JAR search and dependency download from the Maven repository](/logo.png)
org.objectfabric.ValueSetDef Maven / Gradle / Ivy
/**
* This file is part of ObjectFabric (http://objectfabric.org).
*
* ObjectFabric is licensed under the Apache License, Version 2.0, the terms
* of which may be found at http://www.apache.org/licenses/LICENSE-2.0.html.
*
* Copyright ObjectFabric Inc.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.objectfabric;
import javax.xml.bind.annotation.XmlAttribute;
public abstract class ValueSetDef {
static {
JVMPlatform.loadClass();
}
@XmlAttribute
public String Name;
@XmlAttribute(required = false)
public boolean Public = true;
@XmlAttribute(required = false)
public String Comment;
private List _values;
private List _allValues;
private final PlatformSet _enums = new PlatformSet();
public ValueSetDef() {
}
public ValueSetDef(String name, String comment) {
Name = name;
Comment = comment;
}
abstract String actualName(ObjectModelDef model);
abstract TypeDef parent();
abstract ClassDef parentGeneratedClass(ObjectModelDef model);
abstract List createValues();
List values() {
if (_values == null)
_values = createValues();
return _values;
}
ValueDef value(int index) {
return values().get(index);
}
List allValues(ObjectModelDef model) {
if (_allValues == null) {
_allValues = new List();
ClassDef parent = parentGeneratedClass(model);
if (parent != null) {
List temp = parent.allValues(model);
for (int i = 0; i < temp.size(); i++)
_allValues.add(temp.get(i));
}
List temp = values();
for (int i = 0; i < temp.size(); i++)
_allValues.add(temp.get(i));
}
return _allValues;
}
final Iterable enums() {
return _enums;
}
final void registerEnum(TypeDef type) {
if (Debug.ENABLED)
Debug.assertion(PlatformGenerator.isJavaEnum(type.otherClass()));
_enums.add(type);
}
/**
* @param model
*/
boolean lessOr32Fields(ObjectModelDef model) {
return values().size() <= 32;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy