Java Code Examples for com.sun.tools.xjc.model.CPluginCustomization#markAsAcknowledged()

The following examples show how to use com.sun.tools.xjc.model.CPluginCustomization#markAsAcknowledged() . 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: EjbPlugin.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void checkCustomizations(CClassInfo customizable) {

		for (final CPluginCustomization pluginCustomization : CustomizationUtils
				.getCustomizations(customizable)) {
			final Element element = pluginCustomization.element;

			if (!pluginCustomization.isAcknowledged()
			// && Customizations.NAMESPACE_URI.equals(element
			// .getNamespaceURI())
			) {
				logger.warn("Unacknowledged customization [" +

				getName(element) + "] in the class [" + customizable.getName()
						+ "].");

				pluginCustomization.markAsAcknowledged();

			}
		}

	}
 
Example 2
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static List<CPluginCustomization> findPropertyCustomizationsInProperty(CPropertyInfo propertyInfo,
		QName name) {

	final List<CPluginCustomization> foundPropertyCustomizations = new LinkedList<CPluginCustomization>();

	final List<CPluginCustomization> propertyCustomizations = CustomizationUtils.getCustomizations(propertyInfo);

	for (CPluginCustomization propertyCustomization : propertyCustomizations) {
		if (fixNull(propertyCustomization.element.getNamespaceURI()).equals(name.getNamespaceURI())
				&& fixNull(propertyCustomization.element.getLocalName()).equals(name.getLocalPart())) {
			propertyCustomization.markAsAcknowledged();
			foundPropertyCustomizations.add(propertyCustomization);
		}
	}
	return foundPropertyCustomizations;
}
 
Example 3
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static List<CPluginCustomization> findCustomizations(CEnumLeafInfo enumInfo, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(enumInfo);

	final List<CPluginCustomization> pluginCustomizations = new LinkedList<CPluginCustomization>();

	for (CPluginCustomization pluginCustomization : customizations) {
		if (fixNull(pluginCustomization.element.getNamespaceURI()).equals(name.getNamespaceURI())
				&& fixNull(pluginCustomization.element.getLocalName()).equals(name.getLocalPart())) {
			pluginCustomization.markAsAcknowledged();
			pluginCustomizations.add(pluginCustomization);
		}
	}

	return pluginCustomizations;
}
 
Example 4
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(FieldOutline fieldOutline, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(fieldOutline);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 5
Source File: Customizations.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization createCustomization$Generated() {

		final CPluginCustomization customization = CustomizationUtils
				.createCustomization(GENERATED_ELEMENT_NAME);
		customization.markAsAcknowledged();
		return customization;
	}
 
Example 6
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, QName name) {
	final CPluginCustomization customization = findCustomization(enumLeafInfo, name);
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization != null;
}
 
