子任务管理器

This commit is contained in:
AriaLyy
2017-09-05 18:03:48 +08:00
parent 3b30d31b8e
commit ac99cc581f
33 changed files with 722 additions and 149 deletions

View File

@@ -25,75 +25,134 @@ import java.lang.annotation.Target;
* Aria下载事件被注解的方法中参数仅能有一个参数类型为{@link com.arialyy.aria.core.download.DownloadGroupTask}
* <pre>
* <code>
* {@literal @}Download.onPre(groupName)
* {@literal @}DownloadGroup.onPre(groupName)
* protected void onPre(DownloadGroupTask task) {
* }
* </code>
* </pre>
* {@literal @}Download.onPre("myGroupName")如果你的注解中增加了url描述
* 则表示,所有下载任务中,只有下载地址为"myGroupName"的任务才能回调该注解的方法。
*
*
* 如果希望获取子任务的状态可以使用onSub..类的注解
* <pre>
* <code>
* {@literal @}DownloadGroup.onSubPre(groupName)
* protected void onPre(DownloadGroupTask task, String url) {
* }
* </code>
* </pre>
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) public @interface DownloadGroup {
/**
* 如果你在方法中添加{@code @Download.onPre}注解在预处理完成时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onPre}注解在预处理完成时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onPre {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskPre}注解在任务预处理完成时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskPre}注解在任务预处理完成时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskPre {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskResume}注解在任务恢复下载时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskResume}注解在任务恢复下载时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskResume {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskStart}注解在任务开始下载时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskStart}注解在任务开始下载时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskStart {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskStop}注解在任务停止时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskStop}注解在任务停止时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskStop {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskCancel}l注解在任务取消时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskCancel}l注解在任务取消时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskCancel {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskFail)注解在任务预失败时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskFail)注解在任务预失败时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskFail {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskComplete}注解在任务完成时Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskComplete}注解在任务完成时Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskComplete {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 如果你在方法中添加{@code @Download.onTaskRunning}注解在任务正在下载Aria会调用该方法
* 如果你在方法中添加{@code @DownloadGroup.onTaskRunning}注解在任务正在下载Aria会调用该方法
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onTaskRunning {
String[] value() default { AriaConstance.NO_URL };
}
/**
* 任务组子任务预处理的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskPre {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务开始的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskStart {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务停止的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskStop {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务删除的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskCancel {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务失败的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskFail {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务完成的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskComplete {
String value() default AriaConstance.NO_URL;
}
/**
* 任务组子任务正在执行的注解
*/
@Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) @interface onSubTaskRunning {
String value() default AriaConstance.NO_URL;
}
}