Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#318 return an immutable map in all implementations of PropertyHolder #320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.structurizr.configuration.WorkspaceConfiguration;

import java.lang.reflect.Constructor;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -237,7 +238,7 @@ public void clearConfiguration() {
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ public void setImpliedRelationshipsStrategy(ImpliedRelationshipsStrategy implied
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void setUrl(String url) {
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.structurizr.PropertyHolder;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -15,7 +16,7 @@ public abstract class AbstractStyle implements PropertyHolder {
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.structurizr.PropertyHolder;
import com.structurizr.util.Url;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* Configuration associated with how information in the workspace is rendered.
Expand Down Expand Up @@ -203,7 +200,7 @@ public void setViewSortOrder(ViewSortOrder viewSortOrder) {
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.structurizr.PropertyHolder;

import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -133,7 +134,7 @@ public ViewSet getViewSet() {
* @return a Map (String, String) (empty if there are no properties)
*/
public Map<String, String> getProperties() {
return new HashMap<>(properties);
return Collections.unmodifiableMap(properties);
}

/**
Expand Down
Loading