protected String extractClassFromFileDescription() { String answer = getDescription(); try { URI uri = new URI(answer); String path = uri.getPath(); String schemeSpecific = uri.getSchemeSpecificPart(); if (path!=null) { answer = path; } else if (schemeSpecific!=null) { answer = schemeSpecific; } } catch (URISyntaxException e) {} // let's strip off everything after the last '.' int slashIdx = answer.lastIndexOf('/'); int separatorIdx = answer.lastIndexOf(File.separatorChar); int dotIdx = answer.lastIndexOf('.'); if (dotIdx > 0 && dotIdx > Math.max(slashIdx, separatorIdx)) { answer = answer.substring(0, dotIdx); } // new let's strip everything up to and including the path separators if (slashIdx >= 0) { answer = answer.substring(slashIdx + 1); } // recalculate in case we have already done some stripping separatorIdx = answer.lastIndexOf(File.separatorChar); if (separatorIdx >= 0) { answer = answer.substring(separatorIdx + 1); } return answer; }
protected String getLocationText() { String answer = ". "; if (node != null) { answer += "At [" + node.getLineNumber() + ":" + node.getColumnNumber() + "] "; } if (module != null) { answer += module.getDescription(); } if (answer.equals(". ")) { return ""; } return answer; } }
public ClassNode getScriptClassDummy() { if (scriptDummy!=null) { setScriptBaseClassFromConfig(scriptDummy); return scriptDummy; } String name = getPackageName(); if (name == null) { name = ""; } // now let's use the file name to determine the class name if (getDescription() == null) { throw new RuntimeException("Cannot generate main(String[]) class for statements when we have no file description"); } name += GeneratorContext.encodeAsValidClassName(extractClassFromFileDescription()); ClassNode classNode; if (isPackageInfo()) { classNode = new ClassNode(name, ACC_ABSTRACT | ACC_INTERFACE, ClassHelper.OBJECT_TYPE); } else { classNode = new ClassNode(name, ACC_PUBLIC, ClassHelper.SCRIPT_TYPE); setScriptBaseClassFromConfig(classNode); classNode.setScript(true); classNode.setScriptBody(true); } scriptDummy = classNode; return classNode; }
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
/** * Checks to see if a Module is defined at a path which includes the specified substring * * @param moduleNode a ModuleNode * @param substring The substring to search for * @return true if moduleNode is defined at a path which includes the specified substring */ private boolean doesModulePathIncludeSubstring(ModuleNode moduleNode, final String substring) { if (moduleNode == null) { return false; } boolean substringFoundInDescription = false; String commandObjectModuleDescription = moduleNode.getDescription(); if (commandObjectModuleDescription != null) { substringFoundInDescription = commandObjectModuleDescription.contains(substring); } return substringFoundInDescription; }
protected String extractClassFromFileDescription() { // let's strip off everything after the last '.' String answer = getDescription(); int slashIdx = answer.lastIndexOf('/'); int separatorIdx = answer.lastIndexOf(File.separatorChar); int dotIdx = answer.lastIndexOf('.'); if (dotIdx > 0 && dotIdx > Math.max(slashIdx, separatorIdx)) { answer = answer.substring(0, dotIdx); } // new let's strip everything up to and including the path separators if (slashIdx >= 0) { answer = answer.substring(slashIdx + 1); } // recalculate in case we have already done some stripping separatorIdx = answer.lastIndexOf(File.separatorChar); if (separatorIdx >= 0) { answer = answer.substring(separatorIdx + 1); } return answer; }
protected String extractClassFromFileDescription() { // let's strip off everything after the last '.' String answer = getDescription(); int slashIdx = answer.lastIndexOf('/'); int separatorIdx = answer.lastIndexOf(File.separatorChar); int dotIdx = answer.lastIndexOf('.'); if (dotIdx > 0 && dotIdx > Math.max(slashIdx, separatorIdx)) { answer = answer.substring(0, dotIdx); } // new let's strip everything up to and including the path separators if (slashIdx >= 0) { answer = answer.substring(slashIdx + 1); } // recalculate in case we have already done some stripping separatorIdx = answer.lastIndexOf(File.separatorChar); if (separatorIdx >= 0) { answer = answer.substring(separatorIdx + 1); } return answer; }
protected String extractClassFromFileDescription() { // let's strip off everything after the last '.' String answer = getDescription(); int slashIdx = answer.lastIndexOf('/'); int separatorIdx = answer.lastIndexOf(File.separatorChar); int dotIdx = answer.lastIndexOf('.'); if (dotIdx > 0 && dotIdx > Math.max(slashIdx, separatorIdx)) { answer = answer.substring(0, dotIdx); } // new let's strip everything up to and including the path separators if (slashIdx >= 0) { answer = answer.substring(slashIdx + 1); } // recalculate in case we have already done some stripping separatorIdx = answer.lastIndexOf(File.separatorChar); if (separatorIdx >= 0) { answer = answer.substring(separatorIdx + 1); } return answer; }
protected String extractClassFromFileDescription() { // let's strip off everything after the last '.' String answer = getDescription(); int slashIdx = answer.lastIndexOf('/'); int separatorIdx = answer.lastIndexOf(File.separatorChar); int dotIdx = answer.lastIndexOf('.'); if (dotIdx > 0 && dotIdx > Math.max(slashIdx, separatorIdx)) { answer = answer.substring(0, dotIdx); } // new let's strip everything up to and including the path separators if (slashIdx >= 0) { answer = answer.substring(slashIdx + 1); } // recalculate in case we have already done some stripping separatorIdx = answer.lastIndexOf(File.separatorChar); if (separatorIdx >= 0) { answer = answer.substring(separatorIdx + 1); } return answer; }
protected String getLocationText() { String answer = ". "; if (node != null) { answer += "At [" + node.getLineNumber() + ":" + node.getColumnNumber() + "] "; } if (module != null) { answer += module.getDescription(); } if (answer.equals(". ")) { return ""; } return answer; } }
protected String getLocationText() { String answer = ". "; if (node != null) { answer += "At [" + node.getLineNumber() + ":" + node.getColumnNumber() + "] "; } if (module != null) { answer += module.getDescription(); } if (answer.equals(". ")) { return ""; } return answer; } }
protected String getLocationText() { String answer = ". "; if (node != null) { answer += "At [" + node.getLineNumber() + ":" + node.getColumnNumber() + "] "; } if (module != null) { answer += module.getDescription(); } if (answer.equals(". ")) { return ""; } return answer; } }
protected String getLocationText() { String answer = ". "; if (node != null) { answer += "At [" + node.getLineNumber() + ":" + node.getColumnNumber() + "] "; } if (module != null) { answer += module.getDescription(); } if (answer.equals(". ")) { return ""; } return answer; } }
public ClassNode getScriptClassDummy() { if (scriptDummy!=null) { setScriptBaseClassFromConfig(scriptDummy); return scriptDummy; } String name = getPackageName(); if (name == null) { name = ""; } // now let's use the file name to determine the class name if (getDescription() == null) { throw new RuntimeException("Cannot generate main(String[]) class for statements when we have no file description"); } name += extractClassFromFileDescription(); ClassNode classNode; if (isPackageInfo()) { classNode = new ClassNode(name, ACC_ABSTRACT | ACC_INTERFACE, ClassHelper.OBJECT_TYPE); } else { classNode = new ClassNode(name, ACC_PUBLIC, ClassHelper.SCRIPT_TYPE); setScriptBaseClassFromConfig(classNode); classNode.setScript(true); classNode.setScriptBody(true); } scriptDummy = classNode; return classNode; }
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
if (getDescription() == null) { throw new RuntimeException("Cannot generate main(String[]) class for statements when we have no file description");
if (getDescription() == null) { throw new RuntimeException("Cannot generate main(String[]) class for statements when we have no file description");