-1

String is primitive or not as for Spring and how it treat as primitive or not? please help me?
this is my Code

for (Map.Entry<String, Serializable> entry : request.getProperties()
            .entrySet()) {
        if (ClassUtils.isPrimitiveOrWrapper(entry.getValue().getClass())
                || (entry.getValue().getClass().equals(String.class))) {
            customHeaders.put(entry.getKey(),
                    String.valueOf(entry.getValue()));
        }
    }
prasad paluru
  • 101
  • 3
  • 6
  • 1
    And how does that code relate to the question? – GolezTrol Dec 30 '15 at 06:58
  • in Spring ClassUtils calls is there one of the method is isPrimitiveOrWrapper is checked whether given reference is primitive or wrapper by this case it wont work my condition for example if we take entry.getKay().getClass() it returns String by in this case iam bit confuse so thats why am asking – prasad paluru Dec 30 '15 at 09:03

1 Answers1

0

In java, String is an Object and it is not a primitive.

References: Integer as primitive type

Is String a primitive or an Object in Android or Java?

Community
  • 1
  • 1
Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
  • This should answer what you have mentioned in the title, but for the code part you need to give more input and post your question clearly. – Clement Amarnath Dec 30 '15 at 08:32