All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hisrc.xml.xsom.XSFunctionApplier Maven / Gradle / Ivy

There is a newer version: 2.0.14
Show newest version
package org.hisrc.xml.xsom;

import org.apache.commons.lang3.Validate;

import com.sun.xml.xsom.XSComponent;
import com.sun.xml.xsom.visitor.XSFunction;

public class XSFunctionApplier {

	private XSFunction f;

	public XSFunctionApplier(XSFunction f) {
		this.f = Validate.notNull(f);
	}

	public T apply(Object target) {
		Validate.notNull(target);
		if (target instanceof XSComponent) {
			return ((XSComponent) target).apply(f);
		} else if (target instanceof SchemaComponentAware) {
			final XSComponent schemaComponent = ((SchemaComponentAware) target)
					.getSchemaComponent();
			if (schemaComponent == null) {
				return null;
			} else {
				return schemaComponent.apply(f);
			}
		} else {
			return null;
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy