Author: fmeschbe
Date: Mon May 4 07:37:41 2009
New Revision: 771222
URL: http://svn.apache.org/viewvc?rev=771222&view=rev
Log:
Sling Performance enhancements according to FindBug and JavaDoc: Instead
of calling the constructors the valueOf() methods should be called.
Modified:
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
Modified:
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java?rev=771222&r1=771221&r2=771222&view=diff
==============================================================================
---
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
(original)
+++
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Mon May 4 07:37:41 2009
@@ -307,28 +307,28 @@
return (T) jcrValue.getString();
} else if (Byte.class == type) {
- return (T) new Byte((byte) jcrValue.getLong());
+ return (T) Byte.valueOf((byte) jcrValue.getLong());
} else if (Short.class == type) {
- return (T) new Short((short) jcrValue.getLong());
+ return (T) Short.valueOf((short) jcrValue.getLong());
} else if (Integer.class == type) {
- return (T) new Integer((int) jcrValue.getLong());
+ return (T) Integer.valueOf((int) jcrValue.getLong());
} else if (Long.class == type) {
if (jcrValue.getType() == PropertyType.BINARY) {
if (index == -1) {
- return (T) new Long(p.getLength());
+ return (T) Long.valueOf(p.getLength());
}
- return (T) new Long(p.getLengths()[index]);
+ return (T) Long.valueOf(p.getLengths()[index]);
}
- return (T) new Long(jcrValue.getLong());
+ return (T) Long.valueOf(jcrValue.getLong());
} else if (Float.class == type) {
- return (T) new Float(jcrValue.getDouble());
+ return (T) Float.valueOf((float) jcrValue.getDouble());
} else if (Double.class == type) {
- return (T) new Double(jcrValue.getDouble());
+ return (T) Double.valueOf(jcrValue.getDouble());
} else if (Boolean.class == type) {
return (T) Boolean.valueOf(jcrValue.getBoolean());
Modified:
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java?rev=771222&r1=771221&r2=771222&view=diff
==============================================================================
---
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
(original)
+++
incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
Mon May 4 07:37:41 2009
@@ -74,10 +74,10 @@
return (AdapterType) getProperty().getString();
} else if (type == Boolean.class) {
- return (AdapterType) new Boolean(getProperty().getBoolean());
+ return (AdapterType)
Boolean.valueOf(getProperty().getBoolean());
} else if (type == Long.class) {
- return (AdapterType) new Long(getProperty().getLong());
+ return (AdapterType) Long.valueOf(getProperty().getLong());
} else if (type == Double.class) {
return (AdapterType) new Double(getProperty().getDouble());