[New] String interning of some fields
This commit is contained in:
parent
2e2bf893b2
commit
418a8d0c7a
|
@ -30,7 +30,6 @@ import java.util.stream.Stream;
|
||||||
import li.strolch.exception.StrolchException;
|
import li.strolch.exception.StrolchException;
|
||||||
import li.strolch.exception.StrolchModelException;
|
import li.strolch.exception.StrolchModelException;
|
||||||
import li.strolch.model.parameter.Parameter;
|
import li.strolch.model.parameter.Parameter;
|
||||||
import li.strolch.model.parameter.StringParameter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
@ -81,7 +80,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
||||||
throw new StrolchException(msg);
|
throw new StrolchException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.type = type;
|
this.type = type.intern();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,6 +18,7 @@ package li.strolch.model.activity;
|
||||||
|
|
||||||
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
|
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
|
||||||
import static li.strolch.utils.helper.StringHelper.isNotEmpty;
|
import static li.strolch.utils.helper.StringHelper.isNotEmpty;
|
||||||
|
import static li.strolch.utils.helper.StringHelper.trimOrEmpty;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -67,7 +68,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
||||||
public Action(String id, String name, String type, String resourceId, String resourceType) {
|
public Action(String id, String name, String type, String resourceId, String resourceType) {
|
||||||
super(id, name, type);
|
super(id, name, type);
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
this.resourceType = resourceType;
|
this.resourceType = trimOrEmpty(resourceType).intern();
|
||||||
this.state = State.CREATED;
|
this.state = State.CREATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ package li.strolch.model.parameter;
|
||||||
|
|
||||||
import static li.strolch.model.StrolchModelConstants.INTERPRETATION_NONE;
|
import static li.strolch.model.StrolchModelConstants.INTERPRETATION_NONE;
|
||||||
import static li.strolch.model.StrolchModelConstants.UOM_NONE;
|
import static li.strolch.model.StrolchModelConstants.UOM_NONE;
|
||||||
|
import static li.strolch.utils.helper.StringHelper.trimOrEmpty;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
||||||
* the name
|
* the name
|
||||||
*/
|
*/
|
||||||
public AbstractParameter(String id, String name) {
|
public AbstractParameter(String id, String name) {
|
||||||
super(id, name);
|
super(trimOrEmpty(id).intern(), trimOrEmpty(name).intern());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,7 +84,7 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
||||||
if (StringHelper.isEmpty(interpretation)) {
|
if (StringHelper.isEmpty(interpretation)) {
|
||||||
this.interpretation = INTERPRETATION_NONE;
|
this.interpretation = INTERPRETATION_NONE;
|
||||||
} else {
|
} else {
|
||||||
this.interpretation = interpretation;
|
this.interpretation = interpretation.intern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
||||||
if (StringHelper.isEmpty(uom)) {
|
if (StringHelper.isEmpty(uom)) {
|
||||||
this.uom = UOM_NONE;
|
this.uom = UOM_NONE;
|
||||||
} else {
|
} else {
|
||||||
this.uom = uom;
|
this.uom = uom.intern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ public abstract class PolicyDef {
|
||||||
*/
|
*/
|
||||||
public PolicyDef(String type, String value) {
|
public PolicyDef(String type, String value) {
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
this.type = type.intern();
|
||||||
this.value = value;
|
this.value = value.intern();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,6 +17,7 @@ package li.strolch.model.timedstate;
|
||||||
|
|
||||||
import static li.strolch.model.StrolchModelConstants.INTERPRETATION_NONE;
|
import static li.strolch.model.StrolchModelConstants.INTERPRETATION_NONE;
|
||||||
import static li.strolch.model.StrolchModelConstants.UOM_NONE;
|
import static li.strolch.model.StrolchModelConstants.UOM_NONE;
|
||||||
|
import static li.strolch.utils.helper.StringHelper.trimOrEmpty;
|
||||||
|
|
||||||
import li.strolch.model.*;
|
import li.strolch.model.*;
|
||||||
import li.strolch.model.Locator.LocatorBuilder;
|
import li.strolch.model.Locator.LocatorBuilder;
|
||||||
|
@ -48,7 +49,7 @@ public abstract class AbstractStrolchTimedState<T extends IValue> extends Abstra
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractStrolchTimedState(String id, String name) {
|
public AbstractStrolchTimedState(String id, String name) {
|
||||||
super(id, name);
|
super(trimOrEmpty(id).intern(), trimOrEmpty(name).intern());
|
||||||
this.state = new TimedState<>();
|
this.state = new TimedState<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ public abstract class AbstractStrolchTimedState<T extends IValue> extends Abstra
|
||||||
if (StringHelper.isEmpty(interpretation)) {
|
if (StringHelper.isEmpty(interpretation)) {
|
||||||
this.interpretation = INTERPRETATION_NONE;
|
this.interpretation = INTERPRETATION_NONE;
|
||||||
} else {
|
} else {
|
||||||
this.interpretation = interpretation;
|
this.interpretation = interpretation.intern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public abstract class AbstractStrolchTimedState<T extends IValue> extends Abstra
|
||||||
if (StringHelper.isEmpty(uom)) {
|
if (StringHelper.isEmpty(uom)) {
|
||||||
this.uom = UOM_NONE;
|
this.uom = UOM_NONE;
|
||||||
} else {
|
} else {
|
||||||
this.uom = uom;
|
this.uom = uom.intern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue