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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.setMappers | private void setMappers(ObjectMapper mapper, XmlMapper xml) {
synchronized (lock) {
this.mapper = mapper;
this.xml = xml;
// mapper and xml are set to null on invalidation.
if (mapper != null && xml != null) {
applyMapperConfiguration(mapper, xml);... | java | private void setMappers(ObjectMapper mapper, XmlMapper xml) {
synchronized (lock) {
this.mapper = mapper;
this.xml = xml;
// mapper and xml are set to null on invalidation.
if (mapper != null && xml != null) {
applyMapperConfiguration(mapper, xml);... | [
"private",
"void",
"setMappers",
"(",
"ObjectMapper",
"mapper",
",",
"XmlMapper",
"xml",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"this",
".",
"mapper",
"=",
"mapper",
";",
"this",
".",
"xml",
"=",
"xml",
";",
"// mapper and xml are set to null on inva... | Sets the object mapper.
@param mapper the object mapper to use | [
"Sets",
"the",
"object",
"mapper",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L287-L296 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.register | @Override
public void register(Module module) {
if (module == null) {
return;
}
LOGGER.info("Adding JSON module {}", module.getModuleName());
synchronized (lock) {
modules.add(module);
rebuildMappers();
}
} | java | @Override
public void register(Module module) {
if (module == null) {
return;
}
LOGGER.info("Adding JSON module {}", module.getModuleName());
synchronized (lock) {
modules.add(module);
rebuildMappers();
}
} | [
"@",
"Override",
"public",
"void",
"register",
"(",
"Module",
"module",
")",
"{",
"if",
"(",
"module",
"==",
"null",
")",
"{",
"return",
";",
"}",
"LOGGER",
".",
"info",
"(",
"\"Adding JSON module {}\"",
",",
"module",
".",
"getModuleName",
"(",
")",
")"... | Registers a new Jackson Module.
@param module the module to register | [
"Registers",
"a",
"new",
"Jackson",
"Module",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L384-L394 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.unregister | @Override
public void unregister(Module module) {
if (module == null) {
// May happen on departure.
return;
}
LOGGER.info("Removing Jackson module {}", module.getModuleName());
synchronized (lock) {
if (modules.remove(module)) {
reb... | java | @Override
public void unregister(Module module) {
if (module == null) {
// May happen on departure.
return;
}
LOGGER.info("Removing Jackson module {}", module.getModuleName());
synchronized (lock) {
if (modules.remove(module)) {
reb... | [
"@",
"Override",
"public",
"void",
"unregister",
"(",
"Module",
"module",
")",
"{",
"if",
"(",
"module",
"==",
"null",
")",
"{",
"// May happen on departure.",
"return",
";",
"}",
"LOGGER",
".",
"info",
"(",
"\"Removing Jackson module {}\"",
",",
"module",
"."... | Un-registers a JSON Module.
@param module the module | [
"Un",
"-",
"registers",
"a",
"JSON",
"Module",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L415-L427 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.fromInputStream | @Override
public Document fromInputStream(InputStream stream, Charset encoding) throws IOException {
try {
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(stream);
if (encoding == null) {
is.setEncoding(Charsets.UT... | java | @Override
public Document fromInputStream(InputStream stream, Charset encoding) throws IOException {
try {
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(stream);
if (encoding == null) {
is.setEncoding(Charsets.UT... | [
"@",
"Override",
"public",
"Document",
"fromInputStream",
"(",
"InputStream",
"stream",
",",
"Charset",
"encoding",
")",
"throws",
"IOException",
"{",
"try",
"{",
"DocumentBuilder",
"builder",
"=",
"factory",
".",
"newDocumentBuilder",
"(",
")",
";",
"InputSource"... | Builds a new XML Document from the given input stream. The stream is not closed by this method,
and so you must close it.
@param stream the input stream, must not be {@literal null}
@param encoding the encoding, if {@literal null}, UTF-8 is used.
@return the built document
@throws java.io.IOException if the given st... | [
"Builds",
"a",
"new",
"XML",
"Document",
"from",
"the",
"given",
"input",
"stream",
".",
"The",
"stream",
"is",
"not",
"closed",
"by",
"this",
"method",
"and",
"so",
"you",
"must",
"close",
"it",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L477-L494 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.stringify | @Override
public String stringify(Document document) {
try {
StringWriter sw = new StringWriter();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLAR... | java | @Override
public String stringify(Document document) {
try {
StringWriter sw = new StringWriter();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLAR... | [
"@",
"Override",
"public",
"String",
"stringify",
"(",
"Document",
"document",
")",
"{",
"try",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"TransformerFactory",
"tf",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"T... | Retrieves the string form of the given XML document.
@param document the XML document, must not be {@literal null}
@return the String form of the object | [
"Retrieves",
"the",
"string",
"form",
"of",
"the",
"given",
"XML",
"document",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L530-L546 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.bindModule | @Bind(optional = true, aggregate = true)
public synchronized void bindModule(Module module) {
register(module);
} | java | @Bind(optional = true, aggregate = true)
public synchronized void bindModule(Module module) {
register(module);
} | [
"@",
"Bind",
"(",
"optional",
"=",
"true",
",",
"aggregate",
"=",
"true",
")",
"public",
"synchronized",
"void",
"bindModule",
"(",
"Module",
"module",
")",
"{",
"register",
"(",
"module",
")",
";",
"}"
] | Binds a module.
@param module the module | [
"Binds",
"a",
"module",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L566-L569 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java | Watchers.remove | public static synchronized boolean remove(MavenSession session, Watcher watcher) {
return !(session == null || watcher == null) && get(session).remove(watcher);
} | java | public static synchronized boolean remove(MavenSession session, Watcher watcher) {
return !(session == null || watcher == null) && get(session).remove(watcher);
} | [
"public",
"static",
"synchronized",
"boolean",
"remove",
"(",
"MavenSession",
"session",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"!",
"(",
"session",
"==",
"null",
"||",
"watcher",
"==",
"null",
")",
"&&",
"get",
"(",
"session",
")",
".",
"remove",
... | Un-registers a watcher.
@param session the Maven session
@param watcher the watcher to remove
@return {@literal true} if the watcher was removed, {@literal false} otherwise. | [
"Un",
"-",
"registers",
"a",
"watcher",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java#L67-L69 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java | Watchers.get | static synchronized List<Watcher> get(MavenSession session) {
List<Watcher> watchers = (List<Watcher>) session.getExecutionProperties().get(WATCHERS_KEY);
if (watchers == null) {
watchers = new ArrayList<>();
session.getExecutionProperties().put(WATCHERS_KEY, watchers);
}... | java | static synchronized List<Watcher> get(MavenSession session) {
List<Watcher> watchers = (List<Watcher>) session.getExecutionProperties().get(WATCHERS_KEY);
if (watchers == null) {
watchers = new ArrayList<>();
session.getExecutionProperties().put(WATCHERS_KEY, watchers);
}... | [
"static",
"synchronized",
"List",
"<",
"Watcher",
">",
"get",
"(",
"MavenSession",
"session",
")",
"{",
"List",
"<",
"Watcher",
">",
"watchers",
"=",
"(",
"List",
"<",
"Watcher",
">",
")",
"session",
".",
"getExecutionProperties",
"(",
")",
".",
"get",
"... | Gets the list of watchers from the given MavenSession.
@param session the Maven session
@return the list of watcher, empty if none. Modifying the resulting list, updates the stored list. | [
"Gets",
"the",
"list",
"of",
"watchers",
"from",
"the",
"given",
"MavenSession",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java#L88-L95 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java | Watchers.get | static synchronized List<Watcher> get(Context context) {
List<Watcher> watchers;
if (context.contains(WATCHERS_KEY)) {
try {
watchers = (List<Watcher>) context.get(WATCHERS_KEY);
} catch (ContextException e) {
throw new IllegalStateException("Canno... | java | static synchronized List<Watcher> get(Context context) {
List<Watcher> watchers;
if (context.contains(WATCHERS_KEY)) {
try {
watchers = (List<Watcher>) context.get(WATCHERS_KEY);
} catch (ContextException e) {
throw new IllegalStateException("Canno... | [
"static",
"synchronized",
"List",
"<",
"Watcher",
">",
"get",
"(",
"Context",
"context",
")",
"{",
"List",
"<",
"Watcher",
">",
"watchers",
";",
"if",
"(",
"context",
".",
"contains",
"(",
"WATCHERS_KEY",
")",
")",
"{",
"try",
"{",
"watchers",
"=",
"("... | Gets the list of watchers from the given Plexus context.
@param context the Plexus context
@return the list of watcher, empty if none. Modifying the resulting list, updates the stored list. | [
"Gets",
"the",
"list",
"of",
"watchers",
"from",
"the",
"given",
"Plexus",
"context",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Watchers.java#L103-L116 | train |
wisdom-framework/wisdom | framework/hibernate-validation-service/src/main/java/org/wisdom/validation/hibernate/ConstraintViolationSerializer.java | ConstraintViolationSerializer.serialize | @Override
public void serialize(ConstraintViolationImpl constraintViolation, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("message", constraintViolation.getMessage());
Object invalidV... | java | @Override
public void serialize(ConstraintViolationImpl constraintViolation, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("message", constraintViolation.getMessage());
Object invalidV... | [
"@",
"Override",
"public",
"void",
"serialize",
"(",
"ConstraintViolationImpl",
"constraintViolation",
",",
"JsonGenerator",
"jsonGenerator",
",",
"SerializerProvider",
"serializerProvider",
")",
"throws",
"IOException",
"{",
"jsonGenerator",
".",
"writeStartObject",
"(",
... | Writes the JSON form of the Constraint Violation.
@param constraintViolation the violation
@param jsonGenerator the generator
@param serializerProvider the provider
@throws IOException if it cannot be serialized | [
"Writes",
"the",
"JSON",
"form",
"of",
"the",
"Constraint",
"Violation",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/hibernate-validation-service/src/main/java/org/wisdom/validation/hibernate/ConstraintViolationSerializer.java#L54-L66 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java | ChameleonInstanceHolder.set | public static synchronized void set(Chameleon chameleon) {
if (INSTANCE != null && chameleon != null) {
throw new IllegalStateException("A Chameleon instance is already stored");
}
INSTANCE = chameleon;
if (chameleon == null) {
// Reset metadata
HOST_N... | java | public static synchronized void set(Chameleon chameleon) {
if (INSTANCE != null && chameleon != null) {
throw new IllegalStateException("A Chameleon instance is already stored");
}
INSTANCE = chameleon;
if (chameleon == null) {
// Reset metadata
HOST_N... | [
"public",
"static",
"synchronized",
"void",
"set",
"(",
"Chameleon",
"chameleon",
")",
"{",
"if",
"(",
"INSTANCE",
"!=",
"null",
"&&",
"chameleon",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"A Chameleon instance is already stored\"",
... | Stores a reference on a running chameleon.
@param chameleon the chameleon | [
"Stores",
"a",
"reference",
"on",
"a",
"running",
"chameleon",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java#L67-L78 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java | ChameleonInstanceHolder.retrieveServerMetadata | private static void retrieveServerMetadata() throws Exception {
if (get() == null) {
throw new IllegalStateException("Cannot retrieve the server metadata - no reference to Chameleon stored " +
"in the holder");
}
int factor = Integer.getInteger("time.factor", 1);... | java | private static void retrieveServerMetadata() throws Exception {
if (get() == null) {
throw new IllegalStateException("Cannot retrieve the server metadata - no reference to Chameleon stored " +
"in the holder");
}
int factor = Integer.getInteger("time.factor", 1);... | [
"private",
"static",
"void",
"retrieveServerMetadata",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"get",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot retrieve the server metadata - no reference to Chameleon stored \"",
... | Methods call by the test framework to discover the server name and port.
@throws Exception if the service is not running. | [
"Methods",
"call",
"by",
"the",
"test",
"framework",
"to",
"discover",
"the",
"server",
"name",
"and",
"port",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java#L168-L195 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ExecUtils.java | ExecUtils.isLinux | public static boolean isLinux(String os) {
if (os == null) {
return false;
}
String operating = os.toLowerCase();
return operating.contains("nix") || operating.contains("nux") || operating.contains("aix");
} | java | public static boolean isLinux(String os) {
if (os == null) {
return false;
}
String operating = os.toLowerCase();
return operating.contains("nix") || operating.contains("nux") || operating.contains("aix");
} | [
"public",
"static",
"boolean",
"isLinux",
"(",
"String",
"os",
")",
"{",
"if",
"(",
"os",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"operating",
"=",
"os",
".",
"toLowerCase",
"(",
")",
";",
"return",
"operating",
".",
"contains",
... | Checks whether the given operating system name is Linux, Unix, or AIX.
@param os the operating system name (value of the {@code os.name} system property
@return {@code true} if the os is Linux, Unix, or AIX, {@code false} otherwise. | [
"Checks",
"whether",
"the",
"given",
"operating",
"system",
"name",
"is",
"Linux",
"Unix",
"or",
"AIX",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ExecUtils.java#L179-L185 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ExecUtils.java | ExecUtils.is64bits | public static boolean is64bits() {
String arch = System.getProperty("sun.arch.data.model");
if (Strings.isNullOrEmpty(arch)) {
arch = System.getProperty("os.arch");
}
return is64bits(arch);
} | java | public static boolean is64bits() {
String arch = System.getProperty("sun.arch.data.model");
if (Strings.isNullOrEmpty(arch)) {
arch = System.getProperty("os.arch");
}
return is64bits(arch);
} | [
"public",
"static",
"boolean",
"is64bits",
"(",
")",
"{",
"String",
"arch",
"=",
"System",
".",
"getProperty",
"(",
"\"sun.arch.data.model\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"arch",
")",
")",
"{",
"arch",
"=",
"System",
".",
"... | Checks if the CPU architecture of the current computer is 64 bits.
@return {@code true} if the CPU architecture of the current computer is 64 bits. {@code false} otherwise. This
methods checks first the {@literal sun.arch.data.model} system's property and then the {@literal os.arch} one.
If none of these two propertie... | [
"Checks",
"if",
"the",
"CPU",
"architecture",
"of",
"the",
"current",
"computer",
"is",
"64",
"bits",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ExecUtils.java#L194-L200 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java | AbstractRouter.getReverseRouteFor | @Override
public String getReverseRouteFor(Controller controller, String method) {
return getReverseRouteFor(controller.getClass(), method, null);
} | java | @Override
public String getReverseRouteFor(Controller controller, String method) {
return getReverseRouteFor(controller.getClass(), method, null);
} | [
"@",
"Override",
"public",
"String",
"getReverseRouteFor",
"(",
"Controller",
"controller",
",",
"String",
"method",
")",
"{",
"return",
"getReverseRouteFor",
"(",
"controller",
".",
"getClass",
"(",
")",
",",
"method",
",",
"null",
")",
";",
"}"
] | Gets the url of the route handled by the specified action method. The action does not takes parameters.
@param controller the controller object
@param method the controller method
@return the url, {@literal null} if the action method is not found | [
"Gets",
"the",
"url",
"of",
"the",
"route",
"handled",
"by",
"the",
"specified",
"action",
"method",
".",
"The",
"action",
"does",
"not",
"takes",
"parameters",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L140-L143 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java | AbstractRouter.getReverseRouteFor | @Override
public String getReverseRouteFor(Controller controller, String method, String var1, Object val1) {
return getReverseRouteFor(controller, method, ImmutableMap.of(var1, val1));
} | java | @Override
public String getReverseRouteFor(Controller controller, String method, String var1, Object val1) {
return getReverseRouteFor(controller, method, ImmutableMap.of(var1, val1));
} | [
"@",
"Override",
"public",
"String",
"getReverseRouteFor",
"(",
"Controller",
"controller",
",",
"String",
"method",
",",
"String",
"var1",
",",
"Object",
"val1",
")",
"{",
"return",
"getReverseRouteFor",
"(",
"controller",
",",
"method",
",",
"ImmutableMap",
".... | Gets the url of the route handled by the specified action method.
@param controller the controller object
@param method the controller method
@param var1 the first parameter name
@param val1 the first parameter value
@return the url, {@literal null} if the action method is not found. | [
"Gets",
"the",
"url",
"of",
"the",
"route",
"handled",
"by",
"the",
"specified",
"action",
"method",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L154-L157 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java | JavaScriptCompilerMojo.isNotMinified | public boolean isNotMinified(File file) {
return !file.getName().endsWith("min.js")
&& !file.getName().endsWith(googleClosureMinifierSuffix + ".js");
} | java | public boolean isNotMinified(File file) {
return !file.getName().endsWith("min.js")
&& !file.getName().endsWith(googleClosureMinifierSuffix + ".js");
} | [
"public",
"boolean",
"isNotMinified",
"(",
"File",
"file",
")",
"{",
"return",
"!",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\"min.js\"",
")",
"&&",
"!",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"googleClosureMinifierSuffix",... | Checks whether or not the file is minified.
@param file the file to check
@return {@code true} if the file is minified, {@code false} otherwise. This method only check for the file
extension. | [
"Checks",
"whether",
"or",
"not",
"the",
"file",
"is",
"minified",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java#L342-L345 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java | JavaScriptCompilerMojo.getMinifiedFile | public File getMinifiedFile(File file) {
File output = getOutputFile(file);
return new File(output.getParentFile().getAbsoluteFile(),
output.getName().replace(".js", googleClosureMinifierSuffix + ".js"));
} | java | public File getMinifiedFile(File file) {
File output = getOutputFile(file);
return new File(output.getParentFile().getAbsoluteFile(),
output.getName().replace(".js", googleClosureMinifierSuffix + ".js"));
} | [
"public",
"File",
"getMinifiedFile",
"(",
"File",
"file",
")",
"{",
"File",
"output",
"=",
"getOutputFile",
"(",
"file",
")",
";",
"return",
"new",
"File",
"(",
"output",
".",
"getParentFile",
"(",
")",
".",
"getAbsoluteFile",
"(",
")",
",",
"output",
".... | Computes the file object for the minified version of the given file. The given file must be a '.js' file.
@param file the file
@return the associated minified file | [
"Computes",
"the",
"file",
"object",
"for",
"the",
"minified",
"version",
"of",
"the",
"given",
"file",
".",
"The",
"given",
"file",
"must",
"be",
"a",
".",
"js",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java#L353-L357 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java | JavaScriptCompilerMojo.createSourceMapFile | private void createSourceMapFile(File output,SourceMap sourceMap) throws WatchingException{
if (googleClosureMap) {
PrintWriter mapWriter = null;
File mapFile = new File(output.getPath() + ".map");
FileUtils.deleteQuietly(mapFile);
try {
mapWriter... | java | private void createSourceMapFile(File output,SourceMap sourceMap) throws WatchingException{
if (googleClosureMap) {
PrintWriter mapWriter = null;
File mapFile = new File(output.getPath() + ".map");
FileUtils.deleteQuietly(mapFile);
try {
mapWriter... | [
"private",
"void",
"createSourceMapFile",
"(",
"File",
"output",
",",
"SourceMap",
"sourceMap",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"googleClosureMap",
")",
"{",
"PrintWriter",
"mapWriter",
"=",
"null",
";",
"File",
"mapFile",
"=",
"new",
"File",... | Create a source map file corresponding to the given compiled js file.
@param output The compiled js file
@param sourceMap The {@link SourceMap} retrieved from the compiler
@throws WatchingException If an IOException occurred while creating the source map file. | [
"Create",
"a",
"source",
"map",
"file",
"corresponding",
"to",
"the",
"given",
"compiled",
"js",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java#L466-L483 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java | JavaScriptCompilerMojo.listErrors | private void listErrors(final Result result) {
for (JSError warning : result.warnings) {
getLog().warn(warning.toString());
}
for (JSError error : result.errors) {
getLog().error(error.toString());
}
} | java | private void listErrors(final Result result) {
for (JSError warning : result.warnings) {
getLog().warn(warning.toString());
}
for (JSError error : result.errors) {
getLog().error(error.toString());
}
} | [
"private",
"void",
"listErrors",
"(",
"final",
"Result",
"result",
")",
"{",
"for",
"(",
"JSError",
"warning",
":",
"result",
".",
"warnings",
")",
"{",
"getLog",
"(",
")",
".",
"warn",
"(",
"warning",
".",
"toString",
"(",
")",
")",
";",
"}",
"for",... | List the errors that google is providing from the compiler output.
@param result the results from the compiler | [
"List",
"the",
"errors",
"that",
"google",
"is",
"providing",
"from",
"the",
"compiler",
"output",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java#L490-L498 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/BundlePackagerMojo.java | BundlePackagerMojo.fileCreated | @Override
public boolean fileCreated(File file) throws WatchingException {
try {
createApplicationBundle();
} catch (Exception e) {
throw new WatchingException(e.getMessage(), file, e);
}
return true;
} | java | @Override
public boolean fileCreated(File file) throws WatchingException {
try {
createApplicationBundle();
} catch (Exception e) {
throw new WatchingException(e.getMessage(), file, e);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"fileCreated",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"try",
"{",
"createApplicationBundle",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"WatchingException",
"(",
... | On any change, we just repackage the bundle.
@param file the created file.
@return {@literal true} as the pipeline must continue its execution.
@throws WatchingException if the bundle creation failed | [
"On",
"any",
"change",
"we",
"just",
"repackage",
"the",
"bundle",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/BundlePackagerMojo.java#L231-L239 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CreateMojo.java | CreateMojo.execute | @Override
public void execute() throws MojoExecutionException {
try {
ensureNotExisting();
createDirectories();
if ("blank".equalsIgnoreCase(skel)) {
createApplicationConfiguration();
createBlankPomFile();
createPackageStru... | java | @Override
public void execute() throws MojoExecutionException {
try {
ensureNotExisting();
createDirectories();
if ("blank".equalsIgnoreCase(skel)) {
createApplicationConfiguration();
createBlankPomFile();
createPackageStru... | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"ensureNotExisting",
"(",
")",
";",
"createDirectories",
"(",
")",
";",
"if",
"(",
"\"blank\"",
".",
"equalsIgnoreCase",
"(",
"skel",
")",
")",
"{",
... | Generates the project structure.
If a directory with the 'artifactId\ name already exist, nothing is generated as we don't want to overridde
anything.
@throws MojoExecutionException | [
"Generates",
"the",
"project",
"structure",
".",
"If",
"a",
"directory",
"with",
"the",
"artifactId",
"\\",
"name",
"already",
"exist",
"nothing",
"is",
"generated",
"as",
"we",
"don",
"t",
"want",
"to",
"overridde",
"anything",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CreateMojo.java#L89-L115 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/BundleExclusions.java | BundleExclusions.isExcluded | public static boolean isExcluded(Artifact artifact) {
Set<String> excluded = EXCLUSIONS.get(artifact.getGroupId());
return excluded != null && excluded.contains(artifact.getArtifactId());
} | java | public static boolean isExcluded(Artifact artifact) {
Set<String> excluded = EXCLUSIONS.get(artifact.getGroupId());
return excluded != null && excluded.contains(artifact.getArtifactId());
} | [
"public",
"static",
"boolean",
"isExcluded",
"(",
"Artifact",
"artifact",
")",
"{",
"Set",
"<",
"String",
">",
"excluded",
"=",
"EXCLUSIONS",
".",
"get",
"(",
"artifact",
".",
"getGroupId",
"(",
")",
")",
";",
"return",
"excluded",
"!=",
"null",
"&&",
"e... | Checks whether the given artifact is on the excluded list.
@param artifact the artifact
@return {@literal true} if the artifact is excluded, {@literal false} otherwise | [
"Checks",
"whether",
"the",
"given",
"artifact",
"is",
"on",
"the",
"excluded",
"list",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/BundleExclusions.java#L73-L76 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java | WisdomExecutor.stop | public void stop(AbstractWisdomMojo mojo) throws MojoExecutionException {
File script = new File(mojo.getWisdomRootDirectory(), "chameleon.sh");
if (!script.isFile()) {
throw new MojoExecutionException("The 'chameleon.sh' file does not exist in " + mojo
.getWisdomRootDire... | java | public void stop(AbstractWisdomMojo mojo) throws MojoExecutionException {
File script = new File(mojo.getWisdomRootDirectory(), "chameleon.sh");
if (!script.isFile()) {
throw new MojoExecutionException("The 'chameleon.sh' file does not exist in " + mojo
.getWisdomRootDire... | [
"public",
"void",
"stop",
"(",
"AbstractWisdomMojo",
"mojo",
")",
"throws",
"MojoExecutionException",
"{",
"File",
"script",
"=",
"new",
"File",
"(",
"mojo",
".",
"getWisdomRootDirectory",
"(",
")",
",",
"\"chameleon.sh\"",
")",
";",
"if",
"(",
"!",
"script",
... | Stops a running instance of wisdom using 'chameleon stop'.
@param mojo the mojo
@throws MojoExecutionException if the instance cannot be stopped | [
"Stops",
"a",
"running",
"instance",
"of",
"wisdom",
"using",
"chameleon",
"stop",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java#L188-L212 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java | WisdomExecutor.waitForFile | public static boolean waitForFile(File file) {
if (file.isFile()) {
return true;
} else {
// Start waiting 10 seconds maximum
long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
while (System.currentTimeMillis() <= timeout) {
sle... | java | public static boolean waitForFile(File file) {
if (file.isFile()) {
return true;
} else {
// Start waiting 10 seconds maximum
long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
while (System.currentTimeMillis() <= timeout) {
sle... | [
"public",
"static",
"boolean",
"waitForFile",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
".",
"isFile",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"// Start waiting 10 seconds maximum",
"long",
"timeout",
"=",
"System",
".",
"curre... | Waits for a file to be created.
@param file the file
@return {@literal true} if the file was created, {@literal false} otherwise | [
"Waits",
"for",
"a",
"file",
"to",
"be",
"created",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java#L220-L235 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.get | @Override
public String get(final String key) {
return retrieve(new Callable<String>() {
@Override
public String call() throws Exception {
return configuration.getString(key);
}
}, null);
} | java | @Override
public String get(final String key) {
return retrieve(new Callable<String>() {
@Override
public String call() throws Exception {
return configuration.getString(key);
}
}, null);
} | [
"@",
"Override",
"public",
"String",
"get",
"(",
"final",
"String",
"key",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"call",
"(",
")",
"throws",
"Exception",
"{",
"re... | Get a String property or null if it is not there...
@param key the key
@return the property of null if not there | [
"Get",
"a",
"String",
"property",
"or",
"null",
"if",
"it",
"is",
"not",
"there",
"..."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L83-L91 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getWithDefault | @Override
public String getWithDefault(final String key, String defaultValue) {
return retrieve(new Callable<String>() {
@Override
public String call() throws Exception {
return configuration.getString(key);
}
}, defaultValue);
} | java | @Override
public String getWithDefault(final String key, String defaultValue) {
return retrieve(new Callable<String>() {
@Override
public String call() throws Exception {
return configuration.getString(key);
}
}, defaultValue);
} | [
"@",
"Override",
"public",
"String",
"getWithDefault",
"(",
"final",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"call",
"("... | Get a String property or a default value when property cannot be found in
any configuration file.
@param key the key used in the configuration file.
@param defaultValue Default value returned, when value cannot be found in
configuration.
@return the value of the key or the default value. | [
"Get",
"a",
"String",
"property",
"or",
"a",
"default",
"value",
"when",
"property",
"cannot",
"be",
"found",
"in",
"any",
"configuration",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L122-L130 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getIntegerWithDefault | @Override
public Integer getIntegerWithDefault(final String key, Integer defaultValue) {
return retrieve(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return configuration.getInt(key);
}
}, defaultValue);
} | java | @Override
public Integer getIntegerWithDefault(final String key, Integer defaultValue) {
return retrieve(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return configuration.getInt(key);
}
}, defaultValue);
} | [
"@",
"Override",
"public",
"Integer",
"getIntegerWithDefault",
"(",
"final",
"String",
"key",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"Integer",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Integer",
"c... | Get a Integer property or a default value when property cannot be found
in any configuration file.
@param key the key used in the configuration file.
@param defaultValue Default value returned, when value cannot be found in
configuration.
@return the value of the key or the default value. | [
"Get",
"a",
"Integer",
"property",
"or",
"a",
"default",
"value",
"when",
"property",
"cannot",
"be",
"found",
"in",
"any",
"configuration",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L157-L166 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getDoubleWithDefault | @Override
public Double getDoubleWithDefault(final String key, Double defaultValue) {
return retrieve(new Callable<Double>() {
@Override
public Double call() throws Exception {
return configuration.getDouble(key);
}
}, defaultValue);
} | java | @Override
public Double getDoubleWithDefault(final String key, Double defaultValue) {
return retrieve(new Callable<Double>() {
@Override
public Double call() throws Exception {
return configuration.getDouble(key);
}
}, defaultValue);
} | [
"@",
"Override",
"public",
"Double",
"getDoubleWithDefault",
"(",
"final",
"String",
"key",
",",
"Double",
"defaultValue",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"Double",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Double",
"call",... | Get a Double property or a default value when property cannot be found
in any configuration file.
@param key the key used in the configuration file.
@param defaultValue Default value returned, when value cannot be found in
configuration.
@return the value of the key or the default value. | [
"Get",
"a",
"Double",
"property",
"or",
"a",
"default",
"value",
"when",
"property",
"cannot",
"be",
"found",
"in",
"any",
"configuration",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L193-L201 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getBooleanWithDefault | @Override
public Boolean getBooleanWithDefault(final String key, Boolean defaultValue) {
return retrieve(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return configuration.getBoolean(key);
}
}, defaultValue);
} | java | @Override
public Boolean getBooleanWithDefault(final String key, Boolean defaultValue) {
return retrieve(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return configuration.getBoolean(key);
}
}, defaultValue);
} | [
"@",
"Override",
"public",
"Boolean",
"getBooleanWithDefault",
"(",
"final",
"String",
"key",
",",
"Boolean",
"defaultValue",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"c... | Get a Boolean property or a default value when property cannot be found
in any configuration file.
@param key the key used in the configuration file.
@param defaultValue Default value returned, when value cannot be found in
configuration.
@return the value of the key or the default value. | [
"Get",
"a",
"Boolean",
"property",
"or",
"a",
"default",
"value",
"when",
"property",
"cannot",
"be",
"found",
"in",
"any",
"configuration",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L227-L236 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getConfiguration | @Override
public Configuration getConfiguration(String prefix) {
try {
Config value = configuration.getConfig(prefix);
return new ConfigurationImpl(converters, value);
} catch (ConfigException.Missing e) {
// Ignore the exception.
return null;
... | java | @Override
public Configuration getConfiguration(String prefix) {
try {
Config value = configuration.getConfig(prefix);
return new ConfigurationImpl(converters, value);
} catch (ConfigException.Missing e) {
// Ignore the exception.
return null;
... | [
"@",
"Override",
"public",
"Configuration",
"getConfiguration",
"(",
"String",
"prefix",
")",
"{",
"try",
"{",
"Config",
"value",
"=",
"configuration",
".",
"getConfig",
"(",
"prefix",
")",
";",
"return",
"new",
"ConfigurationImpl",
"(",
"converters",
",",
"va... | Gets a configuration object with all the properties starting with the given prefix.
@param prefix the prefix (without the ending `.`)
@return a configuration object with all properties with a name starting with `prefix.`,
or {@literal null} if no properties start with the given prefix. | [
"Gets",
"a",
"configuration",
"object",
"with",
"all",
"the",
"properties",
"starting",
"with",
"the",
"given",
"prefix",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L455-L464 | train |
wisdom-framework/wisdom | documentation/samples/src/main/java/org/wisdom/samples/async/SimpleAsyncController.java | SimpleAsyncController.heavyComputation | @Route(method = HttpMethod.GET, uri = "/async/hello/{name}")
public Result heavyComputation(@Parameter("name") final String name) {
return async(new Callable<Result>() {
@Override
public Result call() throws Exception {
System.out.println(System.currentTimeMillis() + ... | java | @Route(method = HttpMethod.GET, uri = "/async/hello/{name}")
public Result heavyComputation(@Parameter("name") final String name) {
return async(new Callable<Result>() {
@Override
public Result call() throws Exception {
System.out.println(System.currentTimeMillis() + ... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"\"/async/hello/{name}\"",
")",
"public",
"Result",
"heavyComputation",
"(",
"@",
"Parameter",
"(",
"\"name\"",
")",
"final",
"String",
"name",
")",
"{",
"return",
"async",
"(",
"... | Waits ten second before sending the hello message. | [
"Waits",
"ten",
"second",
"before",
"sending",
"the",
"hello",
"message",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/documentation/samples/src/main/java/org/wisdom/samples/async/SimpleAsyncController.java#L41-L54 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ProxyFilter.java | ProxyFilter.newHttpClient | protected HttpClient newHttpClient() {
return HttpClients.custom()
// Do not manage redirection.
.setRedirectStrategy(new DefaultRedirectStrategy() {
@Override
protected boolean isRedirectable(String method) {
return... | java | protected HttpClient newHttpClient() {
return HttpClients.custom()
// Do not manage redirection.
.setRedirectStrategy(new DefaultRedirectStrategy() {
@Override
protected boolean isRedirectable(String method) {
return... | [
"protected",
"HttpClient",
"newHttpClient",
"(",
")",
"{",
"return",
"HttpClients",
".",
"custom",
"(",
")",
"// Do not manage redirection.",
".",
"setRedirectStrategy",
"(",
"new",
"DefaultRedirectStrategy",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"... | Allows you do override the HTTP Client used to execute the requests.
By default, it used a custom client without cookies.
@return the HTTP Client instance | [
"Allows",
"you",
"do",
"override",
"the",
"HTTP",
"Client",
"used",
"to",
"execute",
"the",
"requests",
".",
"By",
"default",
"it",
"used",
"a",
"custom",
"client",
"without",
"cookies",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ProxyFilter.java#L124-L140 | train |
wisdom-framework/wisdom | framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java | DefaultPageErrorHandler.renderInternalError | private Result renderInternalError(Context context, Route route, Throwable e) {
Throwable localException;
// If the template is not there, just wrap the exception within a JSON Object.
if (internalerror == null) {
return internalServerError(e);
}
// Manage ITE
... | java | private Result renderInternalError(Context context, Route route, Throwable e) {
Throwable localException;
// If the template is not there, just wrap the exception within a JSON Object.
if (internalerror == null) {
return internalServerError(e);
}
// Manage ITE
... | [
"private",
"Result",
"renderInternalError",
"(",
"Context",
"context",
",",
"Route",
"route",
",",
"Throwable",
"e",
")",
"{",
"Throwable",
"localException",
";",
"// If the template is not there, just wrap the exception within a JSON Object.",
"if",
"(",
"internalerror",
"... | Generates the error page.
@param context the context.
@param route the route
@param e the thrown error
@return the HTTP result serving the error page | [
"Generates",
"the",
"error",
"page",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java#L153-L201 | train |
wisdom-framework/wisdom | framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java | DefaultPageErrorHandler.call | @Override
public Result call(Route route, RequestContext context) throws Exception {
// Manage the error file.
// In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file
// If this file exist, we should display a page telling the user that somethin... | java | @Override
public Result call(Route route, RequestContext context) throws Exception {
// Manage the error file.
// In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file
// If this file exist, we should display a page telling the user that somethin... | [
"@",
"Override",
"public",
"Result",
"call",
"(",
"Route",
"route",
",",
"RequestContext",
"context",
")",
"throws",
"Exception",
"{",
"// Manage the error file.",
"// In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file",
"// If this f... | The interception method. When the request is unbound, generate a 404 page. When the controller throws an
exception generates a 500 page.
@param route the route
@param context the filter context
@return the generated result.
@throws Exception if anything bad happen | [
"The",
"interception",
"method",
".",
"When",
"the",
"request",
"is",
"unbound",
"generate",
"a",
"404",
"page",
".",
"When",
"the",
"controller",
"throws",
"an",
"exception",
"generates",
"a",
"500",
"page",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java#L212-L283 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java | Route.accepts | public Route accepts(String... types) {
Preconditions.checkNotNull(types);
final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>();
builder.addAll(this.acceptedMediaTypes);
for (String s : types) {
builder.add(MediaType.parse(s));
}
this.a... | java | public Route accepts(String... types) {
Preconditions.checkNotNull(types);
final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>();
builder.addAll(this.acceptedMediaTypes);
for (String s : types) {
builder.add(MediaType.parse(s));
}
this.a... | [
"public",
"Route",
"accepts",
"(",
"String",
"...",
"types",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"types",
")",
";",
"final",
"ImmutableSet",
".",
"Builder",
"<",
"MediaType",
">",
"builder",
"=",
"new",
"ImmutableSet",
".",
"Builder",
"<>",
... | Sets the set of media types accepted by the route.
@param types the set of type
@return the current route | [
"Sets",
"the",
"set",
"of",
"media",
"types",
"accepted",
"by",
"the",
"route",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L166-L175 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java | Route.produces | public Route produces(String... types) {
Preconditions.checkNotNull(types);
final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>();
builder.addAll(this.producedMediaTypes);
for (String s : types) {
final MediaType mt = MediaType.parse(s);
if ... | java | public Route produces(String... types) {
Preconditions.checkNotNull(types);
final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>();
builder.addAll(this.producedMediaTypes);
for (String s : types) {
final MediaType mt = MediaType.parse(s);
if ... | [
"public",
"Route",
"produces",
"(",
"String",
"...",
"types",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"types",
")",
";",
"final",
"ImmutableSet",
".",
"Builder",
"<",
"MediaType",
">",
"builder",
"=",
"new",
"ImmutableSet",
".",
"Builder",
"<>",... | Sets the set of media types produced by the route.
@param types the set of type
@return the current route | [
"Sets",
"the",
"set",
"of",
"media",
"types",
"produced",
"by",
"the",
"route",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L195-L208 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java | Route.isCompliantWithRequestAccept | public boolean isCompliantWithRequestAccept(Request request) {
if (producedMediaTypes == null || producedMediaTypes.isEmpty() || request == null
|| request.getHeader(HeaderNames.ACCEPT) == null) {
return true;
} else {
for (MediaType mt : producedMediaTypes) {
... | java | public boolean isCompliantWithRequestAccept(Request request) {
if (producedMediaTypes == null || producedMediaTypes.isEmpty() || request == null
|| request.getHeader(HeaderNames.ACCEPT) == null) {
return true;
} else {
for (MediaType mt : producedMediaTypes) {
... | [
"public",
"boolean",
"isCompliantWithRequestAccept",
"(",
"Request",
"request",
")",
"{",
"if",
"(",
"producedMediaTypes",
"==",
"null",
"||",
"producedMediaTypes",
".",
"isEmpty",
"(",
")",
"||",
"request",
"==",
"null",
"||",
"request",
".",
"getHeader",
"(",
... | Checks whether the given request is compliant with the media type accepted by the current route.
@param request the request
@return {@code true} if the request is compliant, {@code false} otherwise | [
"Checks",
"whether",
"the",
"given",
"request",
"is",
"compliant",
"with",
"the",
"media",
"type",
"accepted",
"by",
"the",
"current",
"route",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L490-L502 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java | RamlMonitorController.index | @Route(method = HttpMethod.GET, uri = "")
public Result index(@PathParameter("name") String name) {
if(names.contains(name)){
return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT));
}
return notFound();
} | java | @Route(method = HttpMethod.GET, uri = "")
public Result index(@PathParameter("name") String name) {
if(names.contains(name)){
return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT));
}
return notFound();
} | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"\"\"",
")",
"public",
"Result",
"index",
"(",
"@",
"PathParameter",
"(",
"\"name\"",
")",
"String",
"name",
")",
"{",
"if",
"(",
"names",
".",
"contains",
"(",
"name",
")",... | Return the raml console api corresponding to the raml of given name.
@response.mime text/html
@param name Name of the raml api to display.
@return the raml console api or 404 if the file of given name doesn't exist in wisdom | [
"Return",
"the",
"raml",
"console",
"api",
"corresponding",
"to",
"the",
"raml",
"of",
"given",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L92-L98 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java | RamlMonitorController.start | @Validate
public void start(){
//Publish the monitor extension
for(Asset asset : assets.assets()) {
if (asset.getPath().matches("^"+RAML_ASSET_DIR+"[A-Za-z0-9_-]+\\"+RAML_EXT+"$")){
String name = asset.getPath().substring(RAML_ASSET_DIR.length(), asset.getPath().length() ... | java | @Validate
public void start(){
//Publish the monitor extension
for(Asset asset : assets.assets()) {
if (asset.getPath().matches("^"+RAML_ASSET_DIR+"[A-Za-z0-9_-]+\\"+RAML_EXT+"$")){
String name = asset.getPath().substring(RAML_ASSET_DIR.length(), asset.getPath().length() ... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"//Publish the monitor extension",
"for",
"(",
"Asset",
"asset",
":",
"assets",
".",
"assets",
"(",
")",
")",
"{",
"if",
"(",
"asset",
".",
"getPath",
"(",
")",
".",
"matches",
"(",
"\"^\"",
"+... | Looks for the raml file available in the assets and publish a RamlMonitorConsole for each of them. | [
"Looks",
"for",
"the",
"raml",
"file",
"available",
"in",
"the",
"assets",
"and",
"publish",
"a",
"RamlMonitorConsole",
"for",
"each",
"of",
"them",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L112-L125 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java | RamlMonitorController.stop | @Invalidate
public void stop(){
for(ServiceRegistration registration: registrations){
registration.unregister();
}
registrations.clear();
names.clear();
} | java | @Invalidate
public void stop(){
for(ServiceRegistration registration: registrations){
registration.unregister();
}
registrations.clear();
names.clear();
} | [
"@",
"Invalidate",
"public",
"void",
"stop",
"(",
")",
"{",
"for",
"(",
"ServiceRegistration",
"registration",
":",
"registrations",
")",
"{",
"registration",
".",
"unregister",
"(",
")",
";",
"}",
"registrations",
".",
"clear",
"(",
")",
";",
"names",
"."... | Unregister all RamlMonitorConsole services created by this instance. | [
"Unregister",
"all",
"RamlMonitorConsole",
"services",
"created",
"by",
"this",
"instance",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L130-L137 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java | Engine.getBodyParserEngineForContentType | @Override
public BodyParser getBodyParserEngineForContentType(String contentType) {
for (BodyParser parser : parsers) {
if (parser.getContentTypes().contains(contentType)) {
return parser;
}
}
LoggerFactory.getLogger(this.getClass()).info("Cannot find ... | java | @Override
public BodyParser getBodyParserEngineForContentType(String contentType) {
for (BodyParser parser : parsers) {
if (parser.getContentTypes().contains(contentType)) {
return parser;
}
}
LoggerFactory.getLogger(this.getClass()).info("Cannot find ... | [
"@",
"Override",
"public",
"BodyParser",
"getBodyParserEngineForContentType",
"(",
"String",
"contentType",
")",
"{",
"for",
"(",
"BodyParser",
"parser",
":",
"parsers",
")",
"{",
"if",
"(",
"parser",
".",
"getContentTypes",
"(",
")",
".",
"contains",
"(",
"co... | Gets the body parser that can be used to parse a body with the given content type.
@param contentType the content type
@return a body parser, {@code null} if none match | [
"Gets",
"the",
"body",
"parser",
"that",
"can",
"be",
"used",
"to",
"parse",
"a",
"body",
"with",
"the",
"given",
"content",
"type",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L53-L62 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java | Engine.getContentSerializerForContentType | @Override
public ContentSerializer getContentSerializerForContentType(String contentType) {
for (ContentSerializer renderer : serializers) {
if (renderer.getContentType().equals(contentType)) {
return renderer;
}
}
LoggerFactory.getLogger(this.getClass... | java | @Override
public ContentSerializer getContentSerializerForContentType(String contentType) {
for (ContentSerializer renderer : serializers) {
if (renderer.getContentType().equals(contentType)) {
return renderer;
}
}
LoggerFactory.getLogger(this.getClass... | [
"@",
"Override",
"public",
"ContentSerializer",
"getContentSerializerForContentType",
"(",
"String",
"contentType",
")",
"{",
"for",
"(",
"ContentSerializer",
"renderer",
":",
"serializers",
")",
"{",
"if",
"(",
"renderer",
".",
"getContentType",
"(",
")",
".",
"e... | Gets the content serializer that can be used to serialize a result to the given content type. This method uses
an exact match.
@param contentType the content type
@return a content serializer, {@code null} if none match | [
"Gets",
"the",
"content",
"serializer",
"that",
"can",
"be",
"used",
"to",
"serialize",
"a",
"result",
"to",
"the",
"given",
"content",
"type",
".",
"This",
"method",
"uses",
"an",
"exact",
"match",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L71-L80 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java | Engine.getBestSerializer | @Override
public ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes) {
if (mediaTypes == null || mediaTypes.isEmpty()) {
mediaTypes = ImmutableList.of(MediaType.HTML_UTF_8);
}
for (MediaType type : mediaTypes) {
for (ContentSerializer ser : serializ... | java | @Override
public ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes) {
if (mediaTypes == null || mediaTypes.isEmpty()) {
mediaTypes = ImmutableList.of(MediaType.HTML_UTF_8);
}
for (MediaType type : mediaTypes) {
for (ContentSerializer ser : serializ... | [
"@",
"Override",
"public",
"ContentSerializer",
"getBestSerializer",
"(",
"Collection",
"<",
"MediaType",
">",
"mediaTypes",
")",
"{",
"if",
"(",
"mediaTypes",
"==",
"null",
"||",
"mediaTypes",
".",
"isEmpty",
"(",
")",
")",
"{",
"mediaTypes",
"=",
"ImmutableL... | Finds the 'best' content serializer for the given accept headers.
@param mediaTypes the ordered set of {@link com.google.common.net.MediaType} from the {@code ACCEPT} header.
@return the best serializer from the list matching the {@code ACCEPT} header, {@code null} if none match | [
"Finds",
"the",
"best",
"content",
"serializer",
"for",
"the",
"given",
"accept",
"headers",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L88-L102 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.execute | @Override
public void execute() throws MojoExecutionException {
if (skipCleanCSS) {
getLog().debug("Skipping CSS minification");
removeFromWatching();
return;
}
cleancss = NPM.npm(this, CLEANCSS_NPM_NAME, cleanCssVersion);
getLog().info("Clean CSS... | java | @Override
public void execute() throws MojoExecutionException {
if (skipCleanCSS) {
getLog().debug("Skipping CSS minification");
removeFromWatching();
return;
}
cleancss = NPM.npm(this, CLEANCSS_NPM_NAME, cleanCssVersion);
getLog().info("Clean CSS... | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"skipCleanCSS",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Skipping CSS minification\"",
")",
";",
"removeFromWatching",
"(",
")",
";",
"return... | Checks if the skipCleanCSS flag has been set if so, we stop watching css files. If not we
continue by setting our Clean CSS NPM object and calling the minify method for all css
files found.
@throws MojoExecutionException when modification fails. | [
"Checks",
"if",
"the",
"skipCleanCSS",
"flag",
"has",
"been",
"set",
"if",
"so",
"we",
"stop",
"watching",
"css",
"files",
".",
"If",
"not",
"we",
"continue",
"by",
"setting",
"our",
"Clean",
"CSS",
"NPM",
"object",
"and",
"calling",
"the",
"minify",
"me... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L112-L136 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.isNotMinified | public boolean isNotMinified(File file) {
return !file.getName().endsWith("min.css")
&& !file.getName().endsWith(cssMinifierSuffix + ".css");
} | java | public boolean isNotMinified(File file) {
return !file.getName().endsWith("min.css")
&& !file.getName().endsWith(cssMinifierSuffix + ".css");
} | [
"public",
"boolean",
"isNotMinified",
"(",
"File",
"file",
")",
"{",
"return",
"!",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\"min.css\"",
")",
"&&",
"!",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"cssMinifierSuffix",
"+",
... | Checks to see if the file is already minified.
@param file the current file we are looking at.
@return a boolean. | [
"Checks",
"to",
"see",
"if",
"the",
"file",
"is",
"already",
"minified",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L282-L285 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.fileCreated | @Override
public boolean fileCreated(File file) throws WatchingException {
if (stylesheets != null) {
try {
process(stylesheets);
} catch (MojoExecutionException e) {
throw new WatchingException("Error while aggregating or minifying CSS resources", fil... | java | @Override
public boolean fileCreated(File file) throws WatchingException {
if (stylesheets != null) {
try {
process(stylesheets);
} catch (MojoExecutionException e) {
throw new WatchingException("Error while aggregating or minifying CSS resources", fil... | [
"@",
"Override",
"public",
"boolean",
"fileCreated",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"stylesheets",
"!=",
"null",
")",
"{",
"try",
"{",
"process",
"(",
"stylesheets",
")",
";",
"}",
"catch",
"(",
"MojoExecutionExcepti... | Minifies the created files.
@param file is the file.
@return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should
return {@literal true} to let other watchers be notified.
@throws org.wisdom.maven.WatchingException if the watcher failed to process the given file. | [
"Minifies",
"the",
"created",
"files",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L295-L307 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.fileDeleted | @Override
public boolean fileDeleted(File file) throws WatchingException {
if (isNotMinified(file)) {
File minified = getMinifiedFile(file);
FileUtils.deleteQuietly(minified);
File map = new File(minified.getParentFile(), minified.getName() + ".map");
FileUtil... | java | @Override
public boolean fileDeleted(File file) throws WatchingException {
if (isNotMinified(file)) {
File minified = getMinifiedFile(file);
FileUtils.deleteQuietly(minified);
File map = new File(minified.getParentFile(), minified.getName() + ".map");
FileUtil... | [
"@",
"Override",
"public",
"boolean",
"fileDeleted",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"isNotMinified",
"(",
"file",
")",
")",
"{",
"File",
"minified",
"=",
"getMinifiedFile",
"(",
"file",
")",
";",
"FileUtils",
".",
... | Cleans the output file if any.
@param file the file
@return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should
return {@literal true} to let other watchers be notified.
@throws org.wisdom.maven.WatchingException if the watcher failed to process the given file. | [
"Cleans",
"the",
"output",
"file",
"if",
"any",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L330-L339 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.getFilteredVersion | public File getFilteredVersion(File input) {
File out;
if (!input.getName().endsWith(".css")) {
out = getOutputFile(input, "css");
} else {
out = getOutputFile(input);
}
if (!out.isFile()) {
return null;
}
return out;
} | java | public File getFilteredVersion(File input) {
File out;
if (!input.getName().endsWith(".css")) {
out = getOutputFile(input, "css");
} else {
out = getOutputFile(input);
}
if (!out.isFile()) {
return null;
}
return out;
} | [
"public",
"File",
"getFilteredVersion",
"(",
"File",
"input",
")",
"{",
"File",
"out",
";",
"if",
"(",
"!",
"input",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".css\"",
")",
")",
"{",
"out",
"=",
"getOutputFile",
"(",
"input",
",",
"\"css\"",
... | Overrides the parent method to manage the case where the given file is not a `.css`. In that case it should
strips the extension and find a `.css` file.
@param input the input file
@return the filtered file (to the mirror of the file in the output directory), {@code null} if not found | [
"Overrides",
"the",
"parent",
"method",
"to",
"manage",
"the",
"case",
"where",
"the",
"given",
"file",
"is",
"not",
"a",
".",
"css",
".",
"In",
"that",
"case",
"it",
"should",
"strips",
"the",
"extension",
"and",
"find",
"a",
".",
"css",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L348-L360 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.process | private void process(File file) throws WatchingException {
getLog().info("Minifying CSS files from " + file.getName() + " using Clean CSS");
File filtered = getFilteredVersion(file);
if (filtered == null) {
filtered = file;
}
File output = getMinifiedFile(file);
... | java | private void process(File file) throws WatchingException {
getLog().info("Minifying CSS files from " + file.getName() + " using Clean CSS");
File filtered = getFilteredVersion(file);
if (filtered == null) {
filtered = file;
}
File output = getMinifiedFile(file);
... | [
"private",
"void",
"process",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Minifying CSS files from \"",
"+",
"file",
".",
"getName",
"(",
")",
"+",
"\" using Clean CSS\"",
")",
";",
"File",
"filtered",... | Minifies the CSS file using Clean CSS.
@param file that we wish to minify.
@throws WatchingException if errors occur during minification. | [
"Minifies",
"the",
"CSS",
"file",
"using",
"Clean",
"CSS",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L368-L402 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java | CSSMinifierMojo.getMinifiedFile | protected File getMinifiedFile(File input) {
File output = getOutputFile(input);
String ext = FilenameUtils.getExtension(output.getName());
return new File(output.getParentFile().getAbsoluteFile(),
output.getName().replace("." + ext, cssMinifierSuffix + ".css"));
} | java | protected File getMinifiedFile(File input) {
File output = getOutputFile(input);
String ext = FilenameUtils.getExtension(output.getName());
return new File(output.getParentFile().getAbsoluteFile(),
output.getName().replace("." + ext, cssMinifierSuffix + ".css"));
} | [
"protected",
"File",
"getMinifiedFile",
"(",
"File",
"input",
")",
"{",
"File",
"output",
"=",
"getOutputFile",
"(",
"input",
")",
";",
"String",
"ext",
"=",
"FilenameUtils",
".",
"getExtension",
"(",
"output",
".",
"getName",
"(",
")",
")",
";",
"return",... | Creates out minified output file replacing the current extension with the minified one.
@param input the file to minify.
@return the output file where the minified code will go. | [
"Creates",
"out",
"minified",
"output",
"file",
"replacing",
"the",
"current",
"extension",
"with",
"the",
"minified",
"one",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L410-L415 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/MavenUtils.java | MavenUtils.getArray | protected static String getArray(List<String> paths) {
StringBuilder builder = new StringBuilder();
for (String s : paths) {
if (builder.length() == 0) {
builder.append(s);
} else {
builder.append(",").append(s);
}
}
r... | java | protected static String getArray(List<String> paths) {
StringBuilder builder = new StringBuilder();
for (String s : paths) {
if (builder.length() == 0) {
builder.append(s);
} else {
builder.append(",").append(s);
}
}
r... | [
"protected",
"static",
"String",
"getArray",
"(",
"List",
"<",
"String",
">",
"paths",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"paths",
")",
"{",
"if",
"(",
"builder",
".",
"leng... | Compute a String form the given list of paths. The list uses comma as separator.
@param paths the list of path
@return the computed String | [
"Compute",
"a",
"String",
"form",
"the",
"given",
"list",
"of",
"paths",
".",
"The",
"list",
"uses",
"comma",
"as",
"separator",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/MavenUtils.java#L111-L123 | train |
KasualBusiness/MaterialNumberPicker | materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java | MaterialNumberPicker.initView | private void initView() {
setMinValue(MIN_VALUE);
setMaxValue(MAX_VALUE);
setValue(DEFAULT_VALUE);
setBackgroundColor(BACKGROUND_COLOR);
setSeparatorColor(SEPARATOR_COLOR);
setTextColor(TEXT_COLOR);
setTextSize(TEXT_SIZE);
setWrapSelectorWheel(false);
... | java | private void initView() {
setMinValue(MIN_VALUE);
setMaxValue(MAX_VALUE);
setValue(DEFAULT_VALUE);
setBackgroundColor(BACKGROUND_COLOR);
setSeparatorColor(SEPARATOR_COLOR);
setTextColor(TEXT_COLOR);
setTextSize(TEXT_SIZE);
setWrapSelectorWheel(false);
... | [
"private",
"void",
"initView",
"(",
")",
"{",
"setMinValue",
"(",
"MIN_VALUE",
")",
";",
"setMaxValue",
"(",
"MAX_VALUE",
")",
";",
"setValue",
"(",
"DEFAULT_VALUE",
")",
";",
"setBackgroundColor",
"(",
"BACKGROUND_COLOR",
")",
";",
"setSeparatorColor",
"(",
"... | Init number picker by disabling focusability of edit text embedded inside the number picker
We also override the edit text filter private attribute by using reflection as the formatter is still buggy while attempting to display the default value
This is still an open Google @see <a href="https://code.google.com/p/andro... | [
"Init",
"number",
"picker",
"by",
"disabling",
"focusability",
"of",
"edit",
"text",
"embedded",
"inside",
"the",
"number",
"picker",
"We",
"also",
"override",
"the",
"edit",
"text",
"filter",
"private",
"attribute",
"by",
"using",
"reflection",
"as",
"the",
"... | 1b0b884fdc15197683b84135c31342c7acd32901 | https://github.com/KasualBusiness/MaterialNumberPicker/blob/1b0b884fdc15197683b84135c31342c7acd32901/materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java#L137-L156 | train |
KasualBusiness/MaterialNumberPicker | materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java | MaterialNumberPicker.setSeparatorColor | public void setSeparatorColor(int separatorColor) {
mSeparatorColor = separatorColor;
Field[] pickerFields = NumberPicker.class.getDeclaredFields();
for (Field pf : pickerFields) {
if (pf.getName().equals("mSelectionDivider")) {
pf.setAccessible(true);
... | java | public void setSeparatorColor(int separatorColor) {
mSeparatorColor = separatorColor;
Field[] pickerFields = NumberPicker.class.getDeclaredFields();
for (Field pf : pickerFields) {
if (pf.getName().equals("mSelectionDivider")) {
pf.setAccessible(true);
... | [
"public",
"void",
"setSeparatorColor",
"(",
"int",
"separatorColor",
")",
"{",
"mSeparatorColor",
"=",
"separatorColor",
";",
"Field",
"[",
"]",
"pickerFields",
"=",
"NumberPicker",
".",
"class",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"Field",
"p... | Uses reflection to access divider private attribute and override its color
Use Color.Transparent if you wish to hide them | [
"Uses",
"reflection",
"to",
"access",
"divider",
"private",
"attribute",
"and",
"override",
"its",
"color",
"Use",
"Color",
".",
"Transparent",
"if",
"you",
"wish",
"to",
"hide",
"them"
] | 1b0b884fdc15197683b84135c31342c7acd32901 | https://github.com/KasualBusiness/MaterialNumberPicker/blob/1b0b884fdc15197683b84135c31342c7acd32901/materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java#L162-L177 | train |
jeevatkm/digitalocean-api-java | src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java | DigitalOceanClient.rebootDroplet | @Override
public Action rebootDroplet(Integer dropletId)
throws DigitalOceanException, RequestUnsuccessfulException {
validateDropletId(dropletId);
Object[] params = {dropletId};
return (Action) perform(
new ApiRequest(ApiAction.REBOOT_DROPLET, new DropletAction(ActionType.REBOOT), params))... | java | @Override
public Action rebootDroplet(Integer dropletId)
throws DigitalOceanException, RequestUnsuccessfulException {
validateDropletId(dropletId);
Object[] params = {dropletId};
return (Action) perform(
new ApiRequest(ApiAction.REBOOT_DROPLET, new DropletAction(ActionType.REBOOT), params))... | [
"@",
"Override",
"public",
"Action",
"rebootDroplet",
"(",
"Integer",
"dropletId",
")",
"throws",
"DigitalOceanException",
",",
"RequestUnsuccessfulException",
"{",
"validateDropletId",
"(",
"dropletId",
")",
";",
"Object",
"[",
"]",
"params",
"=",
"{",
"dropletId",... | Droplet action methods | [
"Droplet",
"action",
"methods"
] | 79d7acfec191556a7be738654ff866ff34da666b | https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L383-L392 | train |
jeevatkm/digitalocean-api-java | src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java | DigitalOceanClient.getSimpleHeaderValue | private String getSimpleHeaderValue(String header, HttpResponse httpResponse) {
return getSimpleHeaderValue(header, httpResponse, true);
} | java | private String getSimpleHeaderValue(String header, HttpResponse httpResponse) {
return getSimpleHeaderValue(header, httpResponse, true);
} | [
"private",
"String",
"getSimpleHeaderValue",
"(",
"String",
"header",
",",
"HttpResponse",
"httpResponse",
")",
"{",
"return",
"getSimpleHeaderValue",
"(",
"header",
",",
"httpResponse",
",",
"true",
")",
";",
"}"
] | Easy method for HTTP header values. defaults to first one. | [
"Easy",
"method",
"for",
"HTTP",
"header",
"values",
".",
"defaults",
"to",
"first",
"one",
"."
] | 79d7acfec191556a7be738654ff866ff34da666b | https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L1878-L1880 | train |
jeevatkm/digitalocean-api-java | src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java | DigitalOceanClient.checkBlankAndThrowError | private void checkBlankAndThrowError(String str, String msg) {
if (StringUtils.isBlank(str)) {
log.error(msg);
throw new IllegalArgumentException(msg);
}
} | java | private void checkBlankAndThrowError(String str, String msg) {
if (StringUtils.isBlank(str)) {
log.error(msg);
throw new IllegalArgumentException(msg);
}
} | [
"private",
"void",
"checkBlankAndThrowError",
"(",
"String",
"str",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"str",
")",
")",
"{",
"log",
".",
"error",
"(",
"msg",
")",
";",
"throw",
"new",
"IllegalArgumentException",
... | It checks for null, whitespace and length | [
"It",
"checks",
"for",
"null",
"whitespace",
"and",
"length"
] | 79d7acfec191556a7be738654ff866ff34da666b | https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L1915-L1920 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java | CommonsArchiver.createArchiveOutputStream | protected ArchiveOutputStream createArchiveOutputStream(File archiveFile) throws IOException {
try {
return CommonsStreamFactory.createArchiveOutputStream(this, archiveFile);
} catch (ArchiveException e) {
throw new IOException(e);
}
} | java | protected ArchiveOutputStream createArchiveOutputStream(File archiveFile) throws IOException {
try {
return CommonsStreamFactory.createArchiveOutputStream(this, archiveFile);
} catch (ArchiveException e) {
throw new IOException(e);
}
} | [
"protected",
"ArchiveOutputStream",
"createArchiveOutputStream",
"(",
"File",
"archiveFile",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"CommonsStreamFactory",
".",
"createArchiveOutputStream",
"(",
"this",
",",
"archiveFile",
")",
";",
"}",
"catch",
"("... | Returns a new ArchiveOutputStream for creating archives. Subclasses can override this to return their own custom
implementation.
@param archiveFile the archive file to stream to
@return a new ArchiveOutputStream for the given archive file.
@throws IOException propagated IO exceptions | [
"Returns",
"a",
"new",
"ArchiveOutputStream",
"for",
"creating",
"archives",
".",
"Subclasses",
"can",
"override",
"this",
"to",
"return",
"their",
"own",
"custom",
"implementation",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L160-L166 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java | CommonsArchiver.assertExtractSource | protected void assertExtractSource(File archive) throws FileNotFoundException, IllegalArgumentException {
if (archive.isDirectory()) {
throw new IllegalArgumentException("Can not extract " + archive + ". Source is a directory.");
} else if (!archive.exists()) {
throw new FileNotF... | java | protected void assertExtractSource(File archive) throws FileNotFoundException, IllegalArgumentException {
if (archive.isDirectory()) {
throw new IllegalArgumentException("Can not extract " + archive + ". Source is a directory.");
} else if (!archive.exists()) {
throw new FileNotF... | [
"protected",
"void",
"assertExtractSource",
"(",
"File",
"archive",
")",
"throws",
"FileNotFoundException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"archive",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can no... | Asserts that the given File object is a readable file that can be used to extract from.
@param archive the file to check
@throws FileNotFoundException if the file does not exist
@throws IllegalArgumentException if the file is a directory or not readable | [
"Asserts",
"that",
"the",
"given",
"File",
"object",
"is",
"a",
"readable",
"file",
"that",
"can",
"be",
"used",
"to",
"extract",
"from",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L175-L183 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java | CommonsArchiver.createNewArchiveFile | protected File createNewArchiveFile(String archive, String extension, File destination) throws IOException {
if (!archive.endsWith(extension)) {
archive += extension;
}
File file = new File(destination, archive);
file.createNewFile();
return file;
} | java | protected File createNewArchiveFile(String archive, String extension, File destination) throws IOException {
if (!archive.endsWith(extension)) {
archive += extension;
}
File file = new File(destination, archive);
file.createNewFile();
return file;
} | [
"protected",
"File",
"createNewArchiveFile",
"(",
"String",
"archive",
",",
"String",
"extension",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"archive",
".",
"endsWith",
"(",
"extension",
")",
")",
"{",
"archive",
"+=",
"e... | Creates a new File in the given destination. The resulting name will always be "archive"."fileExtension". If the
archive name parameter already ends with the given file name extension, it is not additionally appended.
@param archive the name of the archive
@param extension the file extension (e.g. ".tar")
@param desti... | [
"Creates",
"a",
"new",
"File",
"in",
"the",
"given",
"destination",
".",
"The",
"resulting",
"name",
"will",
"always",
"be",
"archive",
".",
"fileExtension",
".",
"If",
"the",
"archive",
"name",
"parameter",
"already",
"ends",
"with",
"the",
"given",
"file",... | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L195-L204 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/AttributeAccessor.java | AttributeAccessor.create | public static AttributeAccessor<?> create(ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
return new TarAttributeAccessor((TarArchiveEntry) entry);
} else if (entry instanceof ZipArchiveEntry) {
return new ZipAttributeAccessor((ZipArchiveEntry) entry);
} els... | java | public static AttributeAccessor<?> create(ArchiveEntry entry) {
if (entry instanceof TarArchiveEntry) {
return new TarAttributeAccessor((TarArchiveEntry) entry);
} else if (entry instanceof ZipArchiveEntry) {
return new ZipAttributeAccessor((ZipArchiveEntry) entry);
} els... | [
"public",
"static",
"AttributeAccessor",
"<",
"?",
">",
"create",
"(",
"ArchiveEntry",
"entry",
")",
"{",
"if",
"(",
"entry",
"instanceof",
"TarArchiveEntry",
")",
"{",
"return",
"new",
"TarAttributeAccessor",
"(",
"(",
"TarArchiveEntry",
")",
"entry",
")",
";... | Detects the type of the given ArchiveEntry and returns an appropriate AttributeAccessor for it.
@param entry the adaptee
@return a new attribute accessor instance | [
"Detects",
"the",
"type",
"of",
"the",
"given",
"ArchiveEntry",
"and",
"returns",
"an",
"appropriate",
"AttributeAccessor",
"for",
"it",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/AttributeAccessor.java#L63-L77 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/CompressorFactory.java | CompressorFactory.createCompressor | public static Compressor createCompressor(String compression) throws IllegalArgumentException {
if (!CompressionType.isValidCompressionType(compression)) {
throw new IllegalArgumentException("Unkonwn compression type " + compression);
}
return createCompressor(CompressionType.fromSt... | java | public static Compressor createCompressor(String compression) throws IllegalArgumentException {
if (!CompressionType.isValidCompressionType(compression)) {
throw new IllegalArgumentException("Unkonwn compression type " + compression);
}
return createCompressor(CompressionType.fromSt... | [
"public",
"static",
"Compressor",
"createCompressor",
"(",
"String",
"compression",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"CompressionType",
".",
"isValidCompressionType",
"(",
"compression",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExc... | Creates a compressor from the given compression type.
@param compression the name of the compression algorithm e.g. "gz" or "bzip2".
@return a new {@link Compressor} instance for the given compression algorithm
@throws IllegalArgumentException if the compression type is unknown | [
"Creates",
"a",
"compressor",
"from",
"the",
"given",
"compression",
"type",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CompressorFactory.java#L73-L79 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/IOUtils.java | IOUtils.copy | public static void copy(InputStream source, File destination) throws IOException {
OutputStream output = null;
try {
output = new FileOutputStream(destination);
copy(source, output);
} finally {
closeQuietly(output);
}
} | java | public static void copy(InputStream source, File destination) throws IOException {
OutputStream output = null;
try {
output = new FileOutputStream(destination);
copy(source, output);
} finally {
closeQuietly(output);
}
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"source",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"OutputStream",
"output",
"=",
"null",
";",
"try",
"{",
"output",
"=",
"new",
"FileOutputStream",
"(",
"destination",
")",
";",
"... | Copies the content of an InputStream into a destination File.
@param source the InputStream to copy
@param destination the target File
@throws IOException if an error occurs | [
"Copies",
"the",
"content",
"of",
"an",
"InputStream",
"into",
"a",
"destination",
"File",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/IOUtils.java#L46-L55 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/IOUtils.java | IOUtils.filesContainedIn | public static File[] filesContainedIn(File source) {
if (source.isDirectory()) {
return source.listFiles();
} else {
return new File[] { source };
}
} | java | public static File[] filesContainedIn(File source) {
if (source.isDirectory()) {
return source.listFiles();
} else {
return new File[] { source };
}
} | [
"public",
"static",
"File",
"[",
"]",
"filesContainedIn",
"(",
"File",
"source",
")",
"{",
"if",
"(",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"source",
".",
"listFiles",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"File",
"[... | Given a source File, return its direct descendants if the File is a directory. Otherwise return the File itself.
@param source File or folder to be examined
@return a File[] array containing the files inside this folder, or a size-1 array containing the file itself. | [
"Given",
"a",
"source",
"File",
"return",
"its",
"direct",
"descendants",
"if",
"the",
"File",
"is",
"a",
"directory",
".",
"Otherwise",
"return",
"the",
"File",
"itself",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/IOUtils.java#L148-L154 | train |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/FileModeMapper.java | FileModeMapper.map | public static void map(ArchiveEntry entry, File file) throws IOException {
create(entry).map(file);
} | java | public static void map(ArchiveEntry entry, File file) throws IOException {
create(entry).map(file);
} | [
"public",
"static",
"void",
"map",
"(",
"ArchiveEntry",
"entry",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"create",
"(",
"entry",
")",
".",
"map",
"(",
"file",
")",
";",
"}"
] | Utility method to create a FileModeMapper for the given entry, and use it to map the file mode onto the given
file.
@param entry the archive entry that holds the mode
@param file the file to apply the mode onto | [
"Utility",
"method",
"to",
"create",
"a",
"FileModeMapper",
"for",
"the",
"given",
"entry",
"and",
"use",
"it",
"to",
"map",
"the",
"file",
"mode",
"onto",
"the",
"given",
"file",
"."
] | 8afee5124c588f589306796985b722d63572bbfa | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/FileModeMapper.java#L59-L61 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java | CurrencyDateCalculatorBuilder.ccy1Calendar | public CurrencyDateCalculatorBuilder<E> ccy1Calendar(final HolidayCalendar<E> ccy1Calendar) {
if (ccy1Calendar != null) {
this.ccy1Calendar = ccy1Calendar;
}
return this;
} | java | public CurrencyDateCalculatorBuilder<E> ccy1Calendar(final HolidayCalendar<E> ccy1Calendar) {
if (ccy1Calendar != null) {
this.ccy1Calendar = ccy1Calendar;
}
return this;
} | [
"public",
"CurrencyDateCalculatorBuilder",
"<",
"E",
">",
"ccy1Calendar",
"(",
"final",
"HolidayCalendar",
"<",
"E",
">",
"ccy1Calendar",
")",
"{",
"if",
"(",
"ccy1Calendar",
"!=",
"null",
")",
"{",
"this",
".",
"ccy1Calendar",
"=",
"ccy1Calendar",
";",
"}",
... | The holiday calendar for ccy1, if null or not set, then a default calendar will be used with NO holidays.
@param ccy1Calendar the Calendar for ccy1
@return the builder | [
"The",
"holiday",
"calendar",
"for",
"ccy1",
"if",
"null",
"or",
"not",
"set",
"then",
"a",
"default",
"calendar",
"will",
"be",
"used",
"with",
"NO",
"holidays",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L236-L241 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java | CurrencyDateCalculatorBuilder.ccy2Calendar | public CurrencyDateCalculatorBuilder<E> ccy2Calendar(final HolidayCalendar<E> ccy2Calendar) {
if (ccy2Calendar != null) {
this.ccy2Calendar = ccy2Calendar;
}
return this;
} | java | public CurrencyDateCalculatorBuilder<E> ccy2Calendar(final HolidayCalendar<E> ccy2Calendar) {
if (ccy2Calendar != null) {
this.ccy2Calendar = ccy2Calendar;
}
return this;
} | [
"public",
"CurrencyDateCalculatorBuilder",
"<",
"E",
">",
"ccy2Calendar",
"(",
"final",
"HolidayCalendar",
"<",
"E",
">",
"ccy2Calendar",
")",
"{",
"if",
"(",
"ccy2Calendar",
"!=",
"null",
")",
"{",
"this",
".",
"ccy2Calendar",
"=",
"ccy2Calendar",
";",
"}",
... | The holiday calendar for ccy2, if null or not set, then a default calendar will be used with NO holidays.
@param ccy2Calendar the Calendar for ccy2
@return the builder | [
"The",
"holiday",
"calendar",
"for",
"ccy2",
"if",
"null",
"or",
"not",
"set",
"then",
"a",
"default",
"calendar",
"will",
"be",
"used",
"with",
"NO",
"holidays",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L248-L253 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java | CurrencyDateCalculatorBuilder.crossCcyCalendar | public CurrencyDateCalculatorBuilder<E> crossCcyCalendar(final HolidayCalendar<E> crossCcyCalendar) {
if (crossCcyCalendar != null) {
this.crossCcyCalendar = crossCcyCalendar;
}
return this;
} | java | public CurrencyDateCalculatorBuilder<E> crossCcyCalendar(final HolidayCalendar<E> crossCcyCalendar) {
if (crossCcyCalendar != null) {
this.crossCcyCalendar = crossCcyCalendar;
}
return this;
} | [
"public",
"CurrencyDateCalculatorBuilder",
"<",
"E",
">",
"crossCcyCalendar",
"(",
"final",
"HolidayCalendar",
"<",
"E",
">",
"crossCcyCalendar",
")",
"{",
"if",
"(",
"crossCcyCalendar",
"!=",
"null",
")",
"{",
"this",
".",
"crossCcyCalendar",
"=",
"crossCcyCalend... | If brokenDate is not allowed, we do require to check the WorkingWeek and Holiday for the crossCcy when
validating the SpotDate or a Tenor date.
@param crossCcyCalendar the set of holidays for the crossCcy
@return the builder | [
"If",
"brokenDate",
"is",
"not",
"allowed",
"we",
"do",
"require",
"to",
"check",
"the",
"WorkingWeek",
"and",
"Holiday",
"for",
"the",
"crossCcy",
"when",
"validating",
"the",
"SpotDate",
"or",
"a",
"Tenor",
"date",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L272-L277 | train |
Appendium/objectlabkit | datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java | CalendarKitCalculatorsFactory.getDateCalculator | public CalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
final CalendarDateCalculator cal = new CalendarDateCalculator();
cal.setName(name);
setHolidays(name, cal);
if (holidayHandlerType != null) {
cal.setHolidayHandler(getHo... | java | public CalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
final CalendarDateCalculator cal = new CalendarDateCalculator();
cal.setName(name);
setHolidays(name, cal);
if (holidayHandlerType != null) {
cal.setHolidayHandler(getHo... | [
"public",
"CalendarDateCalculator",
"getDateCalculator",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"holidayHandlerType",
")",
"{",
"final",
"CalendarDateCalculator",
"cal",
"=",
"new",
"CalendarDateCalculator",
"(",
")",
";",
"cal",
".",
"setName",
"("... | Create a new DateCalculator for a given name and type of handling.
@param name
calendar name (holidays set interested in). If there is set of
holidays with that name, it will return a DateCalculator with
an empty holiday set (will work on Weekend only).
@param holidayHandlerType
typically one of the value of HolidayHa... | [
"Create",
"a",
"new",
"DateCalculator",
"for",
"a",
"given",
"name",
"and",
"type",
"of",
"handling",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java#L132-L140 | train |
Appendium/objectlabkit | datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java | CalendarIMMDateCalculator.moveToIMMDay | private static void moveToIMMDay(final Calendar cal) {
cal.set(DAY_OF_MONTH, 1);
// go to 1st wed
final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek < WEDNESDAY) {
cal.add(DAY_OF_MONTH, WEDNESDAY - dayOfWeek);
} else if (dayOfWeek > WEDNESDAY) ... | java | private static void moveToIMMDay(final Calendar cal) {
cal.set(DAY_OF_MONTH, 1);
// go to 1st wed
final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek < WEDNESDAY) {
cal.add(DAY_OF_MONTH, WEDNESDAY - dayOfWeek);
} else if (dayOfWeek > WEDNESDAY) ... | [
"private",
"static",
"void",
"moveToIMMDay",
"(",
"final",
"Calendar",
"cal",
")",
"{",
"cal",
".",
"set",
"(",
"DAY_OF_MONTH",
",",
"1",
")",
";",
"// go to 1st wed\r",
"final",
"int",
"dayOfWeek",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_WEE... | Assumes that the month is correct, get the day for the 3rd wednesday.
@param cal | [
"Assumes",
"that",
"the",
"month",
"is",
"correct",
"get",
"the",
"day",
"for",
"the",
"3rd",
"wednesday",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java#L178-L191 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java | Utils.blastTime | public static Calendar blastTime(final Calendar cal) {
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
} | java | public static Calendar blastTime(final Calendar cal) {
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
} | [
"public",
"static",
"Calendar",
"blastTime",
"(",
"final",
"Calendar",
"cal",
")",
"{",
"cal",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"cal",
".",
"... | Removes set's all "time" fields to zero, leaving only the date portion of
the Calendar. The Calendar passe
@param cal
to Calendar object to blast, note, it will be modified
@return the calendar object modified (same instance) | [
"Removes",
"set",
"s",
"all",
"time",
"fields",
"to",
"zero",
"leaving",
"only",
"the",
"date",
"portion",
"of",
"the",
"Calendar",
".",
"The",
"Calendar",
"passe"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L64-L70 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java | Utils.createDate | public static Date createDate(final String dateStr) {
if (dateStr == null) {
return createCalendar(null).getTime();
}
final Calendar cal = getCal(dateStr);
return cal != null ? cal.getTime() : null;
} | java | public static Date createDate(final String dateStr) {
if (dateStr == null) {
return createCalendar(null).getTime();
}
final Calendar cal = getCal(dateStr);
return cal != null ? cal.getTime() : null;
} | [
"public",
"static",
"Date",
"createDate",
"(",
"final",
"String",
"dateStr",
")",
"{",
"if",
"(",
"dateStr",
"==",
"null",
")",
"{",
"return",
"createCalendar",
"(",
"null",
")",
".",
"getTime",
"(",
")",
";",
"}",
"final",
"Calendar",
"cal",
"=",
"get... | Creates a Date object given a string representation of it
@param dateStr
string (return today if string is null)
@return today if string is null, a Date object representing the string
otherwise
@throws IllegalArgumentException
if the string cannot be parsed. | [
"Creates",
"a",
"Date",
"object",
"given",
"a",
"string",
"representation",
"of",
"it"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L82-L88 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java | Utils.createCalendar | public static Calendar createCalendar(final String dateStr) {
if (dateStr == null) {
return blastTime(Calendar.getInstance());
}
return getCal(dateStr);
} | java | public static Calendar createCalendar(final String dateStr) {
if (dateStr == null) {
return blastTime(Calendar.getInstance());
}
return getCal(dateStr);
} | [
"public",
"static",
"Calendar",
"createCalendar",
"(",
"final",
"String",
"dateStr",
")",
"{",
"if",
"(",
"dateStr",
"==",
"null",
")",
"{",
"return",
"blastTime",
"(",
"Calendar",
".",
"getInstance",
"(",
")",
")",
";",
"}",
"return",
"getCal",
"(",
"da... | get a new Calendar based on the string date.
@param dateStr
the date string
@return a new Calendar
@throws IllegalArgumentException
if the string cannot be parsed. | [
"get",
"a",
"new",
"Calendar",
"based",
"on",
"the",
"string",
"date",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L106-L111 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java | Utils.getCal | public static Calendar getCal(final Date date) {
if (date == null) {
return null;
}
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
return blastTime(cal);
} | java | public static Calendar getCal(final Date date) {
if (date == null) {
return null;
}
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
return blastTime(cal);
} | [
"public",
"static",
"Calendar",
"getCal",
"(",
"final",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setT... | Get a Calendar object for a given Date representation.
@param date
@return the Calendar | [
"Get",
"a",
"Calendar",
"object",
"for",
"a",
"given",
"Date",
"representation",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L128-L135 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java | Utils.toDateSet | public static Set<Date> toDateSet(final Set<Calendar> calendars) {
return calendars.stream().map(Calendar::getTime).collect(Collectors.toSet());
} | java | public static Set<Date> toDateSet(final Set<Calendar> calendars) {
return calendars.stream().map(Calendar::getTime).collect(Collectors.toSet());
} | [
"public",
"static",
"Set",
"<",
"Date",
">",
"toDateSet",
"(",
"final",
"Set",
"<",
"Calendar",
">",
"calendars",
")",
"{",
"return",
"calendars",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Calendar",
"::",
"getTime",
")",
".",
"collect",
"(",
"Collect... | Converts a Set of Calendar objects to a Set of Date objects
@param calendars
@return the converset Set<Date> | [
"Converts",
"a",
"Set",
"of",
"Calendar",
"objects",
"to",
"a",
"Set",
"of",
"Date",
"objects"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L167-L169 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java | AbstractDateCalculator.setStartDate | @Override
public DateCalculator<E> setStartDate(final E startDate) {
this.startDate = startDate;
setCurrentBusinessDate(startDate);
return this;
} | java | @Override
public DateCalculator<E> setStartDate(final E startDate) {
this.startDate = startDate;
setCurrentBusinessDate(startDate);
return this;
} | [
"@",
"Override",
"public",
"DateCalculator",
"<",
"E",
">",
"setStartDate",
"(",
"final",
"E",
"startDate",
")",
"{",
"this",
".",
"startDate",
"=",
"startDate",
";",
"setCurrentBusinessDate",
"(",
"startDate",
")",
";",
"return",
"this",
";",
"}"
] | Set both start date and current date | [
"Set",
"both",
"start",
"date",
"and",
"current",
"date"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L118-L123 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java | AbstractDateCalculator.moveByTenor | @Override
public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) {
if (tenor == null) {
throw new IllegalArgumentException("Tenor cannot be null");
}
TenorCode tenorCode = tenor.getCode();
if (tenorCode != TenorCode.OVERNIGHT && tenorCode != Te... | java | @Override
public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) {
if (tenor == null) {
throw new IllegalArgumentException("Tenor cannot be null");
}
TenorCode tenorCode = tenor.getCode();
if (tenorCode != TenorCode.OVERNIGHT && tenorCode != Te... | [
"@",
"Override",
"public",
"DateCalculator",
"<",
"E",
">",
"moveByTenor",
"(",
"final",
"Tenor",
"tenor",
",",
"final",
"int",
"spotLag",
")",
"{",
"if",
"(",
"tenor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Tenor cannot ... | move the current date by a given tenor, this means that if a date is
either a 'weekend' or holiday, it will be skipped acording to the holiday
handler and not count towards the number of days to move.
@param tenor the tenor.
@param spotLag
number of days to "spot" days, this can vary from one market
to the other.
@ret... | [
"move",
"the",
"current",
"date",
"by",
"a",
"given",
"tenor",
"this",
"means",
"that",
"if",
"a",
"date",
"is",
"either",
"a",
"weekend",
"or",
"holiday",
"it",
"will",
"be",
"skipped",
"acording",
"to",
"the",
"holiday",
"handler",
"and",
"not",
"count... | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L145-L168 | train |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java | AbstractDateCalculator.isNonWorkingDay | @Override
public boolean isNonWorkingDay(final E date) {
if (date != null && (holidayCalendar.getEarlyBoundary() != null || holidayCalendar.getLateBoundary() != null)) {
checkBoundary(date);
}
return isWeekend(date) || holidayCalendar.isHoliday(date);
} | java | @Override
public boolean isNonWorkingDay(final E date) {
if (date != null && (holidayCalendar.getEarlyBoundary() != null || holidayCalendar.getLateBoundary() != null)) {
checkBoundary(date);
}
return isWeekend(date) || holidayCalendar.isHoliday(date);
} | [
"@",
"Override",
"public",
"boolean",
"isNonWorkingDay",
"(",
"final",
"E",
"date",
")",
"{",
"if",
"(",
"date",
"!=",
"null",
"&&",
"(",
"holidayCalendar",
".",
"getEarlyBoundary",
"(",
")",
"!=",
"null",
"||",
"holidayCalendar",
".",
"getLateBoundary",
"("... | is the given date a non working day? | [
"is",
"the",
"given",
"date",
"a",
"non",
"working",
"day?"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L271-L277 | train |
Appendium/objectlabkit | utils-excel/src/main/java/net/objectlab/kit/util/excel/ExcelCell.java | ExcelCell.newCell | public ExcelCell newCell(String url, String label) {
return row.newCell().link(url, label);
} | java | public ExcelCell newCell(String url, String label) {
return row.newCell().link(url, label);
} | [
"public",
"ExcelCell",
"newCell",
"(",
"String",
"url",
",",
"String",
"label",
")",
"{",
"return",
"row",
".",
"newCell",
"(",
")",
".",
"link",
"(",
"url",
",",
"label",
")",
";",
"}"
] | Add a hyperlink
@param url URL
@param label Label for the cell
@return the cell | [
"Add",
"a",
"hyperlink"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils-excel/src/main/java/net/objectlab/kit/util/excel/ExcelCell.java#L71-L73 | train |
Appendium/objectlabkit | fxcalc/src/main/java/net/objectlab/kit/fxcalc/Cash.java | Cash.add | @Override
public CurrencyAmount add(final CurrencyAmount money) {
if (!money.getCurrency().equals(currency)) {
throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency);
}
return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount... | java | @Override
public CurrencyAmount add(final CurrencyAmount money) {
if (!money.getCurrency().equals(currency)) {
throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency);
}
return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount... | [
"@",
"Override",
"public",
"CurrencyAmount",
"add",
"(",
"final",
"CurrencyAmount",
"money",
")",
"{",
"if",
"(",
"!",
"money",
".",
"getCurrency",
"(",
")",
".",
"equals",
"(",
"currency",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Add the amount with the existing one and return a new immutable Money.
@throws IllegalArgumentException if the money.currency does not match the current one. | [
"Add",
"the",
"amount",
"with",
"the",
"existing",
"one",
"and",
"return",
"a",
"new",
"immutable",
"Money",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/Cash.java#L78-L84 | train |
Appendium/objectlabkit | datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java | DateDateCalculator.isWeekend | public boolean isWeekend(final Date date) {
if (date != null && delegate != null) {
return delegate.isWeekend(Utils.getCal(date));
}
return false;
} | java | public boolean isWeekend(final Date date) {
if (date != null && delegate != null) {
return delegate.isWeekend(Utils.getCal(date));
}
return false;
} | [
"public",
"boolean",
"isWeekend",
"(",
"final",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"!=",
"null",
"&&",
"delegate",
"!=",
"null",
")",
"{",
"return",
"delegate",
".",
"isWeekend",
"(",
"Utils",
".",
"getCal",
"(",
"date",
")",
")",
";",
"}",... | is the date a non-working day according to the WorkingWeek? | [
"is",
"the",
"date",
"a",
"non",
"-",
"working",
"day",
"according",
"to",
"the",
"WorkingWeek?"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java#L97-L102 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.bd | public static BigDecimal bd(final String val) {
return val != null && val.length() > 0 ? new BigDecimal(val) : null;
} | java | public static BigDecimal bd(final String val) {
return val != null && val.length() > 0 ? new BigDecimal(val) : null;
} | [
"public",
"static",
"BigDecimal",
"bd",
"(",
"final",
"String",
"val",
")",
"{",
"return",
"val",
"!=",
"null",
"&&",
"val",
".",
"length",
"(",
")",
">",
"0",
"?",
"new",
"BigDecimal",
"(",
"val",
")",
":",
"null",
";",
"}"
] | Convenience method to create a BigDecimal with a String, can be statically imported.
@param val a string representing the BigDecimal
@return the new BigDecimal | [
"Convenience",
"method",
"to",
"create",
"a",
"BigDecimal",
"with",
"a",
"String",
"can",
"be",
"statically",
"imported",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L75-L77 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.inverse | public static BigDecimal inverse(final BigDecimal value) {
if (isNotZero(value)) {
return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP);
}
return null;
} | java | public static BigDecimal inverse(final BigDecimal value) {
if (isNotZero(value)) {
return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP);
}
return null;
} | [
"public",
"static",
"BigDecimal",
"inverse",
"(",
"final",
"BigDecimal",
"value",
")",
"{",
"if",
"(",
"isNotZero",
"(",
"value",
")",
")",
"{",
"return",
"BigDecimal",
".",
"ONE",
".",
"setScale",
"(",
"MAX_SCALE_FOR_INVERSE",
")",
".",
"divide",
"(",
"va... | Return the inverse of value if no tnull of zero
@param value the nullable BigDecimal
@return 1 / value (if not null of zero) | [
"Return",
"the",
"inverse",
"of",
"value",
"if",
"no",
"tnull",
"of",
"zero"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L108-L113 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.isSameAbsValue | public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
return isSameValue(abs(v1), abs(v2));
} | java | public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
return isSameValue(abs(v1), abs(v2));
} | [
"public",
"static",
"boolean",
"isSameAbsValue",
"(",
"final",
"BigDecimal",
"v1",
",",
"final",
"BigDecimal",
"v2",
")",
"{",
"return",
"isSameValue",
"(",
"abs",
"(",
"v1",
")",
",",
"abs",
"(",
"v2",
")",
")",
";",
"}"
] | Check ABS values of v1 and v2.
@param v1 nullable BigDecimal
@param v2 nullable BigDecimal
@return true if the ABS value match! | [
"Check",
"ABS",
"values",
"of",
"v1",
"and",
"v2",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L347-L349 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.roundTo | public static BigDecimal roundTo(final BigDecimal bd, final int numberOfDecPlaces, final int finalScale) {
return setScale(setScale(bd, numberOfDecPlaces, BigDecimal.ROUND_HALF_UP), finalScale);
} | java | public static BigDecimal roundTo(final BigDecimal bd, final int numberOfDecPlaces, final int finalScale) {
return setScale(setScale(bd, numberOfDecPlaces, BigDecimal.ROUND_HALF_UP), finalScale);
} | [
"public",
"static",
"BigDecimal",
"roundTo",
"(",
"final",
"BigDecimal",
"bd",
",",
"final",
"int",
"numberOfDecPlaces",
",",
"final",
"int",
"finalScale",
")",
"{",
"return",
"setScale",
"(",
"setScale",
"(",
"bd",
",",
"numberOfDecPlaces",
",",
"BigDecimal",
... | returns a new BigDecimal with correct scale after being round to n dec places.
@param bd value
@param numberOfDecPlaces number of dec place to round to
@param finalScale final scale of result (typically numberOfDecPlaces < finalScale);
@return new bd or null | [
"returns",
"a",
"new",
"BigDecimal",
"with",
"correct",
"scale",
"after",
"being",
"round",
"to",
"n",
"dec",
"places",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L397-L399 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.setScale | public static BigDecimal setScale(final BigDecimal bd, final int scale) {
return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
} | java | public static BigDecimal setScale(final BigDecimal bd, final int scale) {
return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
} | [
"public",
"static",
"BigDecimal",
"setScale",
"(",
"final",
"BigDecimal",
"bd",
",",
"final",
"int",
"scale",
")",
"{",
"return",
"setScale",
"(",
"bd",
",",
"scale",
",",
"BigDecimal",
".",
"ROUND_HALF_UP",
")",
";",
"}"
] | returns a new BigDecimal with correct scale.
@param bd
@return new bd or null | [
"returns",
"a",
"new",
"BigDecimal",
"with",
"correct",
"scale",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L407-L409 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.setScale | public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) {
if (bd != null && scale != null) {
return bd.setScale(scale, rounding);
}
return null;
} | java | public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) {
if (bd != null && scale != null) {
return bd.setScale(scale, rounding);
}
return null;
} | [
"public",
"static",
"BigDecimal",
"setScale",
"(",
"final",
"BigDecimal",
"bd",
",",
"final",
"Integer",
"scale",
",",
"final",
"int",
"rounding",
")",
"{",
"if",
"(",
"bd",
"!=",
"null",
"&&",
"scale",
"!=",
"null",
")",
"{",
"return",
"bd",
".",
"set... | returns a new BigDecimal with correct Scales.PERCENT_SCALE. This is used
by the table renderer.
@param bd
@return new bd or null | [
"returns",
"a",
"new",
"BigDecimal",
"with",
"correct",
"Scales",
".",
"PERCENT_SCALE",
".",
"This",
"is",
"used",
"by",
"the",
"table",
"renderer",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L428-L433 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.percentFormat | public static String percentFormat(final BigDecimal bd) {
return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : "";
} | java | public static String percentFormat(final BigDecimal bd) {
return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : "";
} | [
"public",
"static",
"String",
"percentFormat",
"(",
"final",
"BigDecimal",
"bd",
")",
"{",
"return",
"bd",
"!=",
"null",
"?",
"NUMBER_FORMAT",
".",
"format",
"(",
"bd",
".",
"movePointRight",
"(",
"2",
")",
")",
":",
"\"\"",
";",
"}"
] | return a Number formatted or empty string if null.
@param bd | [
"return",
"a",
"Number",
"formatted",
"or",
"empty",
"string",
"if",
"null",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L534-L536 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.ensureMin | public static BigDecimal ensureMin(final BigDecimal minimum, final BigDecimal value) {
return BigDecimalUtil.compareTo(minimum, value) == 1 ? minimum : value;
} | java | public static BigDecimal ensureMin(final BigDecimal minimum, final BigDecimal value) {
return BigDecimalUtil.compareTo(minimum, value) == 1 ? minimum : value;
} | [
"public",
"static",
"BigDecimal",
"ensureMin",
"(",
"final",
"BigDecimal",
"minimum",
",",
"final",
"BigDecimal",
"value",
")",
"{",
"return",
"BigDecimalUtil",
".",
"compareTo",
"(",
"minimum",
",",
"value",
")",
"==",
"1",
"?",
"minimum",
":",
"value",
";"... | Return minimum if the value is < minimum. | [
"Return",
"minimum",
"if",
"the",
"value",
"is",
"<",
";",
"minimum",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L694-L696 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.forceNegativeIfTrue | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | java | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | [
"public",
"static",
"BigDecimal",
"forceNegativeIfTrue",
"(",
"final",
"boolean",
"condition",
",",
"final",
"BigDecimal",
"amount",
")",
"{",
"return",
"condition",
"?",
"BigDecimalUtil",
".",
"negate",
"(",
"BigDecimalUtil",
".",
"abs",
"(",
"amount",
")",
")"... | Return a negative amount based on amount if true, otherwise return the ABS. | [
"Return",
"a",
"negative",
"amount",
"based",
"on",
"amount",
"if",
"true",
"otherwise",
"return",
"the",
"ABS",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L708-L710 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.decimalPart | public static BigDecimal decimalPart(final BigDecimal val) {
return BigDecimalUtil.subtract(val, val.setScale(0, BigDecimal.ROUND_DOWN));
} | java | public static BigDecimal decimalPart(final BigDecimal val) {
return BigDecimalUtil.subtract(val, val.setScale(0, BigDecimal.ROUND_DOWN));
} | [
"public",
"static",
"BigDecimal",
"decimalPart",
"(",
"final",
"BigDecimal",
"val",
")",
"{",
"return",
"BigDecimalUtil",
".",
"subtract",
"(",
"val",
",",
"val",
".",
"setScale",
"(",
"0",
",",
"BigDecimal",
".",
"ROUND_DOWN",
")",
")",
";",
"}"
] | Return the decimal part of the value.
@param val | [
"Return",
"the",
"decimal",
"part",
"of",
"the",
"value",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L772-L774 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.sqrtNewtonRaphson | private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) {
BigDecimal fx = xn.pow(2).add(c.negate());
BigDecimal fpx = xn.multiply(new BigDecimal(2));
BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN);
... | java | private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) {
BigDecimal fx = xn.pow(2).add(c.negate());
BigDecimal fpx = xn.multiply(new BigDecimal(2));
BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN);
... | [
"private",
"static",
"BigDecimal",
"sqrtNewtonRaphson",
"(",
"final",
"BigDecimal",
"c",
",",
"final",
"BigDecimal",
"xn",
",",
"final",
"BigDecimal",
"precision",
")",
"{",
"BigDecimal",
"fx",
"=",
"xn",
".",
"pow",
"(",
"2",
")",
".",
"add",
"(",
"c",
... | Private utility method used to compute the square root of a BigDecimal.
@author Luciano Culacciatti
@see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a> | [
"Private",
"utility",
"method",
"used",
"to",
"compute",
"the",
"square",
"root",
"of",
"a",
"BigDecimal",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L782-L794 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.bigSqrt | public static BigDecimal bigSqrt(final BigDecimal c) {
if (c == null) {
return null;
}
return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE));
} | java | public static BigDecimal bigSqrt(final BigDecimal c) {
if (c == null) {
return null;
}
return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE));
} | [
"public",
"static",
"BigDecimal",
"bigSqrt",
"(",
"final",
"BigDecimal",
"c",
")",
"{",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"c",
".",
"signum",
"(",
")",
"==",
"0",
"?",
"BigDecimal",
".",
"ZERO",
":",
"sqr... | Uses Newton Raphson to compute the square root of a BigDecimal.
@param c the BigDecimal for which we want the SQRT.
@author Luciano Culacciatti
@see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a> | [
"Uses",
"Newton",
"Raphson",
"to",
"compute",
"the",
"square",
"root",
"of",
"a",
"BigDecimal",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L803-L809 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.addMenuItem | public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) {
menu.add(menuDisplay);
methods.add(methodName);
askForRepeat.add(Boolean.valueOf(repeat));
} | java | public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) {
menu.add(menuDisplay);
methods.add(methodName);
askForRepeat.add(Boolean.valueOf(repeat));
} | [
"public",
"void",
"addMenuItem",
"(",
"final",
"String",
"menuDisplay",
",",
"final",
"String",
"methodName",
",",
"final",
"boolean",
"repeat",
")",
"{",
"menu",
".",
"add",
"(",
"menuDisplay",
")",
";",
"methods",
".",
"add",
"(",
"methodName",
")",
";",... | add an entry in the menu, sequentially
@param menuDisplay
how the entry will be displayed in the menu
@param methodName
name of the public method
@param repeat call back for repeat | [
"add",
"an",
"entry",
"in",
"the",
"menu",
"sequentially"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L94-L98 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.displayMenu | public void displayMenu() {
while (true) {
ConsoleMenu.println("");
ConsoleMenu.println("Menu Options");
final int size = menu.size();
displayMenu(size);
int opt;
do {
opt = ConsoleMenu.getInt("Enter your cho... | java | public void displayMenu() {
while (true) {
ConsoleMenu.println("");
ConsoleMenu.println("Menu Options");
final int size = menu.size();
displayMenu(size);
int opt;
do {
opt = ConsoleMenu.getInt("Enter your cho... | [
"public",
"void",
"displayMenu",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"ConsoleMenu",
".",
"println",
"(",
"\"\"",
")",
";",
"ConsoleMenu",
".",
"println",
"(",
"\"Menu Options\"",
")",
";",
"final",
"int",
"size",
"=",
"menu",
".",
"size",
"(... | display the menu, the application goes into a loop which provides the
menu and fires the entries selected. It automatically adds an entry to
exit. | [
"display",
"the",
"menu",
"the",
"application",
"goes",
"into",
"a",
"loop",
"which",
"provides",
"the",
"menu",
"and",
"fires",
"the",
"entries",
"selected",
".",
"It",
"automatically",
"adds",
"an",
"entry",
"to",
"exit",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L109-L131 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.getInt | public static int getInt(final String title, final int defaultValue) {
int opt;
do {
try {
final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")");
if (val.length() == 0) {
opt = defaultValue;
... | java | public static int getInt(final String title, final int defaultValue) {
int opt;
do {
try {
final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")");
if (val.length() == 0) {
opt = defaultValue;
... | [
"public",
"static",
"int",
"getInt",
"(",
"final",
"String",
"title",
",",
"final",
"int",
"defaultValue",
")",
"{",
"int",
"opt",
";",
"do",
"{",
"try",
"{",
"final",
"String",
"val",
"=",
"ConsoleMenu",
".",
"getString",
"(",
"title",
"+",
"DEFAULT_TIT... | Gets an int from the System.in
@param title for the command line
@param defaultValue defaultValue if title not found
@return int as entered by the user of the console app | [
"Gets",
"an",
"int",
"from",
"the",
"System",
".",
"in"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L218-L235 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.getBoolean | public static boolean getBoolean(final String title, final boolean defaultValue) {
final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" },
new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2);
return Boolean.valueOf(val);
... | java | public static boolean getBoolean(final String title, final boolean defaultValue) {
final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" },
new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2);
return Boolean.valueOf(val);
... | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"final",
"String",
"title",
",",
"final",
"boolean",
"defaultValue",
")",
"{",
"final",
"String",
"val",
"=",
"ConsoleMenu",
".",
"selectOne",
"(",
"title",
",",
"new",
"String",
"[",
"]",
"{",
"\"Yes\"",
"... | Gets a boolean from the System.in
@param title
for the command line
@return boolean as selected by the user of the console app | [
"Gets",
"a",
"boolean",
"from",
"the",
"System",
".",
"in"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L244-L249 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.getBigDecimal | public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) {
BigDecimal opt;
do {
try {
final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")");
if (val.length() == 0) {
op... | java | public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) {
BigDecimal opt;
do {
try {
final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")");
if (val.length() == 0) {
op... | [
"public",
"static",
"BigDecimal",
"getBigDecimal",
"(",
"final",
"String",
"title",
",",
"final",
"BigDecimal",
"defaultValue",
")",
"{",
"BigDecimal",
"opt",
";",
"do",
"{",
"try",
"{",
"final",
"String",
"val",
"=",
"ConsoleMenu",
".",
"getString",
"(",
"t... | Gets an BigDecimal from the System.in
@param title
for the command line
@return int as entered by the user of the console app | [
"Gets",
"an",
"BigDecimal",
"from",
"the",
"System",
".",
"in"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L258-L275 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.getString | public static String getString(final String msg) {
ConsoleMenu.print(msg);
BufferedReader bufReader = null;
String opt = null;
try {
bufReader = new BufferedReader(new InputStreamReader(System.in));
opt = bufReader.readLine();
} catch (final IOE... | java | public static String getString(final String msg) {
ConsoleMenu.print(msg);
BufferedReader bufReader = null;
String opt = null;
try {
bufReader = new BufferedReader(new InputStreamReader(System.in));
opt = bufReader.readLine();
} catch (final IOE... | [
"public",
"static",
"String",
"getString",
"(",
"final",
"String",
"msg",
")",
"{",
"ConsoleMenu",
".",
"print",
"(",
"msg",
")",
";",
"BufferedReader",
"bufReader",
"=",
"null",
";",
"String",
"opt",
"=",
"null",
";",
"try",
"{",
"bufReader",
"=",
"new"... | Gets a String from the System.in.
@param msg
for the command line
@return String as entered by the user of the console app | [
"Gets",
"a",
"String",
"from",
"the",
"System",
".",
"in",
"."
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L307-L322 | train |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.getString | public static String getString(final String msg, final String defaultVal) {
String s = getString(msg + "(default:" + defaultVal + "):");
if (StringUtils.isBlank(s)) {
s = defaultVal;
}
return s;
} | java | public static String getString(final String msg, final String defaultVal) {
String s = getString(msg + "(default:" + defaultVal + "):");
if (StringUtils.isBlank(s)) {
s = defaultVal;
}
return s;
} | [
"public",
"static",
"String",
"getString",
"(",
"final",
"String",
"msg",
",",
"final",
"String",
"defaultVal",
")",
"{",
"String",
"s",
"=",
"getString",
"(",
"msg",
"+",
"\"(default:\"",
"+",
"defaultVal",
"+",
"\"):\"",
")",
";",
"if",
"(",
"StringUtils... | Gets a String from the System.in
@param msg
for the command line
@return String as entered by the user of the console app | [
"Gets",
"a",
"String",
"from",
"the",
"System",
".",
"in"
] | cd649bce7a32e4e926520e62cb765f3b1d451594 | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L331-L338 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.