Skip to content

Commit 43ffb67

Browse files
committed
enhance the condition interface a bit to no longer need to cast in HtmlUnit
1 parent fa37068 commit 43ffb67

13 files changed

+69
-28
lines changed

src/main/java/com/gargoylesoftware/css/parser/condition/AttributeCondition.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,18 @@ public ConditionType getConditionType() {
4242
}
4343

4444
/**
45-
* @return the local name
45+
* {@inheritDoc}
4646
*/
47+
@Override
4748
public String getLocalName() {
4849
return localName_;
4950
}
5051

52+
5153
/**
52-
* @return the value
54+
* {@inheritDoc}
5355
*/
56+
@Override
5457
public String getValue() {
5558
return value_;
5659
}

src/main/java/com/gargoylesoftware/css/parser/condition/BeginHyphenAttributeCondition.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ public ConditionType getConditionType() {
4242
}
4343

4444
/**
45-
* @return the local name
45+
* {@inheritDoc}
4646
*/
47+
@Override
4748
public String getLocalName() {
4849
return localName_;
4950
}
5051

5152
/**
52-
* @return the value
53+
* {@inheritDoc}
5354
*/
55+
@Override
5456
public String getValue() {
5557
return value_;
5658
}

src/main/java/com/gargoylesoftware/css/parser/condition/ClassCondition.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ public ConditionType getConditionType() {
4343
}
4444

4545
/**
46-
* @return the local name
46+
* {@inheritDoc}
4747
*/
48+
@Override
4849
public String getLocalName() {
4950
return null;
5051
}
5152

5253
/**
53-
* @return the value
54+
* {@inheritDoc}
5455
*/
56+
@Override
5557
public String getValue() {
5658
return value_;
5759
}

src/main/java/com/gargoylesoftware/css/parser/condition/Condition.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,14 @@ enum ConditionType {
4141
* @return the associated condition type
4242
*/
4343
ConditionType getConditionType();
44+
45+
/**
46+
* @return the value
47+
*/
48+
public String getValue();
49+
50+
/**
51+
* @return the local name
52+
*/
53+
public String getLocalName();
4454
}

src/main/java/com/gargoylesoftware/css/parser/condition/IdCondition.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,26 @@ public IdCondition(final String value, final Locator locator) {
3636
setLocator(locator);
3737
}
3838

39+
/**
40+
* {@inheritDoc}
41+
*/
3942
@Override
4043
public ConditionType getConditionType() {
4144
return ConditionType.ID_CONDITION;
4245
}
4346

4447
/**
45-
* @return the local name
48+
* {@inheritDoc}
4649
*/
50+
@Override
4751
public String getLocalName() {
4852
return null;
4953
}
5054

5155
/**
52-
* @return the value
56+
* {@inheritDoc}
5357
*/
58+
@Override
5459
public String getValue() {
5560
return value_;
5661
}

src/main/java/com/gargoylesoftware/css/parser/condition/LangCondition.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,19 @@ public ConditionType getConditionType() {
4242
return ConditionType.LANG_CONDITION;
4343
}
4444

45+
/**
46+
* {@inheritDoc}
47+
*/
48+
@Override
49+
public String getLocalName() {
50+
return null;
51+
}
52+
4553
/**
4654
* @return the language
4755
*/
48-
public String getLang() {
56+
@Override
57+
public String getValue() {
4958
return lang_;
5059
}
5160

@@ -54,7 +63,7 @@ public String toString() {
5463
final StringBuilder result = new StringBuilder();
5564
result.append(":lang(");
5665

57-
final String lang = getLang();
66+
final String lang = getValue();
5867
if (null != lang) {
5968
result.append(lang);
6069
}

src/main/java/com/gargoylesoftware/css/parser/condition/OneOfAttributeCondition.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class OneOfAttributeCondition extends AbstractLocatable implements Condit
2828

2929
/**
3030
* Ctor.
31-
* @param localName the local value
31+
* @param localName the local name
3232
* @param value the value
3333
*/
3434
public OneOfAttributeCondition(final String localName, final String value) {
@@ -42,15 +42,17 @@ public ConditionType getConditionType() {
4242
}
4343

4444
/**
45-
* @return the local name
45+
* {@inheritDoc}
4646
*/
47+
@Override
4748
public String getLocalName() {
4849
return localName_;
4950
}
5051

5152
/**
52-
* @return the value
53+
* {@inheritDoc}
5354
*/
55+
@Override
5456
public String getValue() {
5557
return value_;
5658
}

src/main/java/com/gargoylesoftware/css/parser/condition/PrefixAttributeCondition.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ public ConditionType getConditionType() {
4242
}
4343

4444
/**
45-
* @return the local name
45+
* {@inheritDoc}
4646
*/
47+
@Override
4748
public String getLocalName() {
4849
return localName_;
4950
}
5051

5152
/**
52-
* @return the value
53+
* {@inheritDoc}
5354
*/
55+
@Override
5456
public String getValue() {
5557
return value_;
5658
}

src/main/java/com/gargoylesoftware/css/parser/condition/PseudoClassCondition.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ public ConditionType getConditionType() {
4646
}
4747

4848
/**
49-
* @return the local name
49+
* {@inheritDoc}
5050
*/
51+
@Override
5152
public String getLocalName() {
5253
return null;
5354
}
5455

5556
/**
56-
* @return the value
57+
* {@inheritDoc}
5758
*/
59+
@Override
5860
public String getValue() {
5961
return value_;
6062
}

src/main/java/com/gargoylesoftware/css/parser/condition/SubstringAttributeCondition.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ public ConditionType getConditionType() {
4242
}
4343

4444
/**
45-
* @return the local name
45+
* {@inheritDoc}
4646
*/
47+
@Override
4748
public String getLocalName() {
4849
return localName_;
4950
}
5051

5152
/**
52-
* @return the value
53+
* {@inheritDoc}
5354
*/
55+
@Override
5456
public String getValue() {
5557
return value_;
5658
}

0 commit comments

Comments
 (0)