Skip to content

Commit

Permalink
Clarifies some javadoc in Rule and AttributeContainer.
Browse files Browse the repository at this point in the history
--
PiperOrigin-RevId: 150675067
MOS_MIGRATED_REVID=150675067
  • Loading branch information
ahumesky authored and hermione521 committed Mar 21, 2017
1 parent 5cb6554 commit 7eaed58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ public Object getAttr(String attrName) {
}

/**
* Returns true iff the given attribute exists for this rule and its value
* is explicitly set in the BUILD file (as opposed to its default value).
* {@see #isAttributeValueExplicitlySpecified(String)}
*/
public boolean isAttributeValueExplicitlySpecified(Attribute attribute) {
return isAttributeValueExplicitlySpecified(attribute.getName());
}

/**
* Returns true iff the value of the specified attribute is explicitly set in the BUILD file.
* This returns true also if the value explicity specified in the BUILD file is the same as the
* attribute's default value. In addition, this method return false if the rule has no attribute
* with the given name.
*/
public boolean isAttributeValueExplicitlySpecified(String attributeName) {
Integer idx = ruleClass.getAttributeIndex(attributeName);
return idx != null && getExplicit(idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,18 @@ public boolean isAttrDefined(String attrName, Type<?> type) {
return ruleClass.hasAttr(attrName, type);
}

/**
* {@see #isAttributeValueExplicitlySpecified(String)}
*/
@Override
public boolean isAttributeValueExplicitlySpecified(Attribute attribute) {
return attributes.isAttributeValueExplicitlySpecified(attribute);
}

/**
* Returns true iff the value of the specified attribute is explicitly set in the BUILD file (as
* opposed to its default value). This also returns true if the value from the BUILD file is the
* same as the default value. In addition, this method return false if the rule has no attribute
* Returns true iff the value of the specified attribute is explicitly set in the BUILD file.
* This returns true also if the value explicity specified in the BUILD file is the same as the
* attribute's default value. In addition, this method return false if the rule has no attribute
* with the given name.
*/
public boolean isAttributeValueExplicitlySpecified(String attrName) {
Expand Down

0 comments on commit 7eaed58

Please sign in to comment.