{
try
{
CompilerContext cc = (CompilerContext)
ContextService.getContext(CompilerContext.CONTEXT_ID);
ClassFactory classFactory = cc.getClassFactory();
TypeCompilerFactory tcf = cc.getTypeCompilerFactory();
Class<?> derbyAggregatorInterface = classFactory.loadApplicationClass( "org.apache.derby.agg.Aggregator" );
Class<?> userAggregatorClass = classFactory.loadApplicationClass( _alias.getJavaClassName() );
Class[][] typeBounds = classFactory.getClassInspector().getTypeBounds
( derbyAggregatorInterface, userAggregatorClass );
if (
(typeBounds == null) ||
(typeBounds.length != AGGREGATOR_PARAM_COUNT) ||
(typeBounds[ INPUT_TYPE ] == null) ||
(typeBounds[ RETURN_TYPE ] == null)
)
{
throw StandardException.newException
(
SQLState.LANG_ILLEGAL_UDA_CLASS,
_alias.getSchemaName(),
_alias.getName(),
userAggregatorClass.getName()
);
}
Class<?>[] genericParameterTypes =
classFactory.getClassInspector().getGenericParameterTypes(
derbyAggregatorInterface, userAggregatorClass);
if ( genericParameterTypes == null ) {
genericParameterTypes = new Class<?>[ AGGREGATOR_PARAM_COUNT ];
}