if (!(dataSchema instanceof TyperefDataSchema))
{
return null;
}
TyperefDataSchema typerefSchema = (TyperefDataSchema)dataSchema;
boolean ok;
DataSchema.Type schemaType = typerefSchema.getDereferencedType();
Class<?>[] validTypes =
RestModelConstants.PRIMITIVE_DATA_SCHEMA_TYPE_ALLOWED_TYPES.get(schemaType);
if (validTypes != null)
{
String javaClassNameFromSchema =
TyperefUtils.getJavaClassNameFromSchema(typerefSchema);
if (javaClassNameFromSchema != null)
{
registerCoercer(typerefSchema);
ok =
type.getName().equals(javaClassNameFromSchema)
|| (type.isArray() && (type.getComponentType().getName()).equals(javaClassNameFromSchema));
}
else
{
ok = checkParameterType(type, validTypes);
}
}
else
{
try
{
DataSchema inferredSchema = DataTemplateUtil.getSchema(type);
DataSchema derefSchema = typerefSchema.getDereferencedDataSchema();
if (inferredSchema.equals(derefSchema))
{
return null;
}
return "typeref " + typerefSchema + " is not compatible with (" + type