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

jadex.xml.AttributeInfo Maven / Gradle / Ivy

Go to download

Jadex XML is an XML data binding framework for Java and also for other representations. The main idea of Jadex XML is that neither the XML-Schema on the one side nor the Java classes on the other side should define other binding. Instead, a separate mapping between both is used as a mediation. This allows designing the XML representation independent of the Java side but still being able to connect both as desired. This idea was first put forward by the JiBX data binding framework. Jadex XML pushes it further by combining it with the configuration by exception principle. The framework can detect obvious correspondences between both sides automatically and only needs configuration information when translations are necessary. The configuration information is currently specified directly in form of Java configuration classes.

There is a newer version: 4.0.267
Show newest version
package jadex.xml;

import jadex.xml.stax.QName;

/**
 *  Base class for attribute infos.
 */
public class AttributeInfo
{
	//-------- constants --------
	
	/** Constant for identifying content. */
	public static final String CONTENT = "__content"; 
	
	/** Constant for identifying comment. */
	public static final String COMMENT = "__comment"; 

	/** The value of this attribute is used as id. */
	public static final String ID = "id";

	/** The value of this attribute is used as idref. */
	public static final String IDREF = "idref";
	
	//-------- attributes --------
	
	/** The access info. */
	protected AccessInfo accessinfo;
	
	/** The attribute converter. */
	protected IAttributeConverter converter;
	
	/** Is this attribute used as id or idref. */
	protected String id;
	
	// todo: ?
	/** Flag for writing attribute as tag. */
//	protected boolean writeastag;
	
	//-------- constructors --------
		
	/**
	 *  Create a new attribute info. 
	 */
	public AttributeInfo(AccessInfo accessinfo)
	{
		this(accessinfo, null);
	}
	
	/**
	 *  Create a new attribute info. 
	 */
	public AttributeInfo(AccessInfo accessinfo, IAttributeConverter converter)
	{
		this(accessinfo, converter, null);
	}
	
	/**
	 *  Create a new attribute info. 
	 */
	public AttributeInfo(AccessInfo accessinfo, IAttributeConverter converter, String id)
	{
		this.accessinfo = accessinfo;
		this.converter = converter;
		this.id = id;
	}

	//-------- methods --------
	
	/**
	 *  Get the accessinfo.
	 *  @return The accessinfo.
	 */
	public AccessInfo getAccessInfo()
	{
		return this.accessinfo;
	}
	
	/**
	 *  Get the attributeidentifier.
	 *  @return The attributeidentifier.
	 */
	public Object getAttributeIdentifier()
	{
		return accessinfo.getObjectIdentifier();
	}
	
	/**
	 *  Get the attribute name as path.
	 *  @return The attribute names.
	 */
	public QName[] getXMLAttributeNames()
	{
		return accessinfo.getXmlObjectNames();
	}
	
	/**
	 *  Is ignore read.
	 *  @return True, if should be ignored when reading.
	 */
	public boolean isIgnoreRead()
	{
		return accessinfo.isIgnoreRead();
	}
	
	/**
	 *  Is ignore write.
	 *  @return True, if should be ignored when writing.
	 */
	public boolean isIgnoreWrite()
	{
		return accessinfo.isIgnoreWrite();
	}
	
	/**
	 *  Get the attribute converter.
	 *  @return The converter.
	 */
	public IAttributeConverter getConverter()
	{
		return this.converter;
	}

	/**
	 *  Get the id.
	 *  @return The id.
	 */
	public String getId()
	{
		return id;
	}	

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy