forked from bluemagicsource/magic-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
317 additions
and
153 deletions.
There are no files selected for viewing
This file contains 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
32 changes: 30 additions & 2 deletions
32
src/main/java/org/bluemagic/config/decorator/tags/Hashtag.java
This file contains 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,9 +1,37 @@ | ||
package org.bluemagic.config.decorator.tags; | ||
|
||
/** | ||
* Implements the common hashtags found on Twitter | ||
* For example #SteveJobs or #test | ||
* | ||
*/ | ||
public class Hashtag extends SingleTag { | ||
|
||
private static final String HASHTAG = "#"; | ||
|
||
public Hashtag() { | ||
this.prefix = HASHTAG; | ||
} | ||
|
||
public Hashtag(String value) { | ||
this.prefix = HASHTAG; | ||
this.value = value; | ||
} | ||
|
||
public Hashtag(String prefix, String value, String suffix) { | ||
|
||
setPrefix(prefix); | ||
this.value = value; | ||
setSuffix(suffix); | ||
} | ||
|
||
@Override | ||
public String getPrefix() { | ||
return "#"; | ||
public void setPrefix(String prefix) { | ||
|
||
if ((prefix != null) && (prefix.startsWith(HASHTAG))) { | ||
this.prefix = prefix; | ||
} else { | ||
this.prefix = HASHTAG + prefix; | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -14,6 +14,6 @@ public String getValue() { | |
throw new RuntimeException(t); | ||
} | ||
} | ||
return value; | ||
return prefix + value + suffix; | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.