No title Revision 393963333639 (Thu Oct 08 2009 at 20:05) - Diff Link to this snippet: https://friendpaste.com/3kAPhCc7987hSLMNaHiS0k Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960public String getRequestString() throws MQException { RequestBuilder req = new RequestBuilder(); req.sessionNumber('0', 3) .version('0', 3) .transaction('X', 4) .language('X', 2) .callersPhoneNumber('0', 16) .customerNumber(' ', 16) .nrUnsuccessfulCalls('0', 3); return req.build();}private class RequestBuilder { private StringBuilder b = new StringBuilder(); public RequestBuilder callersPhoneNumber(char pad, int width) { add(Helper.leftRightFilled(true, getCallersPhoneNumber(), pad, width)); return this; } public RequestBuilder customerNumber(char pad, int width) throws MQException { add(Helper.leftRightFilled(false, dynamicSettingMQ.getCustomerNumber(), pad, width)); return this; } public RequestBuilder language(char pad, int width) throws MQException { add(Helper.leftRightFilled(true, getLanguage(), pad, width)); return this; } public RequestBuilder nrUnsuccessfulCalls(char pad, int width) throws MQException { add(Helper.leftRightFilled(true, dynamicSettingMQ.getNumberOfUnsucceededCalls(), pad, width)); return this; } public RequestBuilder sessionNumber(char pad, int width) throws MQException { add(Helper.leftRightFilled(true, getSessionNumberAndIncreaseIt(), pad, width)); return this; } public RequestBuilder transaction(char pad, int width) throws MQException { add(Helper.leftRightFilled(true, getTransaction(), pad, width)); return this; } public RequestBuilder version(char pad, int width) throws MQException { add(Helper.leftRightFilled(true, getVersion(), pad, width)); return this; } public String build() { return b.toString(); } private void add(String str) { b.append(str); }}