Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save some characters #84

Open
flexchecks opened this issue Apr 6, 2015 · 5 comments
Open

Save some characters #84

flexchecks opened this issue Apr 6, 2015 · 5 comments

Comments

@flexchecks
Copy link

First, thank you for posting the Metadata API along with great examples. One issue I had was dealing with the size of the class especially MetadataService. One way to save some space is to only keep the classes and methods that I'll use. But something additional to this is to simplify parts that are repeated often. Particularly, for each _type_info, there is the same URL. A lot of characters can be saved by referencing a static String of the URL instead. For example:

public class MetadataService {
    public static final String SoapUrl = 'http://soap.sforce.com/2006/04/metadata';

    public class listMetadataResponse_element {
        public MetadataService.FileProperties[] result;
            private String[] result_type_info = new String[]{'result',SoapUrl,null,'0','-1','false'};
            private String[] apex_schema_type_info = new String[]{SoapUrl,'true','false'};
        private String[] field_order_type_info = new String[]{'result'};
    } 
    . . .

By referencing SoapUrl, MetadataService went from its initial size of 787,158 characters to 670,588 characters. It was an easy fix to knock the size down by ~15%.

@afawcett
Copy link
Contributor

afawcett commented Apr 7, 2015

Great idea, i'll see about building this into patcher utility.

@rmccu
Copy link

rmccu commented Aug 29, 2017

@afawcett fwiw, the latest version of the patcher utility has this capability. See #186 and #141.

#186 has a comment about how I saved space with the patcher utility.
#141 has my latest version which also includes a fix for the "intermediate" extends class issue.

@afawcett
Copy link
Contributor

Thanks @rmccu, much appreciate your contributions here! 👍

@afawcett
Copy link
Contributor

afawcett commented Dec 4, 2018

@rmccu i was just asked about this issue by someone and this reminded me about your fix. Are you able to create a PR for it? Let me know, if not i can create one.

@rmccu
Copy link

rmccu commented Dec 4, 2018

Hi @afawcett. Yeah, let me make sure it still works with the latest version of the Metadata API real quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants