Skip to content

Commit c0fc248

Browse files
authored
Updated ComparableType class (#190)
- Concrete generics - added javadoc - added null-check Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
1 parent 4b28446 commit c0fc248

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/org/apache/xml/security/stax/ext/ComparableType.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@
1818
*/
1919
package org.apache.xml.security.stax.ext;
2020

21+
import java.util.Objects;
2122

2223
/**
24+
* Two comparable types are compared by their name.
25+
*
26+
* @param <T> Compatible class type.
2327
*/
24-
public abstract class ComparableType<T extends ComparableType> implements Comparable<T> {
28+
public abstract class ComparableType<T extends ComparableType<T>> implements Comparable<T> {
2529

26-
private String name;
30+
private final String name;
2731

2832
public ComparableType(String name) {
29-
this.name = name;
33+
this.name = Objects.requireNonNull(name, "name");
3034
}
3135

3236
public String getName() {

0 commit comments

Comments
 (0)