dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38523
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19630: minor speed optimization, compile transformer/converter pattern once only
------------------------------------------------------------
revno: 19630
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-07-13 17:49:09 +0700
message:
minor speed optimization, compile transformer/converter pattern once only
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java 2015-05-30 13:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java 2015-07-13 10:49:09 +0000
@@ -317,13 +317,13 @@
_updateFields( fieldMap, klass, false );
}
+ private final Pattern MUTATOR_PATTERN = Pattern.compile( "(\\w+)(?:::(\\w+))?(?:\\|rename\\((\\w+)\\))?" );
+
private void _updateFields( FieldMap fieldMap, Class<?> klass, boolean expandOnly )
{
Schema schema = schemaService.getDynamicSchema( klass );
List<String> cleanupFields = Lists.newArrayList();
- Pattern pattern = Pattern.compile( "(\\w+)(?:::(\\w+))?(?:\\|rename\\((\\w+)\\))?" );
-
for ( String fieldKey : Sets.newHashSet( fieldMap.keySet() ) )
{
if ( "*".equals( fieldKey ) )
@@ -393,7 +393,7 @@
}
else if ( fieldKey.contains( "::" ) || fieldKey.contains( "|rename(" ) )
{
- Matcher matcher = pattern.matcher( fieldKey );
+ Matcher matcher = MUTATOR_PATTERN.matcher( fieldKey );
if ( !matcher.find() )
{