@Override public synchronized void init() { filterText(); partial = df.compilePartial(partialName()); if (partial instanceof DefaultMustache && ((DefaultMustache)partial).isRecursive()) { isRecursive = true; } if (partial == null) { throw new MustacheException("Failed to compile partial: " + name, tc); } }
@SuppressWarnings("StatementWithEmptyBody") @Override public synchronized void init() { filterText(); Map<String, ExtendNameCode> replaceMap = new HashMap<>(); for (Code code : mustache.getCodes()) { if (code instanceof ExtendNameCode) { // put name codes in the map ExtendNameCode erc = (ExtendNameCode) code; replaceMap.put(erc.getName(), erc); erc.init(); } else if ((code instanceof WriteCode) || (code instanceof CommentCode)) { // ignore text and comments } else { // fail on everything else throw new IllegalArgumentException( "Illegal code in extend section: " + code.getClass().getName()); } } Mustache original = mf.compilePartial(partialName()); partial = (Mustache) original.clone(); Code[] supercodes = partial.getCodes(); // recursively replace named sections with replacements Set<Code> seen = new HashSet<>(); seen.add(partial); partial.setCodes(replaceCodes(supercodes, replaceMap, seen)); }
@SuppressWarnings("StatementWithEmptyBody") @Override public synchronized void init() { filterText(); Map<String, ExtendNameCode> replaceMap = new HashMap<>(); for (Code code : mustache.getCodes()) { if (code instanceof ExtendNameCode) { // put name codes in the map ExtendNameCode erc = (ExtendNameCode) code; replaceMap.put(erc.getName(), erc); erc.init(); } else if ((code instanceof WriteCode) || (code instanceof CommentCode)) { // ignore text and comments } else { // fail on everything else throw new IllegalArgumentException( "Illegal code in extend section: " + code.getClass().getName()); } } Mustache original = mf.compilePartial(partialName()); partial = (Mustache) original.clone(); Code[] supercodes = partial.getCodes(); // recursively replace named sections with replacements Set<Code> seen = new HashSet<>(); seen.add(partial); partial.setCodes(replaceCodes(supercodes, replaceMap, seen)); }
@Override public synchronized void init() { filterText(); partial = df.compilePartial(partialName()); if (partial instanceof DefaultMustache && ((DefaultMustache)partial).isRecursive()) { isRecursive = true; } if (partial == null) { throw new MustacheException("Failed to compile partial: " + name, tc); } }
@SuppressWarnings("StatementWithEmptyBody") @Override public synchronized void init() { filterText(); Map<String, ExtendNameCode> replaceMap = new HashMap<>(); for (Code code : mustache.getCodes()) { if (code instanceof ExtendNameCode) { // put name codes in the map ExtendNameCode erc = (ExtendNameCode) code; replaceMap.put(erc.getName(), erc); erc.init(); } else if ((code instanceof WriteCode) || (code instanceof CommentCode)) { // ignore text and comments } else { // fail on everything else throw new IllegalArgumentException( "Illegal code in extend section: " + code.getClass().getName()); } } Mustache original = mf.compilePartial(partialName()); partial = (Mustache) original.clone(); Code[] supercodes = partial.getCodes(); // recursively replace named sections with replacements Set<Code> seen = new HashSet<>(); seen.add(partial); partial.setCodes(replaceCodes(supercodes, replaceMap, seen)); }
@Override public synchronized void init() { filterText(); partial = df.compilePartial(partialName()); if (partial instanceof DefaultMustache && ((DefaultMustache)partial).isRecursive()) { isRecursive = true; } if (partial == null) { throw new MustacheException("Failed to compile partial: " + name, tc); } }