Package org.apache.cxf.aegis.type
Class XMLTypeCreator
java.lang.Object
org.apache.cxf.aegis.type.AbstractTypeCreator
org.apache.cxf.aegis.type.XMLTypeCreator
- All Implemented Interfaces:
TypeCreator
Deduce mapping information from an xml file. The xml file should be in the
same packages as the class, with the name
className.aegis.xml.
For example, given the following service interface:
public Collection getResultsForValues(String id, Collection values); //method 1 public Collection getResultsForValues(int id, Collection values); //method 2 public String getResultForValue(String value); //method 3An example of the type xml is:
<mappings>
<mapping>
<method name="getResultsForValues">
<return-type componentType="com.acme.ResultBean" />
<!-- no need to specify index 0, since it's a String -->
<parameter index="1" componentType="java.lang.String" />
</method>
</mapping>
</mappings>
Note that for values which can be easily deduced (such as the String
parameter, or the second service method) no mapping need be specified in the
xml descriptor, which is why no mapping is specified for method 3.
However, if you have overloaded methods with different semantics, then you
will need to specify enough parameters to disambiguate the method and
uniquely identify it. So in the example above, the mapping specifies will
apply to both method 1 and method 2, since the parameter at index 0 is not
specified.-
Field Summary
Fields inherited from class org.apache.cxf.aegis.type.AbstractTypeCreator
HTTP_CXF_APACHE_ORG_ARRAYS, nextCreator, tm -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateClassInfo(Method m, int index) Retrieve the classInfo for a method.createEnumType(TypeClassInfo info) protected QNamecreateQName(Element e, String value) Creates a QName from a string, such as "ns:Element".protected ElementfindMapping(Type type) findMappings(Type type) protected DocumentgetDocument(Class<?> clazz) protected AegisTypeprotected AegisTypeprotected AegisTypeprotected booleanprotected voidreadMetadata(TypeClassInfo info, Element mapping, Element parameter) protected voidsetType(TypeClassInfo info, Element parameter) Methods inherited from class org.apache.cxf.aegis.type.AbstractTypeCreator
createArrayType, createBasicClassInfo, createClassInfo, createCollectionQName, createCollectionTypeFromGeneric, createHolderType, createMapQName, createMapType, createMapType, createObjectType, createQName, createType, createType, createType, createType, createType, createTypeForClass, createUserType, getConfiguration, getElementName, getParent, getTopCreator, getTypeMapping, isArray, isCollection, isHolder, isMap, setConfiguration, setNextCreator, setParent, setTypeMapping
-
Constructor Details
-
XMLTypeCreator
public XMLTypeCreator()
-
-
Method Details
-
getDocument
-
isEnum
- Overrides:
isEnumin classAbstractTypeCreator
-
createEnumType
- Overrides:
createEnumTypein classAbstractTypeCreator
-
createCollectionType
- Specified by:
createCollectionTypein classAbstractTypeCreator
-
createClassInfo
- Specified by:
createClassInfoin classAbstractTypeCreator
-
findMapping
-
findMappings
-
createDefaultType
- Specified by:
createDefaultTypein classAbstractTypeCreator
-
createClassInfo
Description copied from interface:TypeCreatorRetrieve the classInfo for a method. Needed to get parameters right.- Specified by:
createClassInfoin interfaceTypeCreator- Specified by:
createClassInfoin classAbstractTypeCreator- Parameters:
m- Method objectindex- index in the parameter list- Returns:
- info
-
readMetadata
-
getOrCreateGenericType
- Overrides:
getOrCreateGenericTypein classAbstractTypeCreator
-
getOrCreateMapKeyType
- Overrides:
getOrCreateMapKeyTypein classAbstractTypeCreator
-
getOrCreateMapValueType
- Overrides:
getOrCreateMapValueTypein classAbstractTypeCreator
-
setType
-
createQName
Creates a QName from a string, such as "ns:Element".
-