diff options
author | Tor Norbye <tnorbye@google.com> | 2011-12-05 18:02:53 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2011-12-05 20:56:05 -0800 |
commit | 3db9393ba06bbf70fa7b4a6db1ef60396979a1d4 (patch) | |
tree | 5608ff10af365e84483f3cdb6477b3973e3de512 /rule_api/src/com/android/ide | |
parent | faab5914e7cc5e7f4676202ba589bf08c5ae0e42 (diff) | |
download | sdk-3db9393ba06bbf70fa7b4a6db1ef60396979a1d4.zip sdk-3db9393ba06bbf70fa7b4a6db1ef60396979a1d4.tar.gz sdk-3db9393ba06bbf70fa7b4a6db1ef60396979a1d4.tar.bz2 |
Add the Guava library to the tools
This changeset adds the Guava library to ADT and lint. (It is also a
prerequisite for the Lombok AST library which is added by a later CL.)
This changeset also uses the library in a few simple ways: It replaces
some custom I/O and collections code with calls into the equivalent
Guava methods, and it also adds the @Beta annotation on the various
"API" classes which are not yet stable.
Change-Id: I2f50febfa075c32818404e888578a2e1e447d408
Diffstat (limited to 'rule_api/src/com/android/ide')
23 files changed, 92 insertions, 2 deletions
diff --git a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java index aa0a7fc..e915e2c 100644 --- a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java +++ b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java @@ -15,13 +15,19 @@ */ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** * Default implementation of an {@link IViewRule}. This is a convenience * implementation which makes it easier to supply designtime behavior for a * custom view and just override the methods you are interested in. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class AbstractViewRule implements IViewRule { public boolean onInitialize(String fqcn, IClientRulesEngine engine) { return true; diff --git a/rule_api/src/com/android/ide/common/api/DrawingStyle.java b/rule_api/src/com/android/ide/common/api/DrawingStyle.java index 199608e..0712a21 100644 --- a/rule_api/src/com/android/ide/common/api/DrawingStyle.java +++ b/rule_api/src/com/android/ide/common/api/DrawingStyle.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Drawing styles are used to distinguish the visual appearance of selection, * hovers, anchors, etc. Each style may have different colors, line thickness, @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public enum DrawingStyle { /** * The style used to draw the selected views diff --git a/rule_api/src/com/android/ide/common/api/DropFeedback.java b/rule_api/src/com/android/ide/common/api/DropFeedback.java index 4be9c9e..4a526e5 100755 --- a/rule_api/src/com/android/ide/common/api/DropFeedback.java +++ b/rule_api/src/com/android/ide/common/api/DropFeedback.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Structure returned by onDropEnter/Move and passed to over onDropXyz methods. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class DropFeedback { /** * User data that the rule can use in any way it wants to carry state from one diff --git a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java index da1bc9e..3dcb241 100755 --- a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java +++ b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Information about an attribute as gathered from the attrs.xml file where * the attribute was declared. This must include a format (string, reference, float, etc.), @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IAttributeInfo { /** An attribute format, e.g. string, reference, float, etc. */ diff --git a/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java b/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java index 68d7bac..490ef0c 100755 --- a/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java +++ b/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java @@ -18,6 +18,7 @@ package com.android.ide.common.api; import com.android.annotations.Nullable; +import com.google.common.annotations.Beta; import java.util.Collection; import java.util.Map; @@ -30,6 +31,7 @@ import java.util.Map; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IClientRulesEngine { /** diff --git a/rule_api/src/com/android/ide/common/api/IColor.java b/rule_api/src/com/android/ide/common/api/IColor.java index f75d30a..26122a5 100755 --- a/rule_api/src/com/android/ide/common/api/IColor.java +++ b/rule_api/src/com/android/ide/common/api/IColor.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A color, to be used with {@link IGraphics} draw operations. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IColor { // pass } diff --git a/rule_api/src/com/android/ide/common/api/IDragElement.java b/rule_api/src/com/android/ide/common/api/IDragElement.java index a5e339a..e03b718 100755 --- a/rule_api/src/com/android/ide/common/api/IDragElement.java +++ b/rule_api/src/com/android/ide/common/api/IDragElement.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Represents an XML element with a name, attributes and inner elements. * <p/> @@ -26,6 +28,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IDragElement { /** diff --git a/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java b/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java index 7478f6b..d6e256d 100644 --- a/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java +++ b/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A feedback painter paints drop feedback during a drag & drop operation. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IFeedbackPainter { /** * Paints feedback for the given target node into the given graphics context. diff --git a/rule_api/src/com/android/ide/common/api/IGraphics.java b/rule_api/src/com/android/ide/common/api/IGraphics.java index 0ee2ef2..cb1cac5 100755 --- a/rule_api/src/com/android/ide/common/api/IGraphics.java +++ b/rule_api/src/com/android/ide/common/api/IGraphics.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** @@ -30,6 +32,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IGraphics { /** diff --git a/rule_api/src/com/android/ide/common/api/IMenuCallback.java b/rule_api/src/com/android/ide/common/api/IMenuCallback.java index 80f77b8..6c55222 100644 --- a/rule_api/src/com/android/ide/common/api/IMenuCallback.java +++ b/rule_api/src/com/android/ide/common/api/IMenuCallback.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** @@ -28,6 +30,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IMenuCallback { /** * Performs the actual work promised by the {@link RuleAction}. diff --git a/rule_api/src/com/android/ide/common/api/INode.java b/rule_api/src/com/android/ide/common/api/INode.java index b4cb638..7c60d82 100755 --- a/rule_api/src/com/android/ide/common/api/INode.java +++ b/rule_api/src/com/android/ide/common/api/INode.java @@ -18,6 +18,7 @@ package com.android.ide.common.api; import com.android.ide.common.api.IDragElement.IDragAttribute; +import com.google.common.annotations.Beta; import java.util.List; @@ -39,6 +40,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface INode { /** diff --git a/rule_api/src/com/android/ide/common/api/INodeHandler.java b/rule_api/src/com/android/ide/common/api/INodeHandler.java index e261395..8a9b504 100644 --- a/rule_api/src/com/android/ide/common/api/INodeHandler.java +++ b/rule_api/src/com/android/ide/common/api/INodeHandler.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A node handler is a callback which operates on a Node, such as for example * the implementation of an XML editing operation via @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface INodeHandler { /** * Operates on the given node. diff --git a/rule_api/src/com/android/ide/common/api/IValidator.java b/rule_api/src/com/android/ide/common/api/IValidator.java index 6ef44cd..29f43d5 100644 --- a/rule_api/src/com/android/ide/common/api/IValidator.java +++ b/rule_api/src/com/android/ide/common/api/IValidator.java @@ -16,14 +16,16 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * An IValidator can validate strings and return custom messages if validation * fails. * <p> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> - * </p> */ +@Beta public interface IValidator { /** * Validates the given input string, and return null if the text is valid, diff --git a/rule_api/src/com/android/ide/common/api/IViewMetadata.java b/rule_api/src/com/android/ide/common/api/IViewMetadata.java index 8646764..190a497 100644 --- a/rule_api/src/com/android/ide/common/api/IViewMetadata.java +++ b/rule_api/src/com/android/ide/common/api/IViewMetadata.java @@ -16,13 +16,19 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** * Metadata about a particular view. The metadata for a View can be found by asking the * {@link IClientRulesEngine} for the metadata for a given class via * {@link IClientRulesEngine#getMetadata}. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public interface IViewMetadata { /** * Returns the display name views of this type (a name suitable to display to the diff --git a/rule_api/src/com/android/ide/common/api/InsertType.java b/rule_api/src/com/android/ide/common/api/InsertType.java index 806b2bb..26538ae 100644 --- a/rule_api/src/com/android/ide/common/api/InsertType.java +++ b/rule_api/src/com/android/ide/common/api/InsertType.java @@ -16,10 +16,16 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * An enumerated type of different insertion events, such as an insertion from a * copy/paste operation or as the first half of a move operation. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public enum InsertType { /** The view is newly created (by for example a palette drag) */ CREATE, diff --git a/rule_api/src/com/android/ide/common/api/MarginType.java b/rule_api/src/com/android/ide/common/api/MarginType.java index d3a27a4..188f85c 100644 --- a/rule_api/src/com/android/ide/common/api/MarginType.java +++ b/rule_api/src/com/android/ide/common/api/MarginType.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A {@link MarginType} indicates whether a {@link Segment} corresponds to the visual edge @@ -29,7 +31,11 @@ package com.android.ide.common.api; * will be offset by the margin on the target node. Therefore, we have to add <b>both</b> * edges (the bounds of the target node with and without edges) and check for matches on * each edge depending on the constraint being considered. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public enum MarginType { /** * This margin type is used for nodes that have margins, and this segment includes the diff --git a/rule_api/src/com/android/ide/common/api/Margins.java b/rule_api/src/com/android/ide/common/api/Margins.java index 40f44ce..969d068 100644 --- a/rule_api/src/com/android/ide/common/api/Margins.java +++ b/rule_api/src/com/android/ide/common/api/Margins.java @@ -16,11 +16,17 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Set of margins - distances to outer left, top, right and bottom edges. These objects * can be used for both actual <b>margins</b> as well as insets - and in general any * deltas to the bounds of a rectangle. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class Margins { /** The left margin */ public final int left; diff --git a/rule_api/src/com/android/ide/common/api/Point.java b/rule_api/src/com/android/ide/common/api/Point.java index 67c41d3..199701a 100755 --- a/rule_api/src/com/android/ide/common/api/Point.java +++ b/rule_api/src/com/android/ide/common/api/Point.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Mutable point. @@ -24,6 +26,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class Point { public int x, y; diff --git a/rule_api/src/com/android/ide/common/api/Rect.java b/rule_api/src/com/android/ide/common/api/Rect.java index f3922e2..0ae7a74 100755 --- a/rule_api/src/com/android/ide/common/api/Rect.java +++ b/rule_api/src/com/android/ide/common/api/Rect.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** @@ -30,6 +32,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class Rect { public int x, y, w, h; diff --git a/rule_api/src/com/android/ide/common/api/ResizePolicy.java b/rule_api/src/com/android/ide/common/api/ResizePolicy.java index 05ad81c..3383cd0 100644 --- a/rule_api/src/com/android/ide/common/api/ResizePolicy.java +++ b/rule_api/src/com/android/ide/common/api/ResizePolicy.java @@ -15,10 +15,16 @@ */ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A {@link ResizePolicy} records state for whether a widget is resizable, and if so, in * which directions + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class ResizePolicy { private static final int NONE = 0; private static final int LEFT_EDGE = 1; diff --git a/rule_api/src/com/android/ide/common/api/RuleAction.java b/rule_api/src/com/android/ide/common/api/RuleAction.java index 2ebab36..71a6ac9 100755 --- a/rule_api/src/com/android/ide/common/api/RuleAction.java +++ b/rule_api/src/com/android/ide/common/api/RuleAction.java @@ -17,6 +17,7 @@ package com.android.ide.common.api; import com.android.util.Pair; +import com.google.common.annotations.Beta; import java.net.URL; import java.util.ArrayList; @@ -42,6 +43,7 @@ import java.util.regex.Pattern; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class RuleAction implements Comparable<RuleAction> { /** * Character used to split multiple checked choices. diff --git a/rule_api/src/com/android/ide/common/api/Segment.java b/rule_api/src/com/android/ide/common/api/Segment.java index 9668b54..681fd14 100644 --- a/rule_api/src/com/android/ide/common/api/Segment.java +++ b/rule_api/src/com/android/ide/common/api/Segment.java @@ -16,11 +16,17 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A segment is a straight horizontal or vertical line between two points, typically an * edge of a node but also possibly some internal segment like a baseline or a center * line, and it can be offset by a margin from the node's visible bounds. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class Segment { /** For horizontal lines, the y coordinate; for vertical lines the x */ public final int at; diff --git a/rule_api/src/com/android/ide/common/api/SegmentType.java b/rule_api/src/com/android/ide/common/api/SegmentType.java index a21247d..191d753 100644 --- a/rule_api/src/com/android/ide/common/api/SegmentType.java +++ b/rule_api/src/com/android/ide/common/api/SegmentType.java @@ -16,7 +16,14 @@ package com.android.ide.common.api; -/** A segment type describes the different roles or positions a segment can have in a node */ +import com.google.common.annotations.Beta; + +/** A segment type describes the different roles or positions a segment can have in a node + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public enum SegmentType { LEFT, TOP, RIGHT, BOTTOM, BASELINE, CENTER_VERTICAL, CENTER_HORIZONTAL, UNKNOWN; |