Example 7
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(CElementInfo elementInfo, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(elementInfo);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 8
Source File: Customizations.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void markAsAcknowledged(
		final CPluginCustomization customization) {

	if (customization != null
			&& NAMESPACE_URI
					.equals(customization.element.getNamespaceURI())) {
		customization.markAsAcknowledged();

	}
}
 
Example 9
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(CClassInfo classInfo, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(classInfo);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 10
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(Model model, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(model);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 11
Source File: Customizations.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization createCustomization$Ignored() {

		final CPluginCustomization customization = CustomizationUtils
				.createCustomization(Customizations.IGNORED_ELEMENT_NAME);
		customization.markAsAcknowledged();
		return customization;
	}
 
Example 12
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static List<CPluginCustomization> findCustomizations(CClassInfo classInfo, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(classInfo);

	final List<CPluginCustomization> pluginCustomizations = new LinkedList<CPluginCustomization>();

	for (CPluginCustomization pluginCustomization : customizations) {
		if (fixNull(pluginCustomization.element.getNamespaceURI()).equals(name.getNamespaceURI())
				&& fixNull(pluginCustomization.element.getLocalName()).equals(name.getLocalPart())) {
			pluginCustomization.markAsAcknowledged();
			pluginCustomizations.add(pluginCustomization);
		}
	}

	return pluginCustomizations;
}
 
Example 13
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(ElementOutline elementOutline, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(elementOutline);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 14
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(EnumOutline classOutline, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(classOutline);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 15
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static CPluginCustomization findCustomization(Outline outline, QName name) {
	final CCustomizations customizations = CustomizationUtils.getCustomizations(outline);
	final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization;
}
 
Example 16
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean containsCustomization(CClassInfo classInfo, QName name) {
	final CPluginCustomization customization = findCustomization(classInfo, name);
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization != null;
}
 
Example 17
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean containsCustomization(EnumOutline enumOutline, QName name) {
	final CPluginCustomization customization = findCustomization(enumOutline, name);
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization != null;
}
 
Example 18
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean containsCustomization(ClassOutline classOutline, QName name) {
	final CPluginCustomization customization = findCustomization(classOutline, name);
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization != null;
}
 
Example 19
Source File: CustomizationUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean containsCustomization(Model model, QName name) {
	final CPluginCustomization customization = findCustomization(model, name);
	if (customization != null) {
		customization.markAsAcknowledged();
	}
	return customization != null;
}
 
Example 20
Source File: AnnotatePlugin.java    From jpmml-model with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean run(Outline outline, Options options, ErrorHandler errorHandler){
	JCodeModel codeModel = outline.getCodeModel();

	Collection<? extends ClassOutline> classOutlines = outline.getClasses();
	for(ClassOutline classOutline : classOutlines){
		JDefinedClass beanClazz = classOutline.implClass;

		CPluginCustomization classCustomization = CustomizationUtils.findCustomization(classOutline, AnnotatePlugin.ANNOTATE_CLASS_QNAME);
		if(classCustomization != null){
			annotate(codeModel, beanClazz, classCustomization);
		}

		Map<String, JFieldVar> fieldVars = beanClazz.fields();

		FieldOutline[] fieldOutlines = classOutline.getDeclaredFields();
		for(FieldOutline fieldOutline : fieldOutlines){
			CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();

			List<CPluginCustomization> propertyCustomizations = CustomizationUtils.findPropertyCustomizationsInProperty(propertyInfo, AnnotatePlugin.ANNOTATE_PROPERTY_QNAME);
			for(CPluginCustomization propertyCustomization : propertyCustomizations){
				JFieldVar fieldVar = fieldVars.get(propertyInfo.getName(false));

				annotate(codeModel, fieldVar, propertyCustomization);
			}
		}
	}

	Collection<? extends EnumOutline> enumOutlines = outline.getEnums();
	for(EnumOutline enumOutline : enumOutlines){
		JDefinedClass clazz = enumOutline.clazz;

		CPluginCustomization enumCustomization = CustomizationUtils.findCustomization(enumOutline, AnnotatePlugin.ANNOTATE_ENUM_QNAME);
		if(enumCustomization != null){
			annotate(codeModel, clazz, enumCustomization);
		}

		List<EnumConstantOutline> enumConstantOutlines = enumOutline.constants;
		for(EnumConstantOutline enumConstantOutline : enumConstantOutlines){
			CCustomizations enumConstantCustomizations = enumConstantOutline.target.getCustomizations();

			for(CPluginCustomization enumConstantCustomization : enumConstantCustomizations){
				Element element = enumConstantCustomization.element;

				if((AnnotatePlugin.ANNOTATE_ENUM_CONSTANT_QNAME.getNamespaceURI()).equals(element.getNamespaceURI()) && (AnnotatePlugin.ANNOTATE_ENUM_CONSTANT_QNAME.getLocalPart()).equals(element.getLocalName())){
					annotate(codeModel, enumConstantOutline.constRef, enumConstantCustomization);

					enumConstantCustomization.markAsAcknowledged();
				}
			}
		}
	}

	return true;
}