id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
13,200 | apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/BeanUtils.java | BeanUtils.getAllProperties | public static List<PropertyNode> getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean superFirst) {
return getAllProperties(type, type, new HashSet<String>(), includeSuperProperties, includeStatic, includePseu... | java | public static List<PropertyNode> getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean superFirst) {
return getAllProperties(type, type, new HashSet<String>(), includeSuperProperties, includeStatic, includePseu... | [
"public",
"static",
"List",
"<",
"PropertyNode",
">",
"getAllProperties",
"(",
"ClassNode",
"type",
",",
"boolean",
"includeSuperProperties",
",",
"boolean",
"includeStatic",
",",
"boolean",
"includePseudoGetters",
",",
"boolean",
"includePseudoSetters",
",",
"boolean",... | Get all properties including JavaBean pseudo properties matching JavaBean getter or setter conventions.
@param type the ClassNode
@param includeSuperProperties whether to include super properties
@param includeStatic whether to include static properties
@param includePseudoGetters whether to include JavaBean pseudo (g... | [
"Get",
"all",
"properties",
"including",
"JavaBean",
"pseudo",
"properties",
"matching",
"JavaBean",
"getter",
"or",
"setter",
"conventions",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/BeanUtils.java#L66-L68 |
13,201 | apache/groovy | subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovydocManager.java | GroovydocManager.handle | public void handle(ASTNode node, GroovyParser.GroovyParserRuleContext ctx) {
if (!(groovydocEnabled || runtimeGroovydocEnabled)) {
return;
}
if (!asBoolean(node) || !asBoolean(ctx)) {
return;
}
String docCommentNodeText = this.findDocCommentByNode(ctx);
... | java | public void handle(ASTNode node, GroovyParser.GroovyParserRuleContext ctx) {
if (!(groovydocEnabled || runtimeGroovydocEnabled)) {
return;
}
if (!asBoolean(node) || !asBoolean(ctx)) {
return;
}
String docCommentNodeText = this.findDocCommentByNode(ctx);
... | [
"public",
"void",
"handle",
"(",
"ASTNode",
"node",
",",
"GroovyParser",
".",
"GroovyParserRuleContext",
"ctx",
")",
"{",
"if",
"(",
"!",
"(",
"groovydocEnabled",
"||",
"runtimeGroovydocEnabled",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"asBoolean"... | Attach doc comment to member node as meta data | [
"Attach",
"doc",
"comment",
"to",
"member",
"node",
"as",
"meta",
"data"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovydocManager.java#L64-L80 |
13,202 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java | ReflectorLoader.findClass | protected Class findClass(String name) throws ClassNotFoundException {
if (delegatationLoader==null) return super.findClass(name);
return delegatationLoader.loadClass(name);
} | java | protected Class findClass(String name) throws ClassNotFoundException {
if (delegatationLoader==null) return super.findClass(name);
return delegatationLoader.loadClass(name);
} | [
"protected",
"Class",
"findClass",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"delegatationLoader",
"==",
"null",
")",
"return",
"super",
".",
"findClass",
"(",
"name",
")",
";",
"return",
"delegatationLoader",
".",
"loadClas... | Tries to find a Groovy class.
@return the class if found
@throws ClassNotFoundException if not found | [
"Tries",
"to",
"find",
"a",
"Groovy",
"class",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java#L52-L55 |
13,203 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java | ReflectorLoader.loadClass | protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
if (inDefine) {
if (name.equals(REFLECTOR)) return Reflector.class;
}
return super.loadClass(name, resolve);
} | java | protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
if (inDefine) {
if (name.equals(REFLECTOR)) return Reflector.class;
}
return super.loadClass(name, resolve);
} | [
"protected",
"synchronized",
"Class",
"loadClass",
"(",
"String",
"name",
",",
"boolean",
"resolve",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"inDefine",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"REFLECTOR",
")",
")",
"return",
"Refle... | Loads a class per name. Unlike a normal loadClass this version
behaves different during a class definition. In that case it
checks if the class we want to load is Reflector and returns
class if the check is successful. If it is not during a class
definition it just calls the super class version of loadClass.
@param na... | [
"Loads",
"a",
"class",
"per",
"name",
".",
"Unlike",
"a",
"normal",
"loadClass",
"this",
"version",
"behaves",
"different",
"during",
"a",
"class",
"definition",
".",
"In",
"that",
"case",
"it",
"checks",
"if",
"the",
"class",
"we",
"want",
"to",
"load",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java#L69-L74 |
13,204 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java | ReflectorLoader.defineClass | public synchronized Class defineClass(String name, byte[] bytecode, ProtectionDomain domain) {
inDefine = true;
Class c = defineClass(name, bytecode, 0, bytecode.length, domain);
loadedClasses.put(name,c);
resolveClass(c);
inDefine = false;
return c;
} | java | public synchronized Class defineClass(String name, byte[] bytecode, ProtectionDomain domain) {
inDefine = true;
Class c = defineClass(name, bytecode, 0, bytecode.length, domain);
loadedClasses.put(name,c);
resolveClass(c);
inDefine = false;
return c;
} | [
"public",
"synchronized",
"Class",
"defineClass",
"(",
"String",
"name",
",",
"byte",
"[",
"]",
"bytecode",
",",
"ProtectionDomain",
"domain",
")",
"{",
"inDefine",
"=",
"true",
";",
"Class",
"c",
"=",
"defineClass",
"(",
"name",
",",
"bytecode",
",",
"0",... | helper method to define Reflector classes.
@param name of the Reflector
@param bytecode the bytecode
@param domain the protection domain
@return the generated class | [
"helper",
"method",
"to",
"define",
"Reflector",
"classes",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectorLoader.java#L83-L90 |
13,205 | apache/groovy | src/main/java/org/codehaus/groovy/transform/trait/Traits.java | Traits.isBridgeMethod | public static boolean isBridgeMethod(Method someMethod) {
TraitBridge annotation = someMethod.getAnnotation(TraitBridge.class);
return annotation!=null;
} | java | public static boolean isBridgeMethod(Method someMethod) {
TraitBridge annotation = someMethod.getAnnotation(TraitBridge.class);
return annotation!=null;
} | [
"public",
"static",
"boolean",
"isBridgeMethod",
"(",
"Method",
"someMethod",
")",
"{",
"TraitBridge",
"annotation",
"=",
"someMethod",
".",
"getAnnotation",
"(",
"TraitBridge",
".",
"class",
")",
";",
"return",
"annotation",
"!=",
"null",
";",
"}"
] | Reflection API to indicate whether some method is a bridge method to the default implementation
of a trait.
@param someMethod a method node
@return null if it is not a method implemented in a trait. If it is, returns the method from the trait class. | [
"Reflection",
"API",
"to",
"indicate",
"whether",
"some",
"method",
"is",
"a",
"bridge",
"method",
"to",
"the",
"default",
"implementation",
"of",
"a",
"trait",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/trait/Traits.java#L218-L221 |
13,206 | apache/groovy | src/main/java/org/codehaus/groovy/transform/trait/Traits.java | Traits.decomposeSuperCallName | public static String[] decomposeSuperCallName(String origName) {
if (origName.contains(SUPER_TRAIT_METHOD_PREFIX)) {
int endIndex = origName.indexOf(SUPER_TRAIT_METHOD_PREFIX);
String tName = origName.substring(0, endIndex).replace('_','.').replace("..","_");
String fName = o... | java | public static String[] decomposeSuperCallName(String origName) {
if (origName.contains(SUPER_TRAIT_METHOD_PREFIX)) {
int endIndex = origName.indexOf(SUPER_TRAIT_METHOD_PREFIX);
String tName = origName.substring(0, endIndex).replace('_','.').replace("..","_");
String fName = o... | [
"public",
"static",
"String",
"[",
"]",
"decomposeSuperCallName",
"(",
"String",
"origName",
")",
"{",
"if",
"(",
"origName",
".",
"contains",
"(",
"SUPER_TRAIT_METHOD_PREFIX",
")",
")",
"{",
"int",
"endIndex",
"=",
"origName",
".",
"indexOf",
"(",
"SUPER_TRAI... | Returns the name of a method without the super trait specific prefix. If the method name
doesn't correspond to a super trait method call, the result will be null.
@param origName the name of a method
@return null if the name doesn't start with the super trait prefix, otherwise the name without the prefix | [
"Returns",
"the",
"name",
"of",
"a",
"method",
"without",
"the",
"super",
"trait",
"specific",
"prefix",
".",
"If",
"the",
"method",
"name",
"doesn",
"t",
"correspond",
"to",
"a",
"super",
"trait",
"method",
"call",
"the",
"result",
"will",
"be",
"null",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/trait/Traits.java#L270-L278 |
13,207 | apache/groovy | src/main/java/org/codehaus/groovy/transform/trait/Traits.java | Traits.collectSelfTypes | public static LinkedHashSet<ClassNode> collectSelfTypes(
ClassNode receiver,
LinkedHashSet<ClassNode> selfTypes) {
return collectSelfTypes(receiver, selfTypes, true, true);
} | java | public static LinkedHashSet<ClassNode> collectSelfTypes(
ClassNode receiver,
LinkedHashSet<ClassNode> selfTypes) {
return collectSelfTypes(receiver, selfTypes, true, true);
} | [
"public",
"static",
"LinkedHashSet",
"<",
"ClassNode",
">",
"collectSelfTypes",
"(",
"ClassNode",
"receiver",
",",
"LinkedHashSet",
"<",
"ClassNode",
">",
"selfTypes",
")",
"{",
"return",
"collectSelfTypes",
"(",
"receiver",
",",
"selfTypes",
",",
"true",
",",
"... | Collects all the self types that a type should extend or implement, given
the traits is implements. Collects from interfaces and superclasses too.
@param receiver a class node that may implement a trait
@param selfTypes a collection where the list of self types will be written
@return the selfTypes collection itself
@s... | [
"Collects",
"all",
"the",
"self",
"types",
"that",
"a",
"type",
"should",
"extend",
"or",
"implement",
"given",
"the",
"traits",
"is",
"implements",
".",
"Collects",
"from",
"interfaces",
"and",
"superclasses",
"too",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/trait/Traits.java#L308-L312 |
13,208 | apache/groovy | src/main/java/org/codehaus/groovy/transform/trait/Traits.java | Traits.collectSelfTypes | public static LinkedHashSet<ClassNode> collectSelfTypes(
ClassNode receiver,
LinkedHashSet<ClassNode> selfTypes,
boolean checkInterfaces,
boolean checkSuper) {
if (Traits.isTrait(receiver)) {
List<AnnotationNode> annotations = receiver.getAnnotations(S... | java | public static LinkedHashSet<ClassNode> collectSelfTypes(
ClassNode receiver,
LinkedHashSet<ClassNode> selfTypes,
boolean checkInterfaces,
boolean checkSuper) {
if (Traits.isTrait(receiver)) {
List<AnnotationNode> annotations = receiver.getAnnotations(S... | [
"public",
"static",
"LinkedHashSet",
"<",
"ClassNode",
">",
"collectSelfTypes",
"(",
"ClassNode",
"receiver",
",",
"LinkedHashSet",
"<",
"ClassNode",
">",
"selfTypes",
",",
"boolean",
"checkInterfaces",
",",
"boolean",
"checkSuper",
")",
"{",
"if",
"(",
"Traits",
... | Collects all the self types that a type should extend or implement, given
the traits is implements.
@param receiver a class node that may implement a trait
@param selfTypes a collection where the list of self types will be written
@param checkInterfaces should the interfaces that the node implements be collected too
@p... | [
"Collects",
"all",
"the",
"self",
"types",
"that",
"a",
"type",
"should",
"extend",
"or",
"implement",
"given",
"the",
"traits",
"is",
"implements",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/trait/Traits.java#L324-L359 |
13,209 | apache/groovy | src/main/java/org/codehaus/groovy/control/messages/SyntaxErrorMessage.java | SyntaxErrorMessage.write | public void write(PrintWriter output, Janitor janitor) {
String name = source.getName();
int line = getCause().getStartLine();
int column = getCause().getStartColumn();
String sample = source.getSample(line, column, janitor);
output.print(name + ": " + line + ": " + getCause().g... | java | public void write(PrintWriter output, Janitor janitor) {
String name = source.getName();
int line = getCause().getStartLine();
int column = getCause().getStartColumn();
String sample = source.getSample(line, column, janitor);
output.print(name + ": " + line + ": " + getCause().g... | [
"public",
"void",
"write",
"(",
"PrintWriter",
"output",
",",
"Janitor",
"janitor",
")",
"{",
"String",
"name",
"=",
"source",
".",
"getName",
"(",
")",
";",
"int",
"line",
"=",
"getCause",
"(",
")",
".",
"getStartLine",
"(",
")",
";",
"int",
"column",... | Writes out a nicely formatted summary of the syntax error. | [
"Writes",
"out",
"a",
"nicely",
"formatted",
"summary",
"of",
"the",
"syntax",
"error",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/control/messages/SyntaxErrorMessage.java#L50-L62 |
13,210 | apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/IndyMath.java | IndyMath.chooseMathMethod | public static boolean chooseMathMethod(Selector info, MetaMethod metaMethod) {
Map<MethodType,MethodHandle> xmap = methods.get(info.name);
if (xmap==null) return false;
MethodType type = replaceWithMoreSpecificType(info.args, info.targetType);
type = widenOperators(type);
... | java | public static boolean chooseMathMethod(Selector info, MetaMethod metaMethod) {
Map<MethodType,MethodHandle> xmap = methods.get(info.name);
if (xmap==null) return false;
MethodType type = replaceWithMoreSpecificType(info.args, info.targetType);
type = widenOperators(type);
... | [
"public",
"static",
"boolean",
"chooseMathMethod",
"(",
"Selector",
"info",
",",
"MetaMethod",
"metaMethod",
")",
"{",
"Map",
"<",
"MethodType",
",",
"MethodHandle",
">",
"xmap",
"=",
"methods",
".",
"get",
"(",
"info",
".",
"name",
")",
";",
"if",
"(",
... | Choose a method to replace the originally chosen metaMethod to have a
more efficient call path. | [
"Choose",
"a",
"method",
"to",
"replace",
"the",
"originally",
"chosen",
"metaMethod",
"to",
"have",
"a",
"more",
"efficient",
"call",
"path",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/IndyMath.java#L108-L120 |
13,211 | apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/IndyMath.java | IndyMath.widenOperators | private static MethodType widenOperators(MethodType mt) {
if (mt.parameterCount()==2) {
Class leftType = mt.parameterType(0);
Class rightType = mt.parameterType(1);
if (isIntCategory(leftType) && isIntCategory(rightType)) return IIV;
if (isLongCategor... | java | private static MethodType widenOperators(MethodType mt) {
if (mt.parameterCount()==2) {
Class leftType = mt.parameterType(0);
Class rightType = mt.parameterType(1);
if (isIntCategory(leftType) && isIntCategory(rightType)) return IIV;
if (isLongCategor... | [
"private",
"static",
"MethodType",
"widenOperators",
"(",
"MethodType",
"mt",
")",
"{",
"if",
"(",
"mt",
".",
"parameterCount",
"(",
")",
"==",
"2",
")",
"{",
"Class",
"leftType",
"=",
"mt",
".",
"parameterType",
"(",
"0",
")",
";",
"Class",
"rightType",... | Widens the operators. For math operations like a+b we generally
execute them using a conversion to certain types. If a for example
is an int and b a byte, we do the operation using integer math. This
method gives a simplified MethodType that contains the two operators
with this widening according to Groovy rules applie... | [
"Widens",
"the",
"operators",
".",
"For",
"math",
"operations",
"like",
"a",
"+",
"b",
"we",
"generally",
"execute",
"them",
"using",
"a",
"conversion",
"to",
"certain",
"types",
".",
"If",
"a",
"for",
"example",
"is",
"an",
"int",
"and",
"b",
"a",
"by... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/IndyMath.java#L130-L149 |
13,212 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.checkParameters | public void checkParameters(Class[] arguments) {
// lets check that the argument types are valid
if (!isValidMethod(arguments)) {
throw new IllegalArgumentException(
"Parameters to method: "
+ getName()
+ " do not match types: "
... | java | public void checkParameters(Class[] arguments) {
// lets check that the argument types are valid
if (!isValidMethod(arguments)) {
throw new IllegalArgumentException(
"Parameters to method: "
+ getName()
+ " do not match types: "
... | [
"public",
"void",
"checkParameters",
"(",
"Class",
"[",
"]",
"arguments",
")",
"{",
"// lets check that the argument types are valid",
"if",
"(",
"!",
"isValidMethod",
"(",
"arguments",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameters to m... | Checks that the given parameters are valid to call this method
@param arguments the arguments to check
@throws IllegalArgumentException if the parameters are not valid | [
"Checks",
"that",
"the",
"given",
"parameters",
"are",
"valid",
"to",
"call",
"this",
"method"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L96-L107 |
13,213 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.isMethod | public boolean isMethod(MetaMethod method) {
return getName().equals(method.getName())
&& getModifiers() == method.getModifiers()
&& getReturnType().equals(method.getReturnType())
&& equal(getParameterTypes(), method.getParameterTypes());
} | java | public boolean isMethod(MetaMethod method) {
return getName().equals(method.getName())
&& getModifiers() == method.getModifiers()
&& getReturnType().equals(method.getReturnType())
&& equal(getParameterTypes(), method.getParameterTypes());
} | [
"public",
"boolean",
"isMethod",
"(",
"MetaMethod",
"method",
")",
"{",
"return",
"getName",
"(",
")",
".",
"equals",
"(",
"method",
".",
"getName",
"(",
")",
")",
"&&",
"getModifiers",
"(",
")",
"==",
"method",
".",
"getModifiers",
"(",
")",
"&&",
"ge... | Returns true if this this metamethod represents the same method as the argument.
@param method A metaMethod instance
@return true if method is for the same method as this method, false otherwise. | [
"Returns",
"true",
"if",
"this",
"this",
"metamethod",
"represents",
"the",
"same",
"method",
"as",
"the",
"argument",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L115-L120 |
13,214 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.compatibleModifiers | private static boolean compatibleModifiers(int modifiersA, int modifiersB) {
int mask = Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC | Modifier.STATIC;
return (modifiersA & mask) == (modifiersB & mask);
} | java | private static boolean compatibleModifiers(int modifiersA, int modifiersB) {
int mask = Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC | Modifier.STATIC;
return (modifiersA & mask) == (modifiersB & mask);
} | [
"private",
"static",
"boolean",
"compatibleModifiers",
"(",
"int",
"modifiersA",
",",
"int",
"modifiersB",
")",
"{",
"int",
"mask",
"=",
"Modifier",
".",
"PRIVATE",
"|",
"Modifier",
".",
"PROTECTED",
"|",
"Modifier",
".",
"PUBLIC",
"|",
"Modifier",
".",
"STA... | Checks the compatibility between two modifier masks. Checks that they are equal
with regards to access and static modifier.
@return true if the modifiers are compatible | [
"Checks",
"the",
"compatibility",
"between",
"two",
"modifier",
"masks",
".",
"Checks",
"that",
"they",
"are",
"equal",
"with",
"regards",
"to",
"access",
"and",
"static",
"modifier",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L229-L232 |
13,215 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.getSignature | public synchronized String getSignature() {
if (signature == null) {
CachedClass [] parameters = getParameterTypes();
final String name = getName();
StringBuilder buf = new StringBuilder(name.length()+parameters.length*10);
buf.append(getReturnType().getName());
... | java | public synchronized String getSignature() {
if (signature == null) {
CachedClass [] parameters = getParameterTypes();
final String name = getName();
StringBuilder buf = new StringBuilder(name.length()+parameters.length*10);
buf.append(getReturnType().getName());
... | [
"public",
"synchronized",
"String",
"getSignature",
"(",
")",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"CachedClass",
"[",
"]",
"parameters",
"=",
"getParameterTypes",
"(",
")",
";",
"final",
"String",
"name",
"=",
"getName",
"(",
")",
";",
"... | Returns the signature of this method
@return The signature of this method | [
"Returns",
"the",
"signature",
"of",
"this",
"method"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L253-L273 |
13,216 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.processDoMethodInvokeException | public final RuntimeException processDoMethodInvokeException (Exception e, Object object, Object [] argumentArray) {
// if (e instanceof IllegalArgumentException) {
// //TODO: test if this is OK with new MOP, should be changed!
// // we don't want the exception being unwrapped if it is a Il... | java | public final RuntimeException processDoMethodInvokeException (Exception e, Object object, Object [] argumentArray) {
// if (e instanceof IllegalArgumentException) {
// //TODO: test if this is OK with new MOP, should be changed!
// // we don't want the exception being unwrapped if it is a Il... | [
"public",
"final",
"RuntimeException",
"processDoMethodInvokeException",
"(",
"Exception",
"e",
",",
"Object",
"object",
",",
"Object",
"[",
"]",
"argumentArray",
")",
"{",
"// if (e instanceof IllegalArgumentException) {",
"// //TODO: test if this is OK with ne... | This method is called when an exception occurs while invoking this method. | [
"This",
"method",
"is",
"called",
"when",
"an",
"exception",
"occurs",
"while",
"invoking",
"this",
"method",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L291-L310 |
13,217 | apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.doMethodInvoke | public Object doMethodInvoke(Object object, Object[] argumentArray) {
argumentArray = coerceArgumentsToClasses(argumentArray);
try {
return invoke(object, argumentArray);
} catch (Exception e) {
throw processDoMethodInvokeException(e, object, argumentArray);
}
... | java | public Object doMethodInvoke(Object object, Object[] argumentArray) {
argumentArray = coerceArgumentsToClasses(argumentArray);
try {
return invoke(object, argumentArray);
} catch (Exception e) {
throw processDoMethodInvokeException(e, object, argumentArray);
}
... | [
"public",
"Object",
"doMethodInvoke",
"(",
"Object",
"object",
",",
"Object",
"[",
"]",
"argumentArray",
")",
"{",
"argumentArray",
"=",
"coerceArgumentsToClasses",
"(",
"argumentArray",
")",
";",
"try",
"{",
"return",
"invoke",
"(",
"object",
",",
"argumentArra... | Invokes the method this object represents. This method is not final but it should be overloaded very carefully and only by generated methods
there is no guarantee that it will be called
@param object The object the method is to be called at.
@param argumentArray Arguments for the method invocation.
@return The return ... | [
"Invokes",
"the",
"method",
"this",
"object",
"represents",
".",
"This",
"method",
"is",
"not",
"final",
"but",
"it",
"should",
"be",
"overloaded",
"very",
"carefully",
"and",
"only",
"by",
"generated",
"methods",
"there",
"is",
"no",
"guarantee",
"that",
"i... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L320-L327 |
13,218 | apache/groovy | src/main/java/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java | StaticCompilationVisitor.checkForConstructorWithCSButClassWithout | private void checkForConstructorWithCSButClassWithout(MethodNode node) {
if (!(node instanceof ConstructorNode)) return;
Object meta = node.getNodeMetaData(STATIC_COMPILE_NODE);
if (!Boolean.TRUE.equals(meta)) return;
ClassNode clz = typeCheckingContext.getEnclosingClassNode();
m... | java | private void checkForConstructorWithCSButClassWithout(MethodNode node) {
if (!(node instanceof ConstructorNode)) return;
Object meta = node.getNodeMetaData(STATIC_COMPILE_NODE);
if (!Boolean.TRUE.equals(meta)) return;
ClassNode clz = typeCheckingContext.getEnclosingClassNode();
m... | [
"private",
"void",
"checkForConstructorWithCSButClassWithout",
"(",
"MethodNode",
"node",
")",
"{",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"ConstructorNode",
")",
")",
"return",
";",
"Object",
"meta",
"=",
"node",
".",
"getNodeMetaData",
"(",
"STATIC_COMPILE_N... | If we are in a constructor, that is static compiled, but in a class, that
is not, it may happen that init code from object initializers, fields
or properties is added into the constructor code. The backend assumes
a purely static constructor, so it may fail if it encounters dynamic
code here. Thus we make this kind of ... | [
"If",
"we",
"are",
"in",
"a",
"constructor",
"that",
"is",
"static",
"compiled",
"but",
"in",
"a",
"class",
"that",
"is",
"not",
"it",
"may",
"happen",
"that",
"init",
"code",
"from",
"object",
"initializers",
"fields",
"or",
"properties",
"is",
"added",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java#L202-L217 |
13,219 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java | DefaultTypeTransformation.isEnumSubclass | @Deprecated
public static boolean isEnumSubclass(Object value) {
if (value instanceof Class) {
Class superclass = ((Class) value).getSuperclass();
while (superclass != null) {
if (superclass.getName().equals("java.lang.Enum")) {
return true;
... | java | @Deprecated
public static boolean isEnumSubclass(Object value) {
if (value instanceof Class) {
Class superclass = ((Class) value).getSuperclass();
while (superclass != null) {
if (superclass.getName().equals("java.lang.Enum")) {
return true;
... | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"isEnumSubclass",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Class",
")",
"{",
"Class",
"superclass",
"=",
"(",
"(",
"Class",
")",
"value",
")",
".",
"getSuperclass",
"(",
")",
"... | Determines whether the value object is a Class object representing a
subclass of java.lang.Enum. Uses class name check to avoid breaking on
pre-Java 5 JREs.
@param value an object
@return true if the object is an Enum | [
"Determines",
"whether",
"the",
"value",
"object",
"is",
"a",
"Class",
"object",
"representing",
"a",
"subclass",
"of",
"java",
".",
"lang",
".",
"Enum",
".",
"Uses",
"class",
"name",
"check",
"to",
"avoid",
"breaking",
"on",
"pre",
"-",
"Java",
"5",
"JR... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java#L494-L507 |
13,220 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java | DefaultTypeTransformation.primitiveArrayToList | public static List primitiveArrayToList(Object array) {
int size = Array.getLength(array);
List list = new ArrayList(size);
for (int i = 0; i < size; i++) {
Object item = Array.get(array, i);
if (item != null && item.getClass().isArray() && item.getClass().getComponentTyp... | java | public static List primitiveArrayToList(Object array) {
int size = Array.getLength(array);
List list = new ArrayList(size);
for (int i = 0; i < size; i++) {
Object item = Array.get(array, i);
if (item != null && item.getClass().isArray() && item.getClass().getComponentTyp... | [
"public",
"static",
"List",
"primitiveArrayToList",
"(",
"Object",
"array",
")",
"{",
"int",
"size",
"=",
"Array",
".",
"getLength",
"(",
"array",
")",
";",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Allows conversion of arrays into a mutable List
@param array an array
@return the array as a List | [
"Allows",
"conversion",
"of",
"arrays",
"into",
"a",
"mutable",
"List"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java#L515-L526 |
13,221 | apache/groovy | src/main/groovy/groovy/util/IndentPrinter.java | IndentPrinter.println | public void println(String text) {
try {
if(autoIndent) printIndent();
out.write(text);
println();
} catch(IOException ioe) {
throw new GroovyRuntimeException(ioe);
}
} | java | public void println(String text) {
try {
if(autoIndent) printIndent();
out.write(text);
println();
} catch(IOException ioe) {
throw new GroovyRuntimeException(ioe);
}
} | [
"public",
"void",
"println",
"(",
"String",
"text",
")",
"{",
"try",
"{",
"if",
"(",
"autoIndent",
")",
"printIndent",
"(",
")",
";",
"out",
".",
"write",
"(",
"text",
")",
";",
"println",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")"... | Prints a string followed by an end of line character.
@param text String to be written | [
"Prints",
"a",
"string",
"followed",
"by",
"an",
"end",
"of",
"line",
"character",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/IndentPrinter.java#L134-L142 |
13,222 | apache/groovy | src/main/groovy/groovy/util/IndentPrinter.java | IndentPrinter.printIndent | public void printIndent() {
for (int i = 0; i < indentLevel; i++) {
try {
out.write(indent);
} catch(IOException ioe) {
throw new GroovyRuntimeException(ioe);
}
}
} | java | public void printIndent() {
for (int i = 0; i < indentLevel; i++) {
try {
out.write(indent);
} catch(IOException ioe) {
throw new GroovyRuntimeException(ioe);
}
}
} | [
"public",
"void",
"printIndent",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indentLevel",
";",
"i",
"++",
")",
"{",
"try",
"{",
"out",
".",
"write",
"(",
"indent",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{... | Prints the current indent level. | [
"Prints",
"the",
"current",
"indent",
"level",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/IndentPrinter.java#L173-L181 |
13,223 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.getDeclaredMethodsFromSuper | public static Map<String, MethodNode> getDeclaredMethodsFromSuper(ClassNode cNode) {
ClassNode parent = cNode.getSuperClass();
if (parent == null) {
return new HashMap<String, MethodNode>();
}
return parent.getDeclaredMethodsMap();
} | java | public static Map<String, MethodNode> getDeclaredMethodsFromSuper(ClassNode cNode) {
ClassNode parent = cNode.getSuperClass();
if (parent == null) {
return new HashMap<String, MethodNode>();
}
return parent.getDeclaredMethodsMap();
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"getDeclaredMethodsFromSuper",
"(",
"ClassNode",
"cNode",
")",
"{",
"ClassNode",
"parent",
"=",
"cNode",
".",
"getSuperClass",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"re... | Add methods from the super class.
@param cNode The ClassNode
@return A map of methods | [
"Add",
"methods",
"from",
"the",
"super",
"class",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L143-L149 |
13,224 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.addDeclaredMethodsFromInterfaces | public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
// add in unimplemented abstract methods from the interfaces
for (ClassNode iface : cNode.getInterfaces()) {
Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
... | java | public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
// add in unimplemented abstract methods from the interfaces
for (ClassNode iface : cNode.getInterfaces()) {
Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
... | [
"public",
"static",
"void",
"addDeclaredMethodsFromInterfaces",
"(",
"ClassNode",
"cNode",
",",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"methodsMap",
")",
"{",
"// add in unimplemented abstract methods from the interfaces",
"for",
"(",
"ClassNode",
"iface",
":",
"... | Add in methods from all interfaces. Existing entries in the methods map take precedence.
Methods from interfaces visited early take precedence over later ones.
@param cNode The ClassNode
@param methodsMap A map of existing methods to alter | [
"Add",
"in",
"methods",
"from",
"all",
"interfaces",
".",
"Existing",
"entries",
"in",
"the",
"methods",
"map",
"take",
"precedence",
".",
"Methods",
"from",
"interfaces",
"visited",
"early",
"take",
"precedence",
"over",
"later",
"ones",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L158-L169 |
13,225 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.getDeclaredMethodsFromInterfaces | public static Map<String, MethodNode> getDeclaredMethodsFromInterfaces(ClassNode cNode) {
Map<String, MethodNode> result = new HashMap<String, MethodNode>();
ClassNode[] interfaces = cNode.getInterfaces();
for (ClassNode iface : interfaces) {
result.putAll(iface.getDeclaredMethodsMap... | java | public static Map<String, MethodNode> getDeclaredMethodsFromInterfaces(ClassNode cNode) {
Map<String, MethodNode> result = new HashMap<String, MethodNode>();
ClassNode[] interfaces = cNode.getInterfaces();
for (ClassNode iface : interfaces) {
result.putAll(iface.getDeclaredMethodsMap... | [
"public",
"static",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"getDeclaredMethodsFromInterfaces",
"(",
"ClassNode",
"cNode",
")",
"{",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"MethodNode",
">",
"... | Get methods from all interfaces.
Methods from interfaces visited early will be overwritten by later ones.
@param cNode The ClassNode
@return A map of methods | [
"Get",
"methods",
"from",
"all",
"interfaces",
".",
"Methods",
"from",
"interfaces",
"visited",
"early",
"will",
"be",
"overwritten",
"by",
"later",
"ones",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L178-L185 |
13,226 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.addDeclaredMethodsFromAllInterfaces | public static void addDeclaredMethodsFromAllInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
List cnInterfaces = Arrays.asList(cNode.getInterfaces());
ClassNode parent = cNode.getSuperClass();
while (parent != null && !parent.equals(ClassHelper.OBJECT_TYPE)) {
ClassN... | java | public static void addDeclaredMethodsFromAllInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
List cnInterfaces = Arrays.asList(cNode.getInterfaces());
ClassNode parent = cNode.getSuperClass();
while (parent != null && !parent.equals(ClassHelper.OBJECT_TYPE)) {
ClassN... | [
"public",
"static",
"void",
"addDeclaredMethodsFromAllInterfaces",
"(",
"ClassNode",
"cNode",
",",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"methodsMap",
")",
"{",
"List",
"cnInterfaces",
"=",
"Arrays",
".",
"asList",
"(",
"cNode",
".",
"getInterfaces",
"("... | Adds methods from interfaces and parent interfaces. Existing entries in the methods map take precedence.
Methods from interfaces visited early take precedence over later ones.
@param cNode The ClassNode
@param methodsMap A map of existing methods to alter | [
"Adds",
"methods",
"from",
"interfaces",
"and",
"parent",
"interfaces",
".",
"Existing",
"entries",
"in",
"the",
"methods",
"map",
"take",
"precedence",
".",
"Methods",
"from",
"interfaces",
"visited",
"early",
"take",
"precedence",
"over",
"later",
"ones",
"."
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L194-L206 |
13,227 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.hasPossibleStaticMethod | public static boolean hasPossibleStaticMethod(ClassNode cNode, String name, Expression arguments, boolean trySpread) {
int count = 0;
boolean foundSpread = false;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
for (Expres... | java | public static boolean hasPossibleStaticMethod(ClassNode cNode, String name, Expression arguments, boolean trySpread) {
int count = 0;
boolean foundSpread = false;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
for (Expres... | [
"public",
"static",
"boolean",
"hasPossibleStaticMethod",
"(",
"ClassNode",
"cNode",
",",
"String",
"name",
",",
"Expression",
"arguments",
",",
"boolean",
"trySpread",
")",
"{",
"int",
"count",
"=",
"0",
";",
"boolean",
"foundSpread",
"=",
"false",
";",
"if",... | Returns true if the given method has a possibly matching static method with the given name and arguments.
Handles default arguments and optionally spread expressions.
@param cNode the ClassNode of interest
@param name the name of the method of interest
@param arguments the arguments to match against
@param tr... | [
"Returns",
"true",
"if",
"the",
"given",
"method",
"has",
"a",
"possibly",
"matching",
"static",
"method",
"with",
"the",
"given",
"name",
"and",
"arguments",
".",
"Handles",
"default",
"arguments",
"and",
"optionally",
"spread",
"expressions",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L218-L265 |
13,228 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.hasPossibleStaticProperty | public static boolean hasPossibleStaticProperty(ClassNode cNode, String methodName) {
// assume explicit static method call checked first so we can assume a simple check here
if (!methodName.startsWith("get") && !methodName.startsWith("is")) {
return false;
}
String propName ... | java | public static boolean hasPossibleStaticProperty(ClassNode cNode, String methodName) {
// assume explicit static method call checked first so we can assume a simple check here
if (!methodName.startsWith("get") && !methodName.startsWith("is")) {
return false;
}
String propName ... | [
"public",
"static",
"boolean",
"hasPossibleStaticProperty",
"(",
"ClassNode",
"cNode",
",",
"String",
"methodName",
")",
"{",
"// assume explicit static method call checked first so we can assume a simple check here",
"if",
"(",
"!",
"methodName",
".",
"startsWith",
"(",
"\"g... | Return true if we have a static accessor | [
"Return",
"true",
"if",
"we",
"have",
"a",
"static",
"accessor"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L270-L278 |
13,229 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.isValidAccessorName | public static boolean isValidAccessorName(String accessorName) {
if (accessorName.startsWith("get") || accessorName.startsWith("is") || accessorName.startsWith("set")) {
int prefixLength = accessorName.startsWith("is") ? 2 : 3;
return accessorName.length() > prefixLength;
};
... | java | public static boolean isValidAccessorName(String accessorName) {
if (accessorName.startsWith("get") || accessorName.startsWith("is") || accessorName.startsWith("set")) {
int prefixLength = accessorName.startsWith("is") ? 2 : 3;
return accessorName.length() > prefixLength;
};
... | [
"public",
"static",
"boolean",
"isValidAccessorName",
"(",
"String",
"accessorName",
")",
"{",
"if",
"(",
"accessorName",
".",
"startsWith",
"(",
"\"get\"",
")",
"||",
"accessorName",
".",
"startsWith",
"(",
"\"is\"",
")",
"||",
"accessorName",
".",
"startsWith"... | Detect whether the given accessor name starts with "get", "set" or "is" followed by at least one character.
@param accessorName the accessor name of interest, e.g. getAge
@return true if a valid prefix is found | [
"Detect",
"whether",
"the",
"given",
"accessor",
"name",
"starts",
"with",
"get",
"set",
"or",
"is",
"followed",
"by",
"at",
"least",
"one",
"character",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L299-L305 |
13,230 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.getStaticProperty | public static PropertyNode getStaticProperty(ClassNode cNode, String propName) {
ClassNode classNode = cNode;
while (classNode != null) {
for (PropertyNode pn : classNode.getProperties()) {
if (pn.getName().equals(propName) && pn.isStatic()) return pn;
}
... | java | public static PropertyNode getStaticProperty(ClassNode cNode, String propName) {
ClassNode classNode = cNode;
while (classNode != null) {
for (PropertyNode pn : classNode.getProperties()) {
if (pn.getName().equals(propName) && pn.isStatic()) return pn;
}
... | [
"public",
"static",
"PropertyNode",
"getStaticProperty",
"(",
"ClassNode",
"cNode",
",",
"String",
"propName",
")",
"{",
"ClassNode",
"classNode",
"=",
"cNode",
";",
"while",
"(",
"classNode",
"!=",
"null",
")",
"{",
"for",
"(",
"PropertyNode",
"pn",
":",
"c... | Detect whether a static property with the given name is within the class
or a super class.
@param cNode the ClassNode of interest
@param propName the property name
@return the static property if found or else null | [
"Detect",
"whether",
"a",
"static",
"property",
"with",
"the",
"given",
"name",
"is",
"within",
"the",
"class",
"or",
"a",
"super",
"class",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L319-L328 |
13,231 | apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.samePackageName | public static boolean samePackageName(ClassNode first, ClassNode second) {
return Objects.equals(first.getPackageName(), second.getPackageName());
} | java | public static boolean samePackageName(ClassNode first, ClassNode second) {
return Objects.equals(first.getPackageName(), second.getPackageName());
} | [
"public",
"static",
"boolean",
"samePackageName",
"(",
"ClassNode",
"first",
",",
"ClassNode",
"second",
")",
"{",
"return",
"Objects",
".",
"equals",
"(",
"first",
".",
"getPackageName",
"(",
")",
",",
"second",
".",
"getPackageName",
"(",
")",
")",
";",
... | Determine if the given ClassNode values have the same package name.
@param first a ClassNode
@param second a ClassNode
@return true if both given nodes have the same package name
@throws NullPointerException if either of the given nodes are null | [
"Determine",
"if",
"the",
"given",
"ClassNode",
"values",
"have",
"the",
"same",
"package",
"name",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L385-L387 |
13,232 | apache/groovy | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java | Groovy.computeScriptName | private String computeScriptName() {
if (srcFile != null) {
return srcFile.getAbsolutePath();
} else {
String name = PREFIX;
if (getLocation().getFileName().length() > 0)
name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\... | java | private String computeScriptName() {
if (srcFile != null) {
return srcFile.getAbsolutePath();
} else {
String name = PREFIX;
if (getLocation().getFileName().length() > 0)
name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\... | [
"private",
"String",
"computeScriptName",
"(",
")",
"{",
"if",
"(",
"srcFile",
"!=",
"null",
")",
"{",
"return",
"srcFile",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"else",
"{",
"String",
"name",
"=",
"PREFIX",
";",
"if",
"(",
"getLocation",
"(",
")... | Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception
@return the name to use when compiling the script | [
"Try",
"to",
"build",
"a",
"script",
"name",
"for",
"the",
"script",
"of",
"the",
"groovy",
"task",
"to",
"have",
"an",
"helpful",
"value",
"in",
"stack",
"traces",
"in",
"case",
"of",
"exception"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java#L620-L632 |
13,233 | apache/groovy | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java | Groovy.printResults | protected void printResults(PrintStream out) {
log.debug("printResults()");
StringBuilder line = new StringBuilder();
out.println(line);
out.println();
} | java | protected void printResults(PrintStream out) {
log.debug("printResults()");
StringBuilder line = new StringBuilder();
out.println(line);
out.println();
} | [
"protected",
"void",
"printResults",
"(",
"PrintStream",
"out",
")",
"{",
"log",
".",
"debug",
"(",
"\"printResults()\"",
")",
";",
"StringBuilder",
"line",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"out",
".",
"println",
"(",
"line",
")",
";",
"out",
... | print any results in the statement.
@param out the output PrintStream to print to | [
"print",
"any",
"results",
"in",
"the",
"statement",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java#L652-L657 |
13,234 | apache/groovy | src/main/java/org/codehaus/groovy/antlr/java/PreJava2GroovyConverter.java | PreJava2GroovyConverter.swapTwoChildren | public void swapTwoChildren(GroovySourceAST t) {
// this swaps the two child nodes, see javadoc above for explanation of implementation
GroovySourceAST a = (GroovySourceAST) t.getFirstChild();
GroovySourceAST b = (GroovySourceAST) a.getNextSibling();
t.setFirstChild(b);
a.setNex... | java | public void swapTwoChildren(GroovySourceAST t) {
// this swaps the two child nodes, see javadoc above for explanation of implementation
GroovySourceAST a = (GroovySourceAST) t.getFirstChild();
GroovySourceAST b = (GroovySourceAST) a.getNextSibling();
t.setFirstChild(b);
a.setNex... | [
"public",
"void",
"swapTwoChildren",
"(",
"GroovySourceAST",
"t",
")",
"{",
"// this swaps the two child nodes, see javadoc above for explanation of implementation",
"GroovySourceAST",
"a",
"=",
"(",
"GroovySourceAST",
")",
"t",
".",
"getFirstChild",
"(",
")",
";",
"GroovyS... | To swap two children of node t...
<pre>
(t)
|
|
(a) -- (b)
t.down = firstNode
a.right = b
b.right = null
</pre>
becomes
<pre>
(t)
|
|
(b) -- (a)
t.down = b
a.right = null
b.right = a
</pre>
todo - build API of basic tree mutations like this method. | [
"To",
"swap",
"two",
"children",
"of",
"node",
"t",
"..."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/antlr/java/PreJava2GroovyConverter.java#L116-L124 |
13,235 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/StackTraceUtils.java | StackTraceUtils.extractRootCause | public static Throwable extractRootCause(Throwable t) {
Throwable result = t;
while (result.getCause() != null) {
result = result.getCause();
}
return result;
} | java | public static Throwable extractRootCause(Throwable t) {
Throwable result = t;
while (result.getCause() != null) {
result = result.getCause();
}
return result;
} | [
"public",
"static",
"Throwable",
"extractRootCause",
"(",
"Throwable",
"t",
")",
"{",
"Throwable",
"result",
"=",
"t",
";",
"while",
"(",
"result",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"result",
"=",
"result",
".",
"getCause",
"(",
")",
"... | Extracts the root cause of the exception, no matter how nested it is
@param t a Throwable
@return The deepest cause of the exception that can be found | [
"Extracts",
"the",
"root",
"cause",
"of",
"the",
"exception",
"no",
"matter",
"how",
"nested",
"it",
"is"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/StackTraceUtils.java#L159-L165 |
13,236 | apache/groovy | src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java | MethodCallExpression.getMethodAsString | public String getMethodAsString() {
if (! (method instanceof ConstantExpression)) return null;
ConstantExpression constant = (ConstantExpression) method;
return constant.getText();
} | java | public String getMethodAsString() {
if (! (method instanceof ConstantExpression)) return null;
ConstantExpression constant = (ConstantExpression) method;
return constant.getText();
} | [
"public",
"String",
"getMethodAsString",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"method",
"instanceof",
"ConstantExpression",
")",
")",
"return",
"null",
";",
"ConstantExpression",
"constant",
"=",
"(",
"ConstantExpression",
")",
"method",
";",
"return",
"constant"... | This method returns the method name as String if it is no dynamic
calculated method name, but a constant. | [
"This",
"method",
"returns",
"the",
"method",
"name",
"as",
"String",
"if",
"it",
"is",
"no",
"dynamic",
"calculated",
"method",
"name",
"but",
"a",
"constant",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java#L112-L116 |
13,237 | apache/groovy | subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java | SystemOutputInterceptor.write | public void write(int b) throws IOException {
Boolean result = (Boolean) callback.call(consoleId.get(), String.valueOf((char) b));
if (result) {
out.write(b);
}
} | java | public void write(int b) throws IOException {
Boolean result = (Boolean) callback.call(consoleId.get(), String.valueOf((char) b));
if (result) {
out.write(b);
}
} | [
"public",
"void",
"write",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"Boolean",
"result",
"=",
"(",
"Boolean",
")",
"callback",
".",
"call",
"(",
"consoleId",
".",
"get",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"(",
"char",
")",
"b",
... | Intercepts output - single characters | [
"Intercepts",
"output",
"-",
"single",
"characters"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java#L108-L113 |
13,238 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingContext.java | TypeCheckingContext.pushEnclosingMethodCall | public void pushEnclosingMethodCall(Expression call) {
if (call instanceof MethodCallExpression || call instanceof StaticMethodCallExpression) {
enclosingMethodCalls.addFirst(call);
} else {
throw new IllegalArgumentException("Expression must be a method call or a static method c... | java | public void pushEnclosingMethodCall(Expression call) {
if (call instanceof MethodCallExpression || call instanceof StaticMethodCallExpression) {
enclosingMethodCalls.addFirst(call);
} else {
throw new IllegalArgumentException("Expression must be a method call or a static method c... | [
"public",
"void",
"pushEnclosingMethodCall",
"(",
"Expression",
"call",
")",
"{",
"if",
"(",
"call",
"instanceof",
"MethodCallExpression",
"||",
"call",
"instanceof",
"StaticMethodCallExpression",
")",
"{",
"enclosingMethodCalls",
".",
"addFirst",
"(",
"call",
")",
... | Pushes a method call into the method call stack.
@param call the call expression to be pushed, either a {@link MethodCallExpression} or a {@link StaticMethodCallExpression} | [
"Pushes",
"a",
"method",
"call",
"into",
"the",
"method",
"call",
"stack",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingContext.java#L345-L351 |
13,239 | apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java | GeneralUtils.cmpX | public static BinaryExpression cmpX(Expression lhv, Expression rhv) {
return new BinaryExpression(lhv, CMP, rhv);
} | java | public static BinaryExpression cmpX(Expression lhv, Expression rhv) {
return new BinaryExpression(lhv, CMP, rhv);
} | [
"public",
"static",
"BinaryExpression",
"cmpX",
"(",
"Expression",
"lhv",
",",
"Expression",
"rhv",
")",
"{",
"return",
"new",
"BinaryExpression",
"(",
"lhv",
",",
"CMP",
",",
"rhv",
")",
";",
"}"
] | Build a binary expression that compares two values
@param lhv expression for the value to compare from
@param rhv expression for the value value to compare to
@return the expression comparing two values | [
"Build",
"a",
"binary",
"expression",
"that",
"compares",
"two",
"values"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java#L238-L240 |
13,240 | apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java | GeneralUtils.convertASTToSource | public static String convertASTToSource(ReaderSource readerSource, ASTNode expression) throws Exception {
if (expression == null) throw new IllegalArgumentException("Null: expression");
StringBuilder result = new StringBuilder();
for (int x = expression.getLineNumber(); x <= expression.getLastL... | java | public static String convertASTToSource(ReaderSource readerSource, ASTNode expression) throws Exception {
if (expression == null) throw new IllegalArgumentException("Null: expression");
StringBuilder result = new StringBuilder();
for (int x = expression.getLineNumber(); x <= expression.getLastL... | [
"public",
"static",
"String",
"convertASTToSource",
"(",
"ReaderSource",
"readerSource",
",",
"ASTNode",
"expression",
")",
"throws",
"Exception",
"{",
"if",
"(",
"expression",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null: expression\"",... | Converts an expression into the String source. Only some specific expressions like closure expression
support this.
@param readerSource a source
@param expression an expression. Can't be null
@return the source the closure was created from
@throws java.lang.IllegalArgumentException when expression is null
@throws java... | [
"Converts",
"an",
"expression",
"into",
"the",
"String",
"source",
".",
"Only",
"some",
"specific",
"expressions",
"like",
"closure",
"expression",
"support",
"this",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java#L834-L859 |
13,241 | apache/groovy | src/main/groovy/groovy/lang/ProxyMetaClass.java | ProxyMetaClass.getProperty | public Object getProperty(Class aClass, Object object, String property, boolean b, boolean b1) {
if (null == interceptor) {
return super.getProperty(aClass, object, property, b, b1);
}
if (interceptor instanceof PropertyAccessInterceptor) {
PropertyAccessInterceptor pae =... | java | public Object getProperty(Class aClass, Object object, String property, boolean b, boolean b1) {
if (null == interceptor) {
return super.getProperty(aClass, object, property, b, b1);
}
if (interceptor instanceof PropertyAccessInterceptor) {
PropertyAccessInterceptor pae =... | [
"public",
"Object",
"getProperty",
"(",
"Class",
"aClass",
",",
"Object",
"object",
",",
"String",
"property",
",",
"boolean",
"b",
",",
"boolean",
"b1",
")",
"{",
"if",
"(",
"null",
"==",
"interceptor",
")",
"{",
"return",
"super",
".",
"getProperty",
"... | Interceptors the call to getProperty if a PropertyAccessInterceptor is
available
@param object the object to invoke the getter on
@param property the property name
@return the value of the property | [
"Interceptors",
"the",
"call",
"to",
"getProperty",
"if",
"a",
"PropertyAccessInterceptor",
"is",
"available"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L176-L190 |
13,242 | apache/groovy | src/main/groovy/groovy/lang/ProxyMetaClass.java | ProxyMetaClass.setProperty | public void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1) {
if (null == interceptor) {
super.setProperty(aClass, object, property, newValue, b, b1);
}
if (interceptor instanceof PropertyAccessInterceptor) {
PropertyAcces... | java | public void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1) {
if (null == interceptor) {
super.setProperty(aClass, object, property, newValue, b, b1);
}
if (interceptor instanceof PropertyAccessInterceptor) {
PropertyAcces... | [
"public",
"void",
"setProperty",
"(",
"Class",
"aClass",
",",
"Object",
"object",
",",
"String",
"property",
",",
"Object",
"newValue",
",",
"boolean",
"b",
",",
"boolean",
"b1",
")",
"{",
"if",
"(",
"null",
"==",
"interceptor",
")",
"{",
"super",
".",
... | Interceptors the call to a property setter if a PropertyAccessInterceptor
is available
@param object The object to invoke the setter on
@param property The property name to set
@param newValue The new value of the property | [
"Interceptors",
"the",
"call",
"to",
"a",
"property",
"setter",
"if",
"a",
"PropertyAccessInterceptor",
"is",
"available"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L200-L214 |
13,243 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.includeGroovy | public void includeGroovy(String templatePath) throws IOException, ClassNotFoundException {
URL resource = engine.resolveTemplate(templatePath);
engine.createTypeCheckedModelTemplate(resource, modelTypes).make(model).writeTo(out);
} | java | public void includeGroovy(String templatePath) throws IOException, ClassNotFoundException {
URL resource = engine.resolveTemplate(templatePath);
engine.createTypeCheckedModelTemplate(resource, modelTypes).make(model).writeTo(out);
} | [
"public",
"void",
"includeGroovy",
"(",
"String",
"templatePath",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"URL",
"resource",
"=",
"engine",
".",
"resolveTemplate",
"(",
"templatePath",
")",
";",
"engine",
".",
"createTypeCheckedModelTemplate"... | Includes another template inside this template.
@param templatePath the path to the included resource.
@throws IOException
@throws ClassNotFoundException | [
"Includes",
"another",
"template",
"inside",
"this",
"template",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L303-L306 |
13,244 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.includeEscaped | public void includeEscaped(String templatePath) throws IOException {
URL resource = engine.resolveTemplate(templatePath);
yield(ResourceGroovyMethods.getText(resource, engine.getCompilerConfiguration().getSourceEncoding()));
} | java | public void includeEscaped(String templatePath) throws IOException {
URL resource = engine.resolveTemplate(templatePath);
yield(ResourceGroovyMethods.getText(resource, engine.getCompilerConfiguration().getSourceEncoding()));
} | [
"public",
"void",
"includeEscaped",
"(",
"String",
"templatePath",
")",
"throws",
"IOException",
"{",
"URL",
"resource",
"=",
"engine",
".",
"resolveTemplate",
"(",
"templatePath",
")",
";",
"yield",
"(",
"ResourceGroovyMethods",
".",
"getText",
"(",
"resource",
... | Includes contents of another file, not as a template but as escaped text.
@param templatePath the path to the other file
@throws IOException | [
"Includes",
"contents",
"of",
"another",
"file",
"not",
"as",
"a",
"template",
"but",
"as",
"escaped",
"text",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L315-L318 |
13,245 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.includeUnescaped | public void includeUnescaped(String templatePath) throws IOException {
URL resource = engine.resolveTemplate(templatePath);
yieldUnescaped(ResourceGroovyMethods.getText(resource, engine.getCompilerConfiguration().getSourceEncoding()));
} | java | public void includeUnescaped(String templatePath) throws IOException {
URL resource = engine.resolveTemplate(templatePath);
yieldUnescaped(ResourceGroovyMethods.getText(resource, engine.getCompilerConfiguration().getSourceEncoding()));
} | [
"public",
"void",
"includeUnescaped",
"(",
"String",
"templatePath",
")",
"throws",
"IOException",
"{",
"URL",
"resource",
"=",
"engine",
".",
"resolveTemplate",
"(",
"templatePath",
")",
";",
"yieldUnescaped",
"(",
"ResourceGroovyMethods",
".",
"getText",
"(",
"r... | Includes contents of another file, not as a template but as unescaped text.
@param templatePath the path to the other file
@throws IOException | [
"Includes",
"contents",
"of",
"another",
"file",
"not",
"as",
"a",
"template",
"but",
"as",
"unescaped",
"text",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L326-L329 |
13,246 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.layout | public Object layout(Map model, String templateName, boolean inheritModel) throws IOException, ClassNotFoundException {
Map submodel = inheritModel ? forkModel(model) : model;
URL resource = engine.resolveTemplate(templateName);
engine.createTypeCheckedModelTemplate(resource, modelTypes).make(su... | java | public Object layout(Map model, String templateName, boolean inheritModel) throws IOException, ClassNotFoundException {
Map submodel = inheritModel ? forkModel(model) : model;
URL resource = engine.resolveTemplate(templateName);
engine.createTypeCheckedModelTemplate(resource, modelTypes).make(su... | [
"public",
"Object",
"layout",
"(",
"Map",
"model",
",",
"String",
"templateName",
",",
"boolean",
"inheritModel",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"Map",
"submodel",
"=",
"inheritModel",
"?",
"forkModel",
"(",
"model",
")",
":",
... | Imports a template and renders it using the specified model, allowing fine grained composition of templates and
layouting. This works similarily to a template include but allows a distinct model to be used. If the layout
inherits from the parent model, a new model is created, with the values from the parent model, even... | [
"Imports",
"a",
"template",
"and",
"renders",
"it",
"using",
"the",
"specified",
"model",
"allowing",
"fine",
"grained",
"composition",
"of",
"templates",
"and",
"layouting",
".",
"This",
"works",
"similarily",
"to",
"a",
"template",
"include",
"but",
"allows",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L412-L417 |
13,247 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.contents | public Closure contents(final Closure cl) {
return new Closure(cl.getOwner(), cl.getThisObject()) {
private static final long serialVersionUID = -5733727697043906478L;
@Override
public Object call() {
cl.call();
return "";
}
... | java | public Closure contents(final Closure cl) {
return new Closure(cl.getOwner(), cl.getThisObject()) {
private static final long serialVersionUID = -5733727697043906478L;
@Override
public Object call() {
cl.call();
return "";
}
... | [
"public",
"Closure",
"contents",
"(",
"final",
"Closure",
"cl",
")",
"{",
"return",
"new",
"Closure",
"(",
"cl",
".",
"getOwner",
"(",
")",
",",
"cl",
".",
"getThisObject",
"(",
")",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"="... | Wraps a closure so that it can be used as a prototype for inclusion in layouts. This is useful when
you want to use a closure in a model, but that you don't want to render the result of the closure but instead
call it as if it was a specification of a template fragment.
@param cl the fragment to be wrapped
@return a wr... | [
"Wraps",
"a",
"closure",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"a",
"prototype",
"for",
"inclusion",
"in",
"layouts",
".",
"This",
"is",
"useful",
"when",
"you",
"want",
"to",
"use",
"a",
"closure",
"in",
"a",
"model",
"but",
"that",
"you",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L434-L456 |
13,248 | apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.writeTo | public Writer writeTo(final Writer out) throws IOException {
if (this.out!=null) {
// StackOverflow prevention
return NullWriter.DEFAULT;
}
try {
this.out = createWriter(out);
run();
return out;
} finally {
if (this.... | java | public Writer writeTo(final Writer out) throws IOException {
if (this.out!=null) {
// StackOverflow prevention
return NullWriter.DEFAULT;
}
try {
this.out = createWriter(out);
run();
return out;
} finally {
if (this.... | [
"public",
"Writer",
"writeTo",
"(",
"final",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"out",
"!=",
"null",
")",
"{",
"// StackOverflow prevention",
"return",
"NullWriter",
".",
"DEFAULT",
";",
"}",
"try",
"{",
"this",
"."... | Main method used to render a template.
@param out the Writer to which this Writable should output its data.
@return a writer instance
@throws IOException | [
"Main",
"method",
"used",
"to",
"render",
"a",
"template",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L464-L479 |
13,249 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.findTargetVariable | protected static Variable findTargetVariable(VariableExpression ve) {
final Variable accessedVariable = ve.getAccessedVariable() != null ? ve.getAccessedVariable() : ve;
if (accessedVariable != ve) {
if (accessedVariable instanceof VariableExpression)
return findTargetVariabl... | java | protected static Variable findTargetVariable(VariableExpression ve) {
final Variable accessedVariable = ve.getAccessedVariable() != null ? ve.getAccessedVariable() : ve;
if (accessedVariable != ve) {
if (accessedVariable instanceof VariableExpression)
return findTargetVariabl... | [
"protected",
"static",
"Variable",
"findTargetVariable",
"(",
"VariableExpression",
"ve",
")",
"{",
"final",
"Variable",
"accessedVariable",
"=",
"ve",
".",
"getAccessedVariable",
"(",
")",
"!=",
"null",
"?",
"ve",
".",
"getAccessedVariable",
"(",
")",
":",
"ve"... | Given a variable expression, returns the ultimately accessed variable.
@param ve a variable expression
@return the target variable | [
"Given",
"a",
"variable",
"expression",
"returns",
"the",
"ultimately",
"accessed",
"variable",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L289-L296 |
13,250 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams | static int allParametersAndArgumentsMatchWithDefaultParams(Parameter[] params, ClassNode[] args) {
int dist = 0;
ClassNode ptype = null;
// we already know the lengths are equal
for (int i = 0, j = 0; i < params.length; i++) {
Parameter param = params[i];
ClassNod... | java | static int allParametersAndArgumentsMatchWithDefaultParams(Parameter[] params, ClassNode[] args) {
int dist = 0;
ClassNode ptype = null;
// we already know the lengths are equal
for (int i = 0, j = 0; i < params.length; i++) {
Parameter param = params[i];
ClassNod... | [
"static",
"int",
"allParametersAndArgumentsMatchWithDefaultParams",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"int",
"dist",
"=",
"0",
";",
"ClassNode",
"ptype",
"=",
"null",
";",
"// we already know the lengths are equal",
... | Checks that arguments and parameter types match, expecting that the number of parameters is strictly greater
than the number of arguments, allowing possible inclusion of default parameters.
@param params method parameters
@param args type arguments
@return -1 if arguments do not match, 0 if arguments are of the exac... | [
"Checks",
"that",
"arguments",
"and",
"parameter",
"types",
"match",
"expecting",
"that",
"the",
"number",
"of",
"parameters",
"is",
"strictly",
"greater",
"than",
"the",
"number",
"of",
"arguments",
"allowing",
"possible",
"inclusion",
"of",
"default",
"parameter... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L384-L409 |
13,251 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.isWildcardLeftHandSide | public static boolean isWildcardLeftHandSide(final ClassNode node) {
if (OBJECT_TYPE.equals(node) ||
STRING_TYPE.equals(node) ||
boolean_TYPE.equals(node) ||
Boolean_TYPE.equals(node) ||
CLASS_Type.equals(node)) {
return true;
}... | java | public static boolean isWildcardLeftHandSide(final ClassNode node) {
if (OBJECT_TYPE.equals(node) ||
STRING_TYPE.equals(node) ||
boolean_TYPE.equals(node) ||
Boolean_TYPE.equals(node) ||
CLASS_Type.equals(node)) {
return true;
}... | [
"public",
"static",
"boolean",
"isWildcardLeftHandSide",
"(",
"final",
"ClassNode",
"node",
")",
"{",
"if",
"(",
"OBJECT_TYPE",
".",
"equals",
"(",
"node",
")",
"||",
"STRING_TYPE",
".",
"equals",
"(",
"node",
")",
"||",
"boolean_TYPE",
".",
"equals",
"(",
... | Tells if a class is one of the "accept all" classes as the left hand side of an
assignment.
@param node the classnode to test
@return true if it's an Object, String, boolean, Boolean or Class. | [
"Tells",
"if",
"a",
"class",
"is",
"one",
"of",
"the",
"accept",
"all",
"classes",
"as",
"the",
"left",
"hand",
"side",
"of",
"an",
"assignment",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L791-L800 |
13,252 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.parameterizeArguments | public static Parameter[] parameterizeArguments(final ClassNode receiver, final MethodNode m) {
Map<GenericsTypeName, GenericsType> genericFromReceiver = GenericsUtils.extractPlaceholders(receiver);
Map<GenericsTypeName, GenericsType> contextPlaceholders = extractGenericsParameterMapOfThis(m);
P... | java | public static Parameter[] parameterizeArguments(final ClassNode receiver, final MethodNode m) {
Map<GenericsTypeName, GenericsType> genericFromReceiver = GenericsUtils.extractPlaceholders(receiver);
Map<GenericsTypeName, GenericsType> contextPlaceholders = extractGenericsParameterMapOfThis(m);
P... | [
"public",
"static",
"Parameter",
"[",
"]",
"parameterizeArguments",
"(",
"final",
"ClassNode",
"receiver",
",",
"final",
"MethodNode",
"m",
")",
"{",
"Map",
"<",
"GenericsTypeName",
",",
"GenericsType",
">",
"genericFromReceiver",
"=",
"GenericsUtils",
".",
"extra... | Given a receiver and a method node, parameterize the method arguments using
available generic type information.
@param receiver the class
@param m the method
@return the parameterized arguments | [
"Given",
"a",
"receiver",
"and",
"a",
"method",
"node",
"parameterize",
"the",
"method",
"arguments",
"using",
"available",
"generic",
"type",
"information",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L1307-L1318 |
13,253 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.isUsingGenericsOrIsArrayUsingGenerics | public static boolean isUsingGenericsOrIsArrayUsingGenerics(ClassNode cn) {
if (cn.isArray()) {
return isUsingGenericsOrIsArrayUsingGenerics(cn.getComponentType());
}
return (cn.isUsingGenerics() && cn.getGenericsTypes() != null);
} | java | public static boolean isUsingGenericsOrIsArrayUsingGenerics(ClassNode cn) {
if (cn.isArray()) {
return isUsingGenericsOrIsArrayUsingGenerics(cn.getComponentType());
}
return (cn.isUsingGenerics() && cn.getGenericsTypes() != null);
} | [
"public",
"static",
"boolean",
"isUsingGenericsOrIsArrayUsingGenerics",
"(",
"ClassNode",
"cn",
")",
"{",
"if",
"(",
"cn",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"isUsingGenericsOrIsArrayUsingGenerics",
"(",
"cn",
".",
"getComponentType",
"(",
")",
")",
"... | Returns true if a class node makes use of generic types. If the class node represents an
array type, then checks if the component type is using generics.
@param cn a class node for which to check if it is using generics
@return true if the type (or component type) is using generics | [
"Returns",
"true",
"if",
"a",
"class",
"node",
"makes",
"use",
"of",
"generic",
"types",
".",
"If",
"the",
"class",
"node",
"represents",
"an",
"array",
"type",
"then",
"checks",
"if",
"the",
"component",
"type",
"is",
"using",
"generics",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L1351-L1356 |
13,254 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.fullyResolve | protected static GenericsType fullyResolve(GenericsType gt, Map<GenericsTypeName, GenericsType> placeholders) {
GenericsType fromMap = placeholders.get(new GenericsTypeName(gt.getName()));
if (gt.isPlaceholder() && fromMap != null) {
gt = fromMap;
}
ClassNode type = fullyRes... | java | protected static GenericsType fullyResolve(GenericsType gt, Map<GenericsTypeName, GenericsType> placeholders) {
GenericsType fromMap = placeholders.get(new GenericsTypeName(gt.getName()));
if (gt.isPlaceholder() && fromMap != null) {
gt = fromMap;
}
ClassNode type = fullyRes... | [
"protected",
"static",
"GenericsType",
"fullyResolve",
"(",
"GenericsType",
"gt",
",",
"Map",
"<",
"GenericsTypeName",
",",
"GenericsType",
">",
"placeholders",
")",
"{",
"GenericsType",
"fromMap",
"=",
"placeholders",
".",
"get",
"(",
"new",
"GenericsTypeName",
"... | Given a generics type representing SomeClass<T,V> and a resolved placeholder map, returns a new generics type
for which placeholders are resolved recursively. | [
"Given",
"a",
"generics",
"type",
"representing",
"SomeClass<",
";",
"T",
"V>",
";",
"and",
"a",
"resolved",
"placeholder",
"map",
"returns",
"a",
"new",
"generics",
"type",
"for",
"which",
"placeholders",
"are",
"resolved",
"recursively",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L1362-L1383 |
13,255 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics | protected static boolean typeCheckMethodArgumentWithGenerics(ClassNode parameterType, ClassNode argumentType, boolean lastArg) {
if (UNKNOWN_PARAMETER_TYPE == argumentType) {
// called with null
return !isPrimitiveType(parameterType);
}
if (!isAssignableTo(argumentType, p... | java | protected static boolean typeCheckMethodArgumentWithGenerics(ClassNode parameterType, ClassNode argumentType, boolean lastArg) {
if (UNKNOWN_PARAMETER_TYPE == argumentType) {
// called with null
return !isPrimitiveType(parameterType);
}
if (!isAssignableTo(argumentType, p... | [
"protected",
"static",
"boolean",
"typeCheckMethodArgumentWithGenerics",
"(",
"ClassNode",
"parameterType",
",",
"ClassNode",
"argumentType",
",",
"boolean",
"lastArg",
")",
"{",
"if",
"(",
"UNKNOWN_PARAMETER_TYPE",
"==",
"argumentType",
")",
"{",
"// called with null",
... | Checks that the parameterized generics of an argument are compatible with the generics of the parameter.
@param parameterType the parameter type of a method
@param argumentType the type of the argument passed to the method | [
"Checks",
"that",
"the",
"parameterized",
"generics",
"of",
"an",
"argument",
"are",
"compatible",
"with",
"the",
"generics",
"of",
"the",
"parameter",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L1421-L1455 |
13,256 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.boundUnboundedWildcards | static ClassNode boundUnboundedWildcards(ClassNode type) {
if (type.isArray()) {
return boundUnboundedWildcards(type.getComponentType()).makeArray();
}
ClassNode target = type.redirect();
if (target == null || type == target || !isUsingGenericsOrIsArrayUsingGenerics(target)) ... | java | static ClassNode boundUnboundedWildcards(ClassNode type) {
if (type.isArray()) {
return boundUnboundedWildcards(type.getComponentType()).makeArray();
}
ClassNode target = type.redirect();
if (target == null || type == target || !isUsingGenericsOrIsArrayUsingGenerics(target)) ... | [
"static",
"ClassNode",
"boundUnboundedWildcards",
"(",
"ClassNode",
"type",
")",
"{",
"if",
"(",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"boundUnboundedWildcards",
"(",
"type",
".",
"getComponentType",
"(",
")",
")",
".",
"makeArray",
"(",
")",... | Apply the bounds from the declared type when the using type simply declares a parameter as an unbounded wildcard.
@param type A parameterized type
@return A parameterized type with more precise wildcards | [
"Apply",
"the",
"bounds",
"from",
"the",
"declared",
"type",
"when",
"the",
"using",
"type",
"simply",
"declares",
"a",
"parameter",
"as",
"an",
"unbounded",
"wildcard",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2023-L2033 |
13,257 | apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.filterMethodsByVisibility | public static List<MethodNode> filterMethodsByVisibility(List<MethodNode> methodNodeList, ClassNode enclosingClassNode) {
if (!asBoolean(methodNodeList)) {
return StaticTypeCheckingVisitor.EMPTY_METHODNODE_LIST;
}
List<MethodNode> result = new LinkedList<>();
boolean isEncl... | java | public static List<MethodNode> filterMethodsByVisibility(List<MethodNode> methodNodeList, ClassNode enclosingClassNode) {
if (!asBoolean(methodNodeList)) {
return StaticTypeCheckingVisitor.EMPTY_METHODNODE_LIST;
}
List<MethodNode> result = new LinkedList<>();
boolean isEncl... | [
"public",
"static",
"List",
"<",
"MethodNode",
">",
"filterMethodsByVisibility",
"(",
"List",
"<",
"MethodNode",
">",
"methodNodeList",
",",
"ClassNode",
"enclosingClassNode",
")",
"{",
"if",
"(",
"!",
"asBoolean",
"(",
"methodNodeList",
")",
")",
"{",
"return",... | Filter methods according to visibility
@param methodNodeList method nodes to filter
@param enclosingClassNode the enclosing class
@return filtered method nodes
@since 3.0.0 | [
"Filter",
"methods",
"according",
"to",
"visibility"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2097-L2155 |
13,258 | apache/groovy | src/main/java/org/codehaus/groovy/antlr/treewalker/SourceCodeTraversal.java | SourceCodeTraversal.setUp | public void setUp(GroovySourceAST t) {
super.setUp(t);
// gather and sort all unvisited AST nodes
unvisitedNodes = new ArrayList<GroovySourceAST>();
traverse(t);
Collections.sort(unvisitedNodes);
} | java | public void setUp(GroovySourceAST t) {
super.setUp(t);
// gather and sort all unvisited AST nodes
unvisitedNodes = new ArrayList<GroovySourceAST>();
traverse(t);
Collections.sort(unvisitedNodes);
} | [
"public",
"void",
"setUp",
"(",
"GroovySourceAST",
"t",
")",
"{",
"super",
".",
"setUp",
"(",
"t",
")",
";",
"// gather and sort all unvisited AST nodes",
"unvisitedNodes",
"=",
"new",
"ArrayList",
"<",
"GroovySourceAST",
">",
"(",
")",
";",
"traverse",
"(",
"... | gather, sort and process all unvisited nodes
@param t the AST to process | [
"gather",
"sort",
"and",
"process",
"all",
"unvisited",
"nodes"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/antlr/treewalker/SourceCodeTraversal.java#L45-L52 |
13,259 | apache/groovy | subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/SimpleCache.java | SimpleCache.getSilent | public V getSilent(K key) {
V value = cache.get(key);
if (value != null) {
cache.remove(key);
cache.put(key, value);
}
return value;
} | java | public V getSilent(K key) {
V value = cache.get(key);
if (value != null) {
cache.remove(key);
cache.put(key, value);
}
return value;
} | [
"public",
"V",
"getSilent",
"(",
"K",
"key",
")",
"{",
"V",
"value",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"cache",
".",
"remove",
"(",
"key",
")",
";",
"cache",
".",
"put",
"(",
"key",
",... | For testing only | [
"For",
"testing",
"only"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/SimpleCache.java#L49-L56 |
13,260 | apache/groovy | subprojects/groovy-swing/src/main/java/groovy/model/DefaultTableColumn.java | DefaultTableColumn.getValue | public Object getValue(Object row, int rowIndex, int columnIndex) {
if (valueModel instanceof NestedValueModel) {
NestedValueModel nestedModel = (NestedValueModel) valueModel;
nestedModel.getSourceModel().setValue(row);
}
return valueModel.getValue();
} | java | public Object getValue(Object row, int rowIndex, int columnIndex) {
if (valueModel instanceof NestedValueModel) {
NestedValueModel nestedModel = (NestedValueModel) valueModel;
nestedModel.getSourceModel().setValue(row);
}
return valueModel.getValue();
} | [
"public",
"Object",
"getValue",
"(",
"Object",
"row",
",",
"int",
"rowIndex",
",",
"int",
"columnIndex",
")",
"{",
"if",
"(",
"valueModel",
"instanceof",
"NestedValueModel",
")",
"{",
"NestedValueModel",
"nestedModel",
"=",
"(",
"NestedValueModel",
")",
"valueMo... | Evaluates the value of a cell
@return the value
@param row the row of interest
@param rowIndex the index of the row of interest
@param columnIndex the column of interest | [
"Evaluates",
"the",
"value",
"of",
"a",
"cell"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/groovy/model/DefaultTableColumn.java#L56-L62 |
13,261 | apache/groovy | subprojects/groovy-servlet/src/main/java/groovy/servlet/GroovyServlet.java | GroovyServlet.init | public void init(ServletConfig config) throws ServletException {
super.init(config);
// Set up the scripting engine
gse = createGroovyScriptEngine();
servletContext.log("Groovy servlet initialized on " + gse + ".");
} | java | public void init(ServletConfig config) throws ServletException {
super.init(config);
// Set up the scripting engine
gse = createGroovyScriptEngine();
servletContext.log("Groovy servlet initialized on " + gse + ".");
} | [
"public",
"void",
"init",
"(",
"ServletConfig",
"config",
")",
"throws",
"ServletException",
"{",
"super",
".",
"init",
"(",
"config",
")",
";",
"// Set up the scripting engine",
"gse",
"=",
"createGroovyScriptEngine",
"(",
")",
";",
"servletContext",
".",
"log",
... | Initialize the GroovyServlet.
@throws ServletException
if this method encountered difficulties | [
"Initialize",
"the",
"GroovyServlet",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/GroovyServlet.java#L87-L94 |
13,262 | apache/groovy | subprojects/groovy-servlet/src/main/java/groovy/servlet/GroovyServlet.java | GroovyServlet.service | public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
// Get the script path from the request - include aware (GROOVY-815)
final String scriptUri = getScriptUri(request);
// Set it to HTML by default
response.setContentType("text/html; chars... | java | public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
// Get the script path from the request - include aware (GROOVY-815)
final String scriptUri = getScriptUri(request);
// Set it to HTML by default
response.setContentType("text/html; chars... | [
"public",
"void",
"service",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"// Get the script path from the request - include aware (GROOVY-815)",
"final",
"String",
"scriptUri",
"=",
"getScriptUri",
"(",
"req... | Handle web requests to the GroovyServlet | [
"Handle",
"web",
"requests",
"to",
"the",
"GroovyServlet"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/GroovyServlet.java#L99-L167 |
13,263 | apache/groovy | src/main/groovy/groovy/transform/builder/InitializerStrategy.java | InitializerStrategy.renameMethod | private static void renameMethod(ClassNode buildee, MethodNode mNode, String newName) {
buildee.addMethod(newName, mNode.getModifiers(), mNode.getReturnType(), mNode.getParameters(), mNode.getExceptions(), mNode.getCode());
buildee.removeMethod(mNode);
} | java | private static void renameMethod(ClassNode buildee, MethodNode mNode, String newName) {
buildee.addMethod(newName, mNode.getModifiers(), mNode.getReturnType(), mNode.getParameters(), mNode.getExceptions(), mNode.getCode());
buildee.removeMethod(mNode);
} | [
"private",
"static",
"void",
"renameMethod",
"(",
"ClassNode",
"buildee",
",",
"MethodNode",
"mNode",
",",
"String",
"newName",
")",
"{",
"buildee",
".",
"addMethod",
"(",
"newName",
",",
"mNode",
".",
"getModifiers",
"(",
")",
",",
"mNode",
".",
"getReturnT... | no rename so delete and add | [
"no",
"rename",
"so",
"delete",
"and",
"add"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/transform/builder/InitializerStrategy.java#L305-L308 |
13,264 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java | Memoize.buildMemoizeFunction | public static <V> Closure<V> buildMemoizeFunction(final MemoizeCache<Object, Object> cache, final Closure<V> closure) {
return new MemoizeFunction<V>(cache, closure);
} | java | public static <V> Closure<V> buildMemoizeFunction(final MemoizeCache<Object, Object> cache, final Closure<V> closure) {
return new MemoizeFunction<V>(cache, closure);
} | [
"public",
"static",
"<",
"V",
">",
"Closure",
"<",
"V",
">",
"buildMemoizeFunction",
"(",
"final",
"MemoizeCache",
"<",
"Object",
",",
"Object",
">",
"cache",
",",
"final",
"Closure",
"<",
"V",
">",
"closure",
")",
"{",
"return",
"new",
"MemoizeFunction",
... | Creates a new closure delegating to the supplied one and memoizing all return values by the arguments.
The supplied cache is used to store the memoized values and it is the cache's responsibility to put limits
on the cache size or implement cache eviction strategy.
The LRUCache, for example, allows to set the maximum ... | [
"Creates",
"a",
"new",
"closure",
"delegating",
"to",
"the",
"supplied",
"one",
"and",
"memoizing",
"all",
"return",
"values",
"by",
"the",
"arguments",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java#L54-L56 |
13,265 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java | Memoize.buildSoftReferenceMemoizeFunction | public static <V> Closure<V> buildSoftReferenceMemoizeFunction(final int protectedCacheSize, final MemoizeCache<Object, SoftReference<Object>> cache, final Closure<V> closure) {
final ProtectionStorage lruProtectionStorage = protectedCacheSize > 0 ?
new LRUProtectionStorage(protectedCacheSize) :... | java | public static <V> Closure<V> buildSoftReferenceMemoizeFunction(final int protectedCacheSize, final MemoizeCache<Object, SoftReference<Object>> cache, final Closure<V> closure) {
final ProtectionStorage lruProtectionStorage = protectedCacheSize > 0 ?
new LRUProtectionStorage(protectedCacheSize) :... | [
"public",
"static",
"<",
"V",
">",
"Closure",
"<",
"V",
">",
"buildSoftReferenceMemoizeFunction",
"(",
"final",
"int",
"protectedCacheSize",
",",
"final",
"MemoizeCache",
"<",
"Object",
",",
"SoftReference",
"<",
"Object",
">",
">",
"cache",
",",
"final",
"Clo... | Creates a new closure delegating to the supplied one and memoizing all return values by the arguments.
The memoizing closure will use SoftReferences to remember the return values allowing the garbage collector
to reclaim the memory, if needed.
The supplied cache is used to store the memoized values and it is the cache... | [
"Creates",
"a",
"new",
"closure",
"delegating",
"to",
"the",
"supplied",
"one",
"and",
"memoizing",
"all",
"return",
"values",
"by",
"the",
"arguments",
".",
"The",
"memoizing",
"closure",
"will",
"use",
"SoftReferences",
"to",
"remember",
"the",
"return",
"va... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java#L77-L85 |
13,266 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java | Memoize.generateKey | private static Object generateKey(final Object[] args) {
if (args == null) return Collections.emptyList();
Object[] copyOfArgs = copyOf(args, args.length);
return asList(copyOfArgs);
} | java | private static Object generateKey(final Object[] args) {
if (args == null) return Collections.emptyList();
Object[] copyOfArgs = copyOf(args, args.length);
return asList(copyOfArgs);
} | [
"private",
"static",
"Object",
"generateKey",
"(",
"final",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"Object",
"[",
"]",
"copyOfArgs",
"=",
"copyOf",
"(",
"arg... | Creates a key to use in the memoize cache
@param args The arguments supplied to the closure invocation
@return The key - a list holding all arguments | [
"Creates",
"a",
"key",
"to",
"use",
"in",
"the",
"memoize",
"cache"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/Memoize.java#L94-L98 |
13,267 | apache/groovy | src/main/java/org/codehaus/groovy/reflection/CachedClass.java | CachedClass.makeAccessible | private static AccessibleObject[] makeAccessible(final AccessibleObject[] aoa) {
try {
AccessibleObject.setAccessible(aoa, true);
return aoa;
} catch (Throwable outer) {
// swallow for strict security managers, module systems, android or others,
// but try... | java | private static AccessibleObject[] makeAccessible(final AccessibleObject[] aoa) {
try {
AccessibleObject.setAccessible(aoa, true);
return aoa;
} catch (Throwable outer) {
// swallow for strict security managers, module systems, android or others,
// but try... | [
"private",
"static",
"AccessibleObject",
"[",
"]",
"makeAccessible",
"(",
"final",
"AccessibleObject",
"[",
"]",
"aoa",
")",
"{",
"try",
"{",
"AccessibleObject",
".",
"setAccessible",
"(",
"aoa",
",",
"true",
")",
";",
"return",
"aoa",
";",
"}",
"catch",
"... | to be run in PrivilegedAction! | [
"to",
"be",
"run",
"in",
"PrivilegedAction!"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/reflection/CachedClass.java#L96-L114 |
13,268 | apache/groovy | src/main/groovy/groovy/lang/ExpandoMetaClassCreationHandle.java | ExpandoMetaClassCreationHandle.registerModifiedMetaClass | public void registerModifiedMetaClass(ExpandoMetaClass emc) {
final Class klazz = emc.getJavaClass();
GroovySystem.getMetaClassRegistry().setMetaClass(klazz,emc);
} | java | public void registerModifiedMetaClass(ExpandoMetaClass emc) {
final Class klazz = emc.getJavaClass();
GroovySystem.getMetaClassRegistry().setMetaClass(klazz,emc);
} | [
"public",
"void",
"registerModifiedMetaClass",
"(",
"ExpandoMetaClass",
"emc",
")",
"{",
"final",
"Class",
"klazz",
"=",
"emc",
".",
"getJavaClass",
"(",
")",
";",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
".",
"setMetaClass",
"(",
"klazz",
",",
"... | Registers a modified ExpandoMetaClass with the creation handle
@param emc The EMC | [
"Registers",
"a",
"modified",
"ExpandoMetaClass",
"with",
"the",
"creation",
"handle"
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClassCreationHandle.java#L59-L62 |
13,269 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static Writer leftShift(Writer self, Object value) throws IOException {
InvokerHelper.write(self, value);
return self;
} | java | public static Writer leftShift(Writer self, Object value) throws IOException {
InvokerHelper.write(self, value);
return self;
} | [
"public",
"static",
"Writer",
"leftShift",
"(",
"Writer",
"self",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"InvokerHelper",
".",
"write",
"(",
"self",
",",
"value",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the leftShift operator for Writer to allow an object to be written
using Groovy's default representation for the object.
@param self a Writer
@param value an Object whose default representation will be written to the Writer
@return the writer on which this operation was invoked
@throws IOException if an I/O... | [
"Overloads",
"the",
"leftShift",
"operator",
"for",
"Writer",
"to",
"allow",
"an",
"object",
"to",
"be",
"written",
"using",
"Groovy",
"s",
"default",
"representation",
"for",
"the",
"object",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L92-L95 |
13,270 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static Appendable leftShift(Appendable self, Object value) throws IOException {
InvokerHelper.append(self, value);
return self;
} | java | public static Appendable leftShift(Appendable self, Object value) throws IOException {
InvokerHelper.append(self, value);
return self;
} | [
"public",
"static",
"Appendable",
"leftShift",
"(",
"Appendable",
"self",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"InvokerHelper",
".",
"append",
"(",
"self",
",",
"value",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the leftShift operator for Appendable to allow an object to be appended
using Groovy's default representation for the object.
@param self an Appendable
@param value an Object whose default representation will be appended to the Appendable
@return the Appendable on which this operation was invoked
@throws IO... | [
"Overloads",
"the",
"leftShift",
"operator",
"for",
"Appendable",
"to",
"allow",
"an",
"object",
"to",
"be",
"appended",
"using",
"Groovy",
"s",
"default",
"representation",
"for",
"the",
"object",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L107-L110 |
13,271 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withFormatter | public static Appendable withFormatter(Appendable self, @ClosureParams(value=SimpleType.class, options="java.util.Formatter") Closure closure) {
Formatter formatter = new Formatter(self);
callWithFormatter(closure, formatter);
return self;
} | java | public static Appendable withFormatter(Appendable self, @ClosureParams(value=SimpleType.class, options="java.util.Formatter") Closure closure) {
Formatter formatter = new Formatter(self);
callWithFormatter(closure, formatter);
return self;
} | [
"public",
"static",
"Appendable",
"withFormatter",
"(",
"Appendable",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.util.Formatter\"",
")",
"Closure",
"closure",
")",
"{",
"Formatter",
"formatter",
... | Invokes a Closure that uses a Formatter taking care of resource handling.
A Formatter is created and passed to the Closure as its argument.
After the Closure executes, the Formatter is flushed and closed releasing any
associated resources.
@param self an Appendable
@param closure a 1-arg Closure which will be calle... | [
"Invokes",
"a",
"Closure",
"that",
"uses",
"a",
"Formatter",
"taking",
"care",
"of",
"resource",
"handling",
".",
"A",
"Formatter",
"is",
"created",
"and",
"passed",
"to",
"the",
"Closure",
"as",
"its",
"argument",
".",
"After",
"the",
"Closure",
"executes",... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L123-L127 |
13,272 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static Writer leftShift(OutputStream self, Object value) throws IOException {
OutputStreamWriter writer = new FlushingStreamWriter(self);
leftShift(writer, value);
return writer;
} | java | public static Writer leftShift(OutputStream self, Object value) throws IOException {
OutputStreamWriter writer = new FlushingStreamWriter(self);
leftShift(writer, value);
return writer;
} | [
"public",
"static",
"Writer",
"leftShift",
"(",
"OutputStream",
"self",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"OutputStreamWriter",
"writer",
"=",
"new",
"FlushingStreamWriter",
"(",
"self",
")",
";",
"leftShift",
"(",
"writer",
",",
"value"... | Overloads the leftShift operator to provide an append mechanism to add values to a stream.
@param self an OutputStream
@param value a value to append
@return a Writer
@throws java.io.IOException if an I/O error occurs.
@since 1.0 | [
"Overloads",
"the",
"leftShift",
"operator",
"to",
"provide",
"an",
"append",
"mechanism",
"to",
"add",
"values",
"to",
"a",
"stream",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L180-L184 |
13,273 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static OutputStream leftShift(OutputStream self, byte[] value) throws IOException {
self.write(value);
self.flush();
return self;
} | java | public static OutputStream leftShift(OutputStream self, byte[] value) throws IOException {
self.write(value);
self.flush();
return self;
} | [
"public",
"static",
"OutputStream",
"leftShift",
"(",
"OutputStream",
"self",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"self",
".",
"write",
"(",
"value",
")",
";",
"self",
".",
"flush",
"(",
")",
";",
"return",
"self",
";",
"... | Overloads the leftShift operator to provide an append mechanism to add bytes to a stream.
@param self an OutputStream
@param value a value to append
@return an OutputStream
@throws IOException if an I/O error occurs.
@since 1.0 | [
"Overloads",
"the",
"leftShift",
"operator",
"to",
"provide",
"an",
"append",
"mechanism",
"to",
"add",
"bytes",
"to",
"a",
"stream",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L225-L229 |
13,274 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withObjectOutputStream | public static <T> T withObjectOutputStream(OutputStream outputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectOutputStream") Closure<T> closure) throws IOException {
return withStream(newObjectOutputStream(outputStream), closure);
} | java | public static <T> T withObjectOutputStream(OutputStream outputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectOutputStream") Closure<T> closure) throws IOException {
return withStream(newObjectOutputStream(outputStream), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withObjectOutputStream",
"(",
"OutputStream",
"outputStream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.ObjectOutputStream\"",
")",
"Closure",
"<",
"T",
">",... | Create a new ObjectOutputStream for this output stream and then pass it to the
closure. This method ensures the stream is closed after the closure
returns.
@param outputStream am output stream
@param closure a closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@see #w... | [
"Create",
"a",
"new",
"ObjectOutputStream",
"for",
"this",
"output",
"stream",
"and",
"then",
"pass",
"it",
"to",
"the",
"closure",
".",
"This",
"method",
"ensures",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L255-L257 |
13,275 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.newObjectInputStream | public static ObjectInputStream newObjectInputStream(InputStream inputStream, final ClassLoader classLoader) throws IOException {
return new ObjectInputStream(inputStream) {
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
return Cl... | java | public static ObjectInputStream newObjectInputStream(InputStream inputStream, final ClassLoader classLoader) throws IOException {
return new ObjectInputStream(inputStream) {
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
return Cl... | [
"public",
"static",
"ObjectInputStream",
"newObjectInputStream",
"(",
"InputStream",
"inputStream",
",",
"final",
"ClassLoader",
"classLoader",
")",
"throws",
"IOException",
"{",
"return",
"new",
"ObjectInputStream",
"(",
"inputStream",
")",
"{",
"protected",
"Class",
... | Create an object input stream for this input stream using the given class loader.
@param inputStream an input stream
@param classLoader the class loader to use when loading the class
@return an object input stream
@throws IOException if an IOException occurs.
@since 1.5.0 | [
"Create",
"an",
"object",
"input",
"stream",
"for",
"this",
"input",
"stream",
"using",
"the",
"given",
"class",
"loader",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L280-L287 |
13,276 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachObject | public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
try {
while (true) {
try {
Object obj = ois.readObject();
// we allow null objects in the object stream
closu... | java | public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
try {
while (true) {
try {
Object obj = ois.readObject();
// we allow null objects in the object stream
closu... | [
"public",
"static",
"void",
"eachObject",
"(",
"ObjectInputStream",
"ois",
",",
"Closure",
"closure",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"Object",
"obj",
"=",
"ois",
".",
... | Iterates through the given object stream object by object. The
ObjectInputStream is closed afterwards.
@param ois an ObjectInputStream, closed after the operation
@param closure a closure
@throws IOException if an IOException occurs.
@throws ClassNotFoundException if the class is not found.
@since 1.0 | [
"Iterates",
"through",
"the",
"given",
"object",
"stream",
"object",
"by",
"object",
".",
"The",
"ObjectInputStream",
"is",
"closed",
"afterwards",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L299-L316 |
13,277 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachLine | public static <T> T eachLine(InputStream stream, String charset, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException {
return eachLine(new InputStreamReader(stream, charset), firstLine, closure);
} | java | public static <T> T eachLine(InputStream stream, String charset, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException {
return eachLine(new InputStreamReader(stream, charset), firstLine, closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"eachLine",
"(",
"InputStream",
"stream",
",",
"String",
"charset",
",",
"int",
"firstLine",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"String\"",
",",
"\... | Iterates through this stream reading with the provided charset, passing each line to
the given 1 or 2 arg closure. The stream is closed after this method returns.
@param stream a stream
@param charset opens the stream with a specified charset
@param firstLine the line number value used for the first line (defaul... | [
"Iterates",
"through",
"this",
"stream",
"reading",
"with",
"the",
"provided",
"charset",
"passing",
"each",
"line",
"to",
"the",
"given",
"1",
"or",
"2",
"arg",
"closure",
".",
"The",
"stream",
"is",
"closed",
"after",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L378-L380 |
13,278 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachLine | public static <T> T eachLine(Reader self, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException {
BufferedReader br;
int count = firstLine;
T result = null;
if (self instanceof BufferedReader)
br = (B... | java | public static <T> T eachLine(Reader self, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException {
BufferedReader br;
int count = firstLine;
T result = null;
if (self instanceof BufferedReader)
br = (B... | [
"public",
"static",
"<",
"T",
">",
"T",
"eachLine",
"(",
"Reader",
"self",
",",
"int",
"firstLine",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"String\"",
",",
"\"String,Integer\"",
"}",
")",
"Cl... | Iterates through the given reader line by line. Each line is passed to the
given 1 or 2 arg closure. If the closure has two arguments, the line count is passed
as the second argument. The Reader is closed before this method returns.
@param self a Reader, closed after the method returns
@param firstLine the line ... | [
"Iterates",
"through",
"the",
"given",
"reader",
"line",
"by",
"line",
".",
"Each",
"line",
"is",
"passed",
"to",
"the",
"given",
"1",
"or",
"2",
"arg",
"closure",
".",
"If",
"the",
"closure",
"has",
"two",
"arguments",
"the",
"line",
"count",
"is",
"p... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L441-L469 |
13,279 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.readLines | public static List<String> readLines(InputStream stream, String charset) throws IOException {
return readLines(newReader(stream, charset));
} | java | public static List<String> readLines(InputStream stream, String charset) throws IOException {
return readLines(newReader(stream, charset));
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"InputStream",
"stream",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"readLines",
"(",
"newReader",
"(",
"stream",
",",
"charset",
")",
")",
";",
"}"
] | Reads the stream into a list, with one element for each line.
@param stream a stream
@param charset opens the stream with a specified charset
@return a List of lines
@throws IOException if an IOException occurs.
@see #readLines(java.io.Reader)
@since 1.6.8 | [
"Reads",
"the",
"stream",
"into",
"a",
"list",
"with",
"one",
"element",
"for",
"each",
"line",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L783-L785 |
13,280 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.readLines | public static List<String> readLines(Reader reader) throws IOException {
IteratorClosureAdapter<String> closure = new IteratorClosureAdapter<String>(reader);
eachLine(reader, closure);
return closure.asList();
} | java | public static List<String> readLines(Reader reader) throws IOException {
IteratorClosureAdapter<String> closure = new IteratorClosureAdapter<String>(reader);
eachLine(reader, closure);
return closure.asList();
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"IteratorClosureAdapter",
"<",
"String",
">",
"closure",
"=",
"new",
"IteratorClosureAdapter",
"<",
"String",
">",
"(",
"reader",
")",
";",... | Reads the reader into a list of Strings, with one entry for each line.
The reader is closed before this method returns.
@param reader a Reader
@return a List of lines
@throws IOException if an IOException occurs.
@since 1.0 | [
"Reads",
"the",
"reader",
"into",
"a",
"list",
"of",
"Strings",
"with",
"one",
"entry",
"for",
"each",
"line",
".",
"The",
"reader",
"is",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L796-L800 |
13,281 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.getText | public static String getText(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
return getText(reader);
} | java | public static String getText(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
return getText(reader);
} | [
"public",
"static",
"String",
"getText",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
")",
")",
";",
"return",
"getText",
"(",
"reader",
")",
... | Read the content of this InputStream and return it as a String.
The stream is closed before this method returns.
@param is an input stream
@return the text from that URL
@throws IOException if an IOException occurs.
@since 1.0 | [
"Read",
"the",
"content",
"of",
"this",
"InputStream",
"and",
"return",
"it",
"as",
"a",
"String",
".",
"The",
"stream",
"is",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L811-L814 |
13,282 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.getText | public static String getText(Reader reader) throws IOException {
BufferedReader bufferedReader = new BufferedReader(reader);
return getText(bufferedReader);
} | java | public static String getText(Reader reader) throws IOException {
BufferedReader bufferedReader = new BufferedReader(reader);
return getText(bufferedReader);
} | [
"public",
"static",
"String",
"getText",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"bufferedReader",
"=",
"new",
"BufferedReader",
"(",
"reader",
")",
";",
"return",
"getText",
"(",
"bufferedReader",
")",
";",
"}"
] | Read the content of the Reader and return it as a String. The reader
is closed before this method returns.
@param reader a Reader whose content we want to read
@return a String containing the content of the buffered reader
@throws IOException if an IOException occurs.
@see #getText(java.io.BufferedReader)
@since 1.0 | [
"Read",
"the",
"content",
"of",
"the",
"Reader",
"and",
"return",
"it",
"as",
"a",
"String",
".",
"The",
"reader",
"is",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L841-L844 |
13,283 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.getText | public static String getText(BufferedReader reader) throws IOException {
StringBuilder answer = new StringBuilder();
// reading the content of the file within a char buffer
// allow to keep the correct line endings
char[] charBuffer = new char[8192];
int nbCharRead /* = 0*/;
... | java | public static String getText(BufferedReader reader) throws IOException {
StringBuilder answer = new StringBuilder();
// reading the content of the file within a char buffer
// allow to keep the correct line endings
char[] charBuffer = new char[8192];
int nbCharRead /* = 0*/;
... | [
"public",
"static",
"String",
"getText",
"(",
"BufferedReader",
"reader",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"answer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// reading the content of the file within a char buffer",
"// allow to keep the correct line en... | Read the content of the BufferedReader and return it as a String.
The BufferedReader is closed afterwards.
@param reader a BufferedReader whose content we want to read
@return a String containing the content of the buffered reader
@throws IOException if an IOException occurs.
@since 1.0 | [
"Read",
"the",
"content",
"of",
"the",
"BufferedReader",
"and",
"return",
"it",
"as",
"a",
"String",
".",
"The",
"BufferedReader",
"is",
"closed",
"afterwards",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L855-L873 |
13,284 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.iterator | public static Iterator<String> iterator(Reader self) {
final BufferedReader bufferedReader;
if (self instanceof BufferedReader)
bufferedReader = (BufferedReader) self;
else
bufferedReader = new BufferedReader(self);
return new Iterator<String>() {
Stri... | java | public static Iterator<String> iterator(Reader self) {
final BufferedReader bufferedReader;
if (self instanceof BufferedReader)
bufferedReader = (BufferedReader) self;
else
bufferedReader = new BufferedReader(self);
return new Iterator<String>() {
Stri... | [
"public",
"static",
"Iterator",
"<",
"String",
">",
"iterator",
"(",
"Reader",
"self",
")",
"{",
"final",
"BufferedReader",
"bufferedReader",
";",
"if",
"(",
"self",
"instanceof",
"BufferedReader",
")",
"bufferedReader",
"=",
"(",
"BufferedReader",
")",
"self",
... | Creates an iterator which will traverse through the reader a line at a time.
@param self a Reader object
@return an Iterator for the Reader
@see java.io.BufferedReader#readLine()
@since 1.5.0 | [
"Creates",
"an",
"iterator",
"which",
"will",
"traverse",
"through",
"the",
"reader",
"a",
"line",
"at",
"a",
"time",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L938-L986 |
13,285 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.iterator | public static Iterator<Byte> iterator(final DataInputStream self) {
return new Iterator<Byte>() {
Byte nextVal;
boolean nextMustRead = true;
boolean hasNext = true;
public boolean hasNext() {
if (nextMustRead && hasNext) {
try ... | java | public static Iterator<Byte> iterator(final DataInputStream self) {
return new Iterator<Byte>() {
Byte nextVal;
boolean nextMustRead = true;
boolean hasNext = true;
public boolean hasNext() {
if (nextMustRead && hasNext) {
try ... | [
"public",
"static",
"Iterator",
"<",
"Byte",
">",
"iterator",
"(",
"final",
"DataInputStream",
"self",
")",
"{",
"return",
"new",
"Iterator",
"<",
"Byte",
">",
"(",
")",
"{",
"Byte",
"nextVal",
";",
"boolean",
"nextMustRead",
"=",
"true",
";",
"boolean",
... | Standard iterator for a data input stream which iterates through the
stream content a Byte at a time.
@param self a DataInputStream object
@return an Iterator for the DataInputStream
@since 1.5.0 | [
"Standard",
"iterator",
"for",
"a",
"data",
"input",
"stream",
"which",
"iterates",
"through",
"the",
"stream",
"content",
"a",
"Byte",
"at",
"a",
"time",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1008-L1044 |
13,286 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.newReader | public static BufferedReader newReader(InputStream self, String charset) throws UnsupportedEncodingException {
return new BufferedReader(new InputStreamReader(self, charset));
} | java | public static BufferedReader newReader(InputStream self, String charset) throws UnsupportedEncodingException {
return new BufferedReader(new InputStreamReader(self, charset));
} | [
"public",
"static",
"BufferedReader",
"newReader",
"(",
"InputStream",
"self",
",",
"String",
"charset",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"self",
",",
"charset",
")",
")",
... | Creates a reader for this input stream, using the specified
charset as the encoding.
@param self an input stream
@param charset the charset for this input stream
@return a reader
@throws UnsupportedEncodingException if the encoding specified is not supported
@since 1.6.0 | [
"Creates",
"a",
"reader",
"for",
"this",
"input",
"stream",
"using",
"the",
"specified",
"charset",
"as",
"the",
"encoding",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1067-L1069 |
13,287 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withPrintWriter | public static <T> T withPrintWriter(Writer writer, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException {
return withWriter(newPrintWriter(writer), closure);
} | java | public static <T> T withPrintWriter(Writer writer, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException {
return withWriter(newPrintWriter(writer), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withPrintWriter",
"(",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.PrintWriter\"",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"th... | Create a new PrintWriter for this Writer. The writer is passed to the
closure, and will be closed before this method returns.
@param writer a writer
@param closure the closure to invoke with the PrintWriter
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.6.0 | [
"Create",
"a",
"new",
"PrintWriter",
"for",
"this",
"Writer",
".",
"The",
"writer",
"is",
"passed",
"to",
"the",
"closure",
"and",
"will",
"be",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1103-L1105 |
13,288 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withPrintWriter | public static <T> T withPrintWriter(OutputStream stream, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException {
return withWriter(newPrintWriter(stream), closure);
} | java | public static <T> T withPrintWriter(OutputStream stream, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException {
return withWriter(newPrintWriter(stream), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withPrintWriter",
"(",
"OutputStream",
"stream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.PrintWriter\"",
")",
"Closure",
"<",
"T",
">",
"closure",
")",... | Create a new PrintWriter for this OutputStream. The writer is passed to the
closure, and will be closed before this method returns.
@param stream an OutputStream
@param closure the closure to invoke with the PrintWriter
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 2.... | [
"Create",
"a",
"new",
"PrintWriter",
"for",
"this",
"OutputStream",
".",
"The",
"writer",
"is",
"passed",
"to",
"the",
"closure",
"and",
"will",
"be",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1117-L1119 |
13,289 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withWriter | public static <T> T withWriter(Writer writer, @ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(writer);
try {
writer.flush();
} catch (IOException e) {
// try to continue even in case of e... | java | public static <T> T withWriter(Writer writer, @ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(writer);
try {
writer.flush();
} catch (IOException e) {
// try to continue even in case of e... | [
"public",
"static",
"<",
"T",
">",
"T",
"withWriter",
"(",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException",
"{",
"try",
"{",
"T",
"result",
"=",
"clo... | Allows this writer to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param writer the writer which is used and then closed
@param closure the closure that the writer is passed into
@return the value returned by the closure
@throws IOException if an IOException occurs.
... | [
"Allows",
"this",
"writer",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"flushed",
"and",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1131-L1147 |
13,290 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withStream | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(stream);
InputStream temp = stream;
stream = null;
temp.close();
return resu... | java | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(stream);
InputStream temp = stream;
stream = null;
temp.close();
return resu... | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"InputStream",
">",
"T",
"withStream",
"(",
"U",
"stream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException"... | Allows this input stream to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param stream the stream which is used and then closed
@param closure the closure that the stream is passed into
@return the value returned by the closure
@throws IOException if an IOException oc... | [
"Allows",
"this",
"input",
"stream",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"flushed",
"and",
"closed",
"before",
"this",
"method",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1183-L1195 |
13,291 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withWriter | public static <T> T withWriter(OutputStream stream, @ClosureParams(value=SimpleType.class, options="java.io.Writer") Closure<T> closure) throws IOException {
return withWriter(new OutputStreamWriter(stream), closure);
} | java | public static <T> T withWriter(OutputStream stream, @ClosureParams(value=SimpleType.class, options="java.io.Writer") Closure<T> closure) throws IOException {
return withWriter(new OutputStreamWriter(stream), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withWriter",
"(",
"OutputStream",
"stream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.Writer\"",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws... | Creates a writer from this stream, passing it to the given closure.
This method ensures the stream is closed after the closure returns.
@param stream the stream which is used and then closed
@param closure the closure that the writer is passed into
@return the value returned by the closure
@throws IOException if an I... | [
"Creates",
"a",
"writer",
"from",
"this",
"stream",
"passing",
"it",
"to",
"the",
"given",
"closure",
".",
"This",
"method",
"ensures",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1241-L1243 |
13,292 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.newWriter | public static Writer newWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
return new OutputStreamWriter(stream, charset);
} | java | public static Writer newWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
return new OutputStreamWriter(stream, charset);
} | [
"public",
"static",
"Writer",
"newWriter",
"(",
"OutputStream",
"stream",
",",
"String",
"charset",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"new",
"OutputStreamWriter",
"(",
"stream",
",",
"charset",
")",
";",
"}"
] | Creates a writer for this stream using the given charset.
@param stream the stream which is used and then closed
@param charset the charset used
@return the newly created Writer
@throws UnsupportedEncodingException if an encoding exception occurs.
@since 2.2.0 | [
"Creates",
"a",
"writer",
"for",
"this",
"stream",
"using",
"the",
"given",
"charset",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1281-L1283 |
13,293 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withStream | public static <T, U extends OutputStream> T withStream(U os, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(os);
os.flush();
OutputStream temp = os;
os = null;
temp.close();
r... | java | public static <T, U extends OutputStream> T withStream(U os, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(os);
os.flush();
OutputStream temp = os;
os = null;
temp.close();
r... | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"OutputStream",
">",
"T",
"withStream",
"(",
"U",
"os",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException",
... | Passes this OutputStream to the closure, ensuring that the stream
is closed after the closure returns, regardless of errors.
@param os the stream which is used and then closed
@param closure the closure that the stream is passed into
@return the value returned by the closure
@throws IOException if an IOException ... | [
"Passes",
"this",
"OutputStream",
"to",
"the",
"closure",
"ensuring",
"that",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"regardless",
"of",
"errors",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1295-L1308 |
13,294 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachByte | public static void eachByte(InputStream is, @ClosureParams(value=SimpleType.class, options="byte") Closure closure) throws IOException {
try {
while (true) {
int b = is.read();
if (b == -1) {
break;
} else {
clos... | java | public static void eachByte(InputStream is, @ClosureParams(value=SimpleType.class, options="byte") Closure closure) throws IOException {
try {
while (true) {
int b = is.read();
if (b == -1) {
break;
} else {
clos... | [
"public",
"static",
"void",
"eachByte",
"(",
"InputStream",
"is",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"byte\"",
")",
"Closure",
"closure",
")",
"throws",
"IOException",
"{",
"try",
"{",
"while",
... | Traverse through each byte of the specified stream. The
stream is closed after the closure returns.
@param is stream to iterate over, closed after the method call
@param closure closure to apply to each byte
@throws IOException if an IOException occurs.
@since 1.0 | [
"Traverse",
"through",
"each",
"byte",
"of",
"the",
"specified",
"stream",
".",
"The",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1319-L1336 |
13,295 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachByte | public static void eachByte(InputStream is, int bufferLen, @ClosureParams(value=FromString.class, options="byte[],Integer") Closure closure) throws IOException {
byte[] buffer = new byte[bufferLen];
int bytesRead;
try {
while ((bytesRead = is.read(buffer, 0, bufferLen)) > 0) {
... | java | public static void eachByte(InputStream is, int bufferLen, @ClosureParams(value=FromString.class, options="byte[],Integer") Closure closure) throws IOException {
byte[] buffer = new byte[bufferLen];
int bytesRead;
try {
while ((bytesRead = is.read(buffer, 0, bufferLen)) > 0) {
... | [
"public",
"static",
"void",
"eachByte",
"(",
"InputStream",
"is",
",",
"int",
"bufferLen",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"\"byte[],Integer\"",
")",
"Closure",
"closure",
")",
"throws",
"IOExcepti... | Traverse through each the specified stream reading bytes into a buffer
and calling the 2 parameter closure with this buffer and the number of bytes.
@param is stream to iterate over, closed after the method call.
@param bufferLen the length of the buffer to use.
@param closure a 2 parameter closure which is p... | [
"Traverse",
"through",
"each",
"the",
"specified",
"stream",
"reading",
"bytes",
"into",
"a",
"buffer",
"and",
"calling",
"the",
"2",
"parameter",
"closure",
"with",
"this",
"buffer",
"and",
"the",
"number",
"of",
"bytes",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1348-L1362 |
13,296 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.transformLine | public static void transformLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
... | java | public static void transformLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
... | [
"public",
"static",
"void",
"transformLine",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"closure",
")",
"throws",
"IOE... | Transforms the lines from a reader with a Closure and
write them to a writer. Both Reader and Writer are
closed after the operation.
@param reader Lines of text to be transformed. Reader is closed afterwards.
@param writer Where transformed lines are written. Writer is closed afterwards.
@param closure Single parame... | [
"Transforms",
"the",
"lines",
"from",
"a",
"reader",
"with",
"a",
"Closure",
"and",
"write",
"them",
"to",
"a",
"writer",
".",
"Both",
"Reader",
"and",
"Writer",
"are",
"closed",
"after",
"the",
"operation",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1413-L1439 |
13,297 | apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.filterLine | public static void filterLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
... | java | public static void filterLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
... | [
"public",
"static",
"void",
"filterLine",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"closure",
")",
"throws",
"IOExce... | Filter the lines from a reader and write them on the writer,
according to a closure which returns true if the line should be included.
Both Reader and Writer are closed after the operation.
@param reader a reader, closed after the call
@param writer a writer, closed after the call
@param closure the closure which re... | [
"Filter",
"the",
"lines",
"from",
"a",
"reader",
"and",
"write",
"them",
"on",
"the",
"writer",
"according",
"to",
"a",
"closure",
"which",
"returns",
"true",
"if",
"the",
"line",
"should",
"be",
"included",
".",
"Both",
"Reader",
"and",
"Writer",
"are",
... | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1452-L1479 |
13,298 | apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.putAt | public static void putAt(Date self, int field, int value) {
Calendar cal = Calendar.getInstance();
cal.setTime(self);
putAt(cal, field, value);
self.setTime(cal.getTimeInMillis());
} | java | public static void putAt(Date self, int field, int value) {
Calendar cal = Calendar.getInstance();
cal.setTime(self);
putAt(cal, field, value);
self.setTime(cal.getTimeInMillis());
} | [
"public",
"static",
"void",
"putAt",
"(",
"Date",
"self",
",",
"int",
"field",
",",
"int",
"value",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"self",
")",
";",
"putAt",
"(",
"cal",
... | Support the subscript operator for mutating a Date.
@param self A Date
@param field A Calendar field, e.g. MONTH
@param value The value for the given field, e.g. FEBRUARY
@see #putAt(java.util.Calendar, int, int)
@see java.util.Calendar#set(int, int)
@since 1.7.3 | [
"Support",
"the",
"subscript",
"operator",
"for",
"mutating",
"a",
"Date",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L111-L116 |
13,299 | apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.plus | public static Timestamp plus(Timestamp self, int days) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(self);
calendar.add(Calendar.DATE, days);
Timestamp ts = new Timestamp(calendar.getTime().getTime());
ts.setNanos(self.getNanos());
return ts;
} | java | public static Timestamp plus(Timestamp self, int days) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(self);
calendar.add(Calendar.DATE, days);
Timestamp ts = new Timestamp(calendar.getTime().getTime());
ts.setNanos(self.getNanos());
return ts;
} | [
"public",
"static",
"Timestamp",
"plus",
"(",
"Timestamp",
"self",
",",
"int",
"days",
")",
"{",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"setTime",
"(",
"self",
")",
";",
"calendar",
".",
"add",
"(",
... | Add number of days to this Timestamp and returns the new Timestamp object.
@param self a Timestamp
@param days the number of days to increase
@return the new Timestamp | [
"Add",
"number",
"of",
"days",
"to",
"this",
"Timestamp",
"and",
"returns",
"the",
"new",
"Timestamp",
"object",
"."
] | 71cf20addb611bb8d097a59e395fd20bc7f31772 | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L403-L410 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.