addConversionHandler(File.class, new FileConverter());
addConversionHandler(Dependency.class, new DependencyIdConverter());
addConversionHandler(URL.class, new URLConverter());
addConversionHandler(JavaResource[].class, javaResourceConversionHandler);
addConversionHandler(JavaResource.class, new ConversionHandler()
{
@Override
public Object convertFrom(final Object obj)
{
JavaResource[] res = (JavaResource[]) javaResourceConversionHandler.convertFrom(obj);
if (res.length > 1)
{
throw new RuntimeException("ambiguous paths");
}
else if (res.length == 0)
{
if (getCurrentProject().hasFacet(JavaSourceFacet.class))
{
JavaSourceFacet java = getCurrentProject().getFacet(JavaSourceFacet.class);
try
{
JavaResource resource = java.getJavaResource(obj.toString());
return resource;
}
catch (FileNotFoundException e)
{
throw new RuntimeException(e);
}
}
return null;
}
else
{
return res[0];
}
}
@Override
@SuppressWarnings("rawtypes")
public boolean canConvertFrom(final Class type)
{
return javaResourceConversionHandler.canConvertFrom(type);
}
});
addConversionHandler(Resource[].class, resourceConversionHandler);
addConversionHandler(Resource.class, new ConversionHandler()
{
@Override
public Object convertFrom(final Object o)
{