public final class PlexusXmlBeanConverter extends java.lang.Object implements PlexusBeanConverter
PlexusBeanConverter Module that converts Plexus XML configuration into beans.| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CONVERSION_ERROR |
private java.util.Collection<com.google.inject.spi.TypeConverterBinding> |
typeConverterBindings |
| Constructor and Description |
|---|
PlexusXmlBeanConverter(com.google.inject.Injector injector) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
convert(com.google.inject.TypeLiteral role,
java.lang.String value)
Converts the given constant value to a bean of the given type.
|
private java.lang.Object |
convertText(java.lang.String value,
com.google.inject.TypeLiteral<?> toType)
Converts the given string to the target type, using
TypeConverters registered with the Injector. |
private static java.lang.Class<?> |
loadImplementation(java.lang.String name,
java.lang.Class<?> defaultClazz)
Attempts to load the named implementation, uses default implementation if no name is given.
|
private static <T> T |
newImplementation(java.lang.Class<T> clazz)
Creates an instance of the given implementation using the default constructor.
|
private static <T> T |
newImplementation(java.lang.Class<T> clazz,
java.lang.String value)
Creates an instance of the given implementation using the given string, assumes a public string constructor.
|
private static <T> T |
newImplementation(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
java.lang.Class<T> defaultClazz)
Creates an instance of the implementation named in the current XML element, or the default if no name is given.
|
private java.lang.Object |
parse(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
Parses a sequence of XML elements and converts them to the given target type.
|
private java.lang.Object |
parseArray(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
Parses a sequence of XML elements and converts them to the appropriate array type.
|
private java.lang.Object |
parseBean(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType,
java.lang.Class<?> rawType)
Parses a sequence of XML elements and converts them to the appropriate bean type.
|
private java.util.Collection<java.lang.Object> |
parseCollection(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
Parses a sequence of XML elements and converts them to the appropriate
Collection type. |
private static java.lang.String |
parseImplementation(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
Parses an XML element looking for the name of a custom implementation.
|
private java.util.Map<java.lang.String,java.lang.Object> |
parseMap(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
Parses a sequence of XML elements and converts them to the appropriate
Map type. |
private static java.util.Properties |
parseProperties(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
Parses a sequence of XML elements and converts them to the appropriate
Properties type. |
private static org.codehaus.plexus.util.xml.Xpp3Dom |
parseXpp3Dom(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
Parses an XML subtree and converts it to the
Xpp3Dom type. |
private static final java.lang.String CONVERSION_ERROR
private final java.util.Collection<com.google.inject.spi.TypeConverterBinding> typeConverterBindings
@Inject PlexusXmlBeanConverter(com.google.inject.Injector injector)
public java.lang.Object convert(com.google.inject.TypeLiteral role,
java.lang.String value)
PlexusBeanConverterconvert in interface PlexusBeanConverterrole - The expected bean typevalue - The constant valueprivate java.lang.Object parse(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
throws java.lang.Exception
parser - The XML parsertoType - The target typejava.lang.Exceptionprivate static org.codehaus.plexus.util.xml.Xpp3Dom parseXpp3Dom(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
throws java.lang.Exception
Xpp3Dom type.parser - The XML parserjava.lang.Exceptionprivate static java.util.Properties parseProperties(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
throws java.lang.Exception
Properties type.parser - The XML parserjava.lang.Exceptionprivate java.util.Map<java.lang.String,java.lang.Object> parseMap(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
throws java.lang.Exception
Map type.parser - The XML parserjava.lang.Exceptionprivate java.util.Collection<java.lang.Object> parseCollection(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
throws java.lang.Exception
Collection type.parser - The XML parserjava.lang.Exceptionprivate java.lang.Object parseArray(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType)
throws java.lang.Exception
parser - The XML parserjava.lang.Exceptionprivate java.lang.Object parseBean(org.codehaus.plexus.util.xml.pull.MXParser parser,
com.google.inject.TypeLiteral<?> toType,
java.lang.Class<?> rawType)
throws java.lang.Exception
parser - The XML parserjava.lang.Exceptionprivate static java.lang.String parseImplementation(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
parser - The XML parsernullprivate static java.lang.Class<?> loadImplementation(java.lang.String name,
java.lang.Class<?> defaultClazz)
name - The optional implementation namedefaultClazz - The default implementation typeprivate static <T> T newImplementation(java.lang.Class<T> clazz)
clazz - The implementation typeprivate static <T> T newImplementation(java.lang.Class<T> clazz,
java.lang.String value)
clazz - The implementation typevalue - The string argumentprivate static <T> T newImplementation(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
java.lang.Class<T> defaultClazz)
parser - The XML parserdefaultClazz - The default implementation typeprivate java.lang.Object convertText(java.lang.String value,
com.google.inject.TypeLiteral<?> toType)
TypeConverters registered with the Injector.value - The string valuetoType - The target type