-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tidy up + adds a way to customise component URLs without using a…
… script.
- Loading branch information
1 parent
e12096e
commit 3872cfe
Showing
16 changed files
with
204 additions
and
42 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
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
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
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
17 changes: 17 additions & 0 deletions
17
structurizr-component/src/main/java/com/structurizr/component/url/DefaultUrlStrategy.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.structurizr.component.url; | ||
|
||
import com.structurizr.component.Type; | ||
|
||
public class DefaultUrlStrategy implements UrlStrategy { | ||
|
||
@Override | ||
public String urlOf(Type type) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DefaultUrlStrategy{}"; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
structurizr-component/src/main/java/com/structurizr/component/url/PrefixUrlStrategy.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.structurizr.component.url; | ||
|
||
import com.structurizr.component.Type; | ||
import com.structurizr.util.StringUtils; | ||
|
||
public class PrefixUrlStrategy implements UrlStrategy { | ||
|
||
private final String prefix; | ||
|
||
public PrefixUrlStrategy(String prefix) { | ||
if (StringUtils.isNullOrEmpty(prefix)) { | ||
throw new IllegalArgumentException("A prefix must be supplied"); | ||
} | ||
|
||
if (!prefix.endsWith("/")) { | ||
prefix = prefix + "/"; | ||
} | ||
|
||
this.prefix = prefix; | ||
} | ||
|
||
@Override | ||
public String urlOf(Type type) { | ||
return prefix + type.getSource(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PrefixUrlStrategy{" + | ||
"prefix='" + prefix + '\'' + | ||
'}'; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
structurizr-component/src/main/java/com/structurizr/component/url/UrlStrategy.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.structurizr.component.url; | ||
|
||
import com.structurizr.component.Type; | ||
|
||
public interface UrlStrategy { | ||
|
||
String urlOf(Type type); | ||
|
||
} |
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
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.