This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
add: JavaDocs for SupposeThread-feature #1121
Merged
WonderCsabo
merged 1 commit into
androidannotations:develop
from
Artyomcool:execution-thread-control-javadocs
Aug 31, 2014
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 39 additions & 1 deletion
40
...idannotations-api/src/main/java/org/androidannotations/annotations/SupposeBackground.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,52 @@ | ||
| package org.androidannotations.annotations; | ||
|
|
||
| import org.androidannotations.api.BackgroundExecutor; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Ensures that the method is called from the background thread with (optionally) restrictions by allowed serials. | ||
| * If it is not called from a supposed background thread, then {@link IllegalStateException} | ||
| * will be thrown (by default). | ||
| * <p/> | ||
| * <blockquote> <b>Example</b> : | ||
| * <p/> | ||
| * <pre> | ||
| * @EBean | ||
| * public class MyBean { | ||
| * | ||
| * @SupposeBackground | ||
| * boolean someMethodThatShouldNotBeCalledFromUiThread() { | ||
| * //if this method will be called from the UI-thread an exception will be thrown | ||
| * } | ||
| * | ||
| * @SupposeBackground(serial = {"serial1", "serial2"}) | ||
| * boolean someMethodThatShouldBeCalledFromSerial1OrSerial2() { | ||
| * //if this method will be called from another thread then a background thread with a | ||
| * //serial "serial1" or "serial2", an exception will be thrown | ||
| * } | ||
| * | ||
| * } | ||
| * </pre> | ||
| * <p/> | ||
| * </blockquote> | ||
| * | ||
| * @see BackgroundExecutor#setWrongThreadListener(BackgroundExecutor.WrongThreadListener) | ||
| * @see BackgroundExecutor#DEFAULT_WRONG_THREAD_LISTENER | ||
| * @see BackgroundExecutor#checkBgThread(String...) | ||
| */ | ||
| @Retention(RetentionPolicy.CLASS) | ||
| @Target(ElementType.METHOD) | ||
| public @interface SupposeBackground { | ||
|
|
||
| String[] serial() default {}; | ||
| /** | ||
| * Allowed serials to restrict a calling thread. If it is an empty list, then any background thread is allowed. | ||
| * | ||
| * @see BackgroundExecutor#checkBgThread(String...) | ||
| */ | ||
| String[] serial() default {}; | ||
|
|
||
| } |
25 changes: 23 additions & 2 deletions
25
...roidannotations-api/src/main/java/org/androidannotations/annotations/SupposeUiThread.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean "but not was called from one".