Java Code Examples for com.sun.tools.xjc.model.CClassInfo#getBaseClass()

The following examples show how to use com.sun.tools.xjc.model.CClassInfo#getBaseClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultProcessPropertyInfos.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public boolean isRootClass(ProcessModel context, CClassInfo classInfo) {
	final boolean notMappedSuperclassAndNotEmbeddable = !CustomizationUtils
			.containsCustomization(classInfo,
					Customizations.MAPPED_SUPERCLASS_ELEMENT_NAME)
			&& !CustomizationUtils.containsCustomization(classInfo,
					Customizations.EMBEDDABLE_ELEMENT_NAME);
	if (classInfo.getRefBaseClass() != null) {
		return notMappedSuperclassAndNotEmbeddable
				&& !isSelfOrAncestorRootClass(context,
						classInfo.getRefBaseClass());
	} else if (classInfo.getBaseClass() != null) {
		return notMappedSuperclassAndNotEmbeddable
				&& !isSelfOrAncestorRootClass(context,
						classInfo.getBaseClass());
	} else {
		return notMappedSuperclassAndNotEmbeddable;
	}
}
 
Example 2
Source File: DefaultProcessPropertyInfos.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public boolean isSelfOrAncestorRootClass(ProcessModel context,
		CClassInfo classInfo) {
	if (isRootClass(context, classInfo)) {
		return true;
	} else if (classInfo.getRefBaseClass() != null) {
		return isSelfOrAncestorRootClass(context,
				classInfo.getRefBaseClass());
	} else if (classInfo.getBaseClass() != null) {
		return isSelfOrAncestorRootClass(context, classInfo.getBaseClass());
	} else {
		return !CustomizationUtils.containsCustomization(classInfo,
				Customizations.MAPPED_SUPERCLASS_ELEMENT_NAME)
				&& !CustomizationUtils.containsCustomization(classInfo,
						Customizations.EMBEDDABLE_ELEMENT_NAME);
	}

}
 
Example 3
Source File: GetVersionPropertyInfos.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Collection<CPropertyInfo> process(ProcessModel context,
		CClassInfo classInfo) {

	final Collection<CPropertyInfo> version = new LinkedList<CPropertyInfo>();

	if (classInfo.getBaseClass() != null) {
		version.addAll(process(context, classInfo.getBaseClass()));
	}

	if (!CustomizationUtils.containsCustomization(classInfo,
			Customizations.IGNORED_ELEMENT_NAME)) {

		for (CPropertyInfo propertyInfo : classInfo.getProperties()) {
			if (CustomizationUtils.containsCustomization(propertyInfo,
					Customizations.VERSION_ELEMENT_NAME)
					&& !CustomizationUtils.containsCustomization(
							propertyInfo,
							Customizations.IGNORED_ELEMENT_NAME)) {
				version.add(propertyInfo);
			}
		}
	}
	return version;
}
 
Example 4
Source File: GetIdPropertyInfos.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Collection<CPropertyInfo> process(ProcessModel context,
		CClassInfo classInfo) {

	final Collection<CPropertyInfo> ids = new LinkedList<CPropertyInfo>();

	if (classInfo.getBaseClass() != null) {
		ids.addAll(process(context, classInfo.getBaseClass()));
	}

	if (!CustomizationUtils.containsCustomization(classInfo,
			Customizations.IGNORED_ELEMENT_NAME)) {

		for (CPropertyInfo propertyInfo : classInfo.getProperties()) {
			if ((CustomizationUtils.containsCustomization(propertyInfo,
					Customizations.ID_ELEMENT_NAME) || CustomizationUtils
					.containsCustomization(propertyInfo,
							Customizations.EMBEDDED_ID_ELEMENT_NAME))
					&& !CustomizationUtils.containsCustomization(
							propertyInfo,
							Customizations.IGNORED_ELEMENT_NAME)) {
				ids.add(propertyInfo);
			}
		}
	}
	return ids;
}
 
Example 5
Source File: DefaultIgnoring.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public boolean isClassInfoIgnored(ProcessModel context, CClassInfo classInfo) {

		if (isPackageInfoIgnored(context, classInfo.model,
				getPackageInfo(classInfo))) {
			logger.debug("Class info is ignored since package is ignored.");
			markAsAcknowledged(classInfo);
			return true;
		} else if (CustomizationUtils.containsCustomization(classInfo,
				Customizations.IGNORED_ELEMENT_NAME)) {
			logger.debug("Class info is ignored per customization.");
			markAsAcknowledged(classInfo);
			return true;
		} else if (classInfo.getBaseClass() != null
				&& isClassInfoIgnored(context, classInfo.getBaseClass())) {
			logger.debug("Class info is ignored since base class info is ignored.");
			markAsAcknowledged(classInfo);
			return true;
		} else {
			return false;
		}
	}
 
Example 6
Source File: XJCCMInfoFactory.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected MClassTypeInfo<NType, NClass, ?> createBaseTypeInfo(
		CClassInfo info) {
	if (info.getBaseClass() != null) {
		return getTypeInfo(info.getBaseClass());
	} else if (info.getRefBaseClass() != null) {
		return getTypeInfo(info.getRefBaseClass());
	} else {
		return null;
	}
}
 
Example 7
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPropertyInfo findInheritedPropertyWithCustomization(CClassInfo classInfo, final QName name) {
	for (final CPropertyInfo propertyInfo : classInfo.getProperties()) {
		if (containsCustomization(propertyInfo, name)) {
			return propertyInfo;
		}
	}
	final CClassInfo superClassInfo = classInfo.getBaseClass();
	if (superClassInfo != null) {
		return findInheritedPropertyWithCustomization(superClassInfo, name);
	} else {
		return null;
	}
}
 
Example 8
Source File: InheritancePlugin.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private JClass generateExtends(ClassOutline classOutline,
		Map<String, JClass> knownClasses,
		Map<JClass, CClassInfo> knownClassInfos) {
	final JDefinedClass theClass = classOutline.implClass;
	final CPluginCustomization extendsClassCustomization = CustomizationUtils
			.findCustomization(classOutline,
					Customizations.EXTENDS_ELEMENT_NAME);
	JClass targetClass = generateExtends(theClass,
			extendsClassCustomization, knownClasses);

	final CClassInfo classInfo = classOutline.target;
	if (targetClass != null && classInfo.getBaseClass() == null
			&& classInfo.getRefBaseClass() == null) {
		final CClassInfo targetClassInfo = knownClassInfos.get(targetClass);
		if (targetClassInfo == null && classInfo.getRefBaseClass() == null) {
			final Model model = classInfo.model;
			// BIEnum as BIClass is protected too much
			final BIEnum decl = new BIEnum();
			decl.ref = targetClass.fullName();
			final CClassRef baseClass = new CClassRef(model,
					classInfo.getSchemaComponent(), decl,
					new CCustomizations());
			classInfo.setBaseClass(baseClass);
		} else if (targetClassInfo != null
				&& classInfo.getBaseClass() == null) {
			classInfo.setBaseClass(targetClassInfo);
		}
	}
	return targetClass;
}
 
Example 9
Source File: CTypeInfoUtils.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CTypeInfo getSuperType(CTypeInfo type) {
	if (type instanceof CClassInfo) {
		final CClassInfo classInfo = (CClassInfo) type;
		if (classInfo.getBaseClass() != null) {
			return classInfo.getBaseClass();
		} else if (classInfo.getRefBaseClass() != null) {
			return classInfo.getRefBaseClass();
		} else {
			return null;
		}
	} else {
		return null;
	}
}
 
Example 10
Source File: DefaultProcessModel.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void orderClassInfo(CClassInfo classInfo,
		List<CClassInfo> orderedClassInfos, Set<CClassInfo> addedClassInfos) {
	if (!addedClassInfos.contains(classInfo)) {
		if (classInfo.getBaseClass() != null) {
			orderClassInfo(classInfo.getBaseClass(), orderedClassInfos,
					addedClassInfos);
		}
		orderedClassInfos.add(classInfo);
		addedClassInfos.add(classInfo);
	}
}