From 24fed9b1b652344e3e1402eea1471fad6efed919 Mon Sep 17 00:00:00 2001 From: mibo Date: Fri, 10 May 2019 17:59:17 +0200 Subject: [PATCH] [OLINGO-1330] cache name in getName() --- .../core/edm/primitivetype/SingletonPrimitiveType.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/SingletonPrimitiveType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/SingletonPrimitiveType.java index 2071f012d..6d1f6cce8 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/SingletonPrimitiveType.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/SingletonPrimitiveType.java @@ -25,6 +25,8 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; */ public abstract class SingletonPrimitiveType extends AbstractPrimitiveType { + protected String name; + @Override public boolean equals(final Object obj) { return this == obj || obj != null && getClass() == obj.getClass(); @@ -42,7 +44,10 @@ public abstract class SingletonPrimitiveType extends AbstractPrimitiveType { @Override public String getName() { - return getClass().getSimpleName().substring(3); + if(name == null) { + name = getClass().getSimpleName().substring(3); + } + return name; } @Override