org.nuiton.io.xpp3
Class PropertyMapper

java.lang.Object
  extended by org.nuiton.io.xpp3.PropertyMapper
Direct Known Subclasses:
PropertyMapper.AttributeValueToProperty, PropertyMapper.TagTextContentToProperty

public abstract class PropertyMapper
extends Object

A abstract object to map an xml value (tag or attribute, or esle?) to a pojo property.

Two implementations are given :

There is two convinient factory methods in Xpp3Helper to add some new mappers into a given dictionnary of mappers.

Since:
1.0.3
Author:
tchemit

Nested Class Summary
static class PropertyMapper.AttributeValueToProperty
           
static class PropertyMapper.TagTextContentToProperty
           
 
Field Summary
protected  Class<?> containerType
          the type of the pojo container of the property
protected  PropertyDescriptor descriptor
          the pojo's property descriptor
protected  String name
          name of tag (or attribute to deal with)
protected  boolean onlyOne
          a flag to check to use only once the mapper.
protected  String propertyName
          the pojo's property to set
protected  DataConverter type
          the converter from xml to pojo's property type
 
Constructor Summary
protected PropertyMapper(String tagName, String propertyName, Class<?> containerType, DataConverter type, boolean onlyOne, PropertyDescriptor descriptor)
           
 
Method Summary
 Class<?> getContainerType()
           
protected abstract  Object getDataFromXml(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
           
 PropertyDescriptor getDescriptor()
           
 String getName()
           
 String getPropertyName()
           
 String getTagName()
           
 DataConverter getType()
           
 boolean isOnlyOne()
           
 void setProperty(Object src, org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Set<String> parsed, boolean strict)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected final String name
name of tag (or attribute to deal with)


propertyName

protected final String propertyName
the pojo's property to set


type

protected final DataConverter type
the converter from xml to pojo's property type


containerType

protected final Class<?> containerType
the type of the pojo container of the property


descriptor

protected final PropertyDescriptor descriptor
the pojo's property descriptor


onlyOne

protected final boolean onlyOne
a flag to check to use only once the mapper. (should not be used for attributes implementations).

Constructor Detail

PropertyMapper

protected PropertyMapper(String tagName,
                         String propertyName,
                         Class<?> containerType,
                         DataConverter type,
                         boolean onlyOne,
                         PropertyDescriptor descriptor)
Method Detail

getDataFromXml

protected abstract Object getDataFromXml(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
                                  throws Exception
Throws:
Exception

setProperty

public void setProperty(Object src,
                        org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                        Set<String> parsed,
                        boolean strict)
                 throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
                        IOException
Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException

getDescriptor

public PropertyDescriptor getDescriptor()

isOnlyOne

public boolean isOnlyOne()

getPropertyName

public String getPropertyName()

getTagName

public String getTagName()

getType

public DataConverter getType()

getContainerType

public Class<?> getContainerType()

getName

public String getName()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2010 CodeLutin. All Rights Reserved.