id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,900 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/annotated/AnnotatedTypeImpl.java | AnnotatedTypeImpl.initAnnotatedFields | private void initAnnotatedFields() {
final Set<Field> hiddenFields = Reflections.getHiddenFields(beanClass);
inject(hiddenFields);
final Set<Field> inheritedFields = Reflections.getInheritedFields(beanClass);
inject(inheritedFields);
final Set<Field> ownFields = Reflections.get... | java | private void initAnnotatedFields() {
final Set<Field> hiddenFields = Reflections.getHiddenFields(beanClass);
inject(hiddenFields);
final Set<Field> inheritedFields = Reflections.getInheritedFields(beanClass);
inject(inheritedFields);
final Set<Field> ownFields = Reflections.get... | [
"private",
"void",
"initAnnotatedFields",
"(",
")",
"{",
"final",
"Set",
"<",
"Field",
">",
"hiddenFields",
"=",
"Reflections",
".",
"getHiddenFields",
"(",
"beanClass",
")",
";",
"inject",
"(",
"hiddenFields",
")",
";",
"final",
"Set",
"<",
"Field",
">",
... | Builds the annotated fields of this annotated type. | [
"Builds",
"the",
"annotated",
"fields",
"of",
"this",
"annotated",
"type",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/annotated/AnnotatedTypeImpl.java#L64-L73 |
47,901 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/StaticResources.java | StaticResources.isStatic | public static boolean isStatic(final HttpServletRequest request) {
final boolean requestStaticResourceChecked = null == request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED)
? false
: (Boolean) request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED... | java | public static boolean isStatic(final HttpServletRequest request) {
final boolean requestStaticResourceChecked = null == request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED)
? false
: (Boolean) request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED... | [
"public",
"static",
"boolean",
"isStatic",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"final",
"boolean",
"requestStaticResourceChecked",
"=",
"null",
"==",
"request",
".",
"getAttribute",
"(",
"Keys",
".",
"HttpRequest",
".",
"REQUEST_STATIC_RESOURCE_CH... | Determines whether the client requests a static resource with the specified request.
@param request the specified request
@return {@code true} if the client requests a static resource, returns {@code false} otherwise | [
"Determines",
"whether",
"the",
"client",
"requests",
"a",
"static",
"resource",
"with",
"the",
"specified",
"request",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/StaticResources.java#L68-L94 |
47,902 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/StaticResources.java | StaticResources.init | private static synchronized void init() {
LOGGER.trace("Reads static resources definition from [static-resources.xml]");
final File staticResources = Latkes.getWebFile("/WEB-INF/static-resources.xml");
if (null == staticResources || !staticResources.exists()) {
throw new IllegalStat... | java | private static synchronized void init() {
LOGGER.trace("Reads static resources definition from [static-resources.xml]");
final File staticResources = Latkes.getWebFile("/WEB-INF/static-resources.xml");
if (null == staticResources || !staticResources.exists()) {
throw new IllegalStat... | [
"private",
"static",
"synchronized",
"void",
"init",
"(",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Reads static resources definition from [static-resources.xml]\"",
")",
";",
"final",
"File",
"staticResources",
"=",
"Latkes",
".",
"getWebFile",
"(",
"\"/WEB-INF/static-... | Initializes the static resource path patterns. | [
"Initializes",
"the",
"static",
"resource",
"path",
"patterns",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/StaticResources.java#L99-L162 |
47,903 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/BeanManager.java | BeanManager.start | public static void start(final Collection<Class<?>> classes) {
LOGGER.log(Level.DEBUG, "Initializing Latke IoC container");
final Configurator configurator = getInstance().getConfigurator();
if (null != classes && !classes.isEmpty()) {
configurator.createBeans(classes);
}
... | java | public static void start(final Collection<Class<?>> classes) {
LOGGER.log(Level.DEBUG, "Initializing Latke IoC container");
final Configurator configurator = getInstance().getConfigurator();
if (null != classes && !classes.isEmpty()) {
configurator.createBeans(classes);
}
... | [
"public",
"static",
"void",
"start",
"(",
"final",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"DEBUG",
",",
"\"Initializing Latke IoC container\"",
")",
";",
"final",
"Configurator",
"configu... | Starts the application with the specified bean class and bean modules.
@param classes the specified bean class, nullable | [
"Starts",
"the",
"application",
"with",
"the",
"specified",
"bean",
"class",
"and",
"bean",
"modules",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/BeanManager.java#L101-L110 |
47,904 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.setLocalProperty | public static void setLocalProperty(final String key, final String value) {
if (null == key) {
LOGGER.log(Level.WARN, "local.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "local.props can not set null value");
... | java | public static void setLocalProperty(final String key, final String value) {
if (null == key) {
LOGGER.log(Level.WARN, "local.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "local.props can not set null value");
... | [
"public",
"static",
"void",
"setLocalProperty",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARN",
",",
"\"local.props can not set null key\"",
... | Sets local.props with the specified key and value.
@param key the specified key
@param value the specified value | [
"Sets",
"local",
".",
"props",
"with",
"the",
"specified",
"key",
"and",
"value",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L148-L161 |
47,905 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.setLatkeProperty | public static void setLatkeProperty(final String key, final String value) {
if (null == key) {
LOGGER.log(Level.WARN, "latke.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "latke.props can not set null value");
... | java | public static void setLatkeProperty(final String key, final String value) {
if (null == key) {
LOGGER.log(Level.WARN, "latke.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "latke.props can not set null value");
... | [
"public",
"static",
"void",
"setLatkeProperty",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARN",
",",
"\"latke.props can not set null key\"",
... | Sets latke.props with the specified key and value.
@param key the specified key
@param value the specified value | [
"Sets",
"latke",
".",
"props",
"with",
"the",
"specified",
"key",
"and",
"value",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L178-L191 |
47,906 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.loadLocalProps | private static void loadLocalProps() {
if (null == localProps) {
localProps = new Properties();
}
try {
InputStream resourceAsStream;
final String localPropsEnv = System.getenv("LATKE_LOCAL_PROPS");
if (StringUtils.isNotBlank(localPropsEnv)) {
... | java | private static void loadLocalProps() {
if (null == localProps) {
localProps = new Properties();
}
try {
InputStream resourceAsStream;
final String localPropsEnv = System.getenv("LATKE_LOCAL_PROPS");
if (StringUtils.isNotBlank(localPropsEnv)) {
... | [
"private",
"static",
"void",
"loadLocalProps",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"localProps",
")",
"{",
"localProps",
"=",
"new",
"Properties",
"(",
")",
";",
"}",
"try",
"{",
"InputStream",
"resourceAsStream",
";",
"final",
"String",
"localPropsEnv",... | Loads the local.props. | [
"Loads",
"the",
"local",
".",
"props",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L196-L219 |
47,907 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.loadLatkeProps | private static void loadLatkeProps() {
if (null == latkeProps) {
latkeProps = new Properties();
}
try {
InputStream resourceAsStream;
final String latkePropsEnv = System.getenv("LATKE_PROPS");
if (StringUtils.isNotBlank(latkePropsEnv)) {
... | java | private static void loadLatkeProps() {
if (null == latkeProps) {
latkeProps = new Properties();
}
try {
InputStream resourceAsStream;
final String latkePropsEnv = System.getenv("LATKE_PROPS");
if (StringUtils.isNotBlank(latkePropsEnv)) {
... | [
"private",
"static",
"void",
"loadLatkeProps",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"latkeProps",
")",
"{",
"latkeProps",
"=",
"new",
"Properties",
"(",
")",
";",
"}",
"try",
"{",
"InputStream",
"resourceAsStream",
";",
"final",
"String",
"latkePropsEnv",... | Loads the latke.props. | [
"Loads",
"the",
"latke",
".",
"props",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L224-L249 |
47,908 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getServerScheme | public static String getServerScheme() {
String ret = getLatkeProperty("serverScheme");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getScheme();
} else ... | java | public static String getServerScheme() {
String ret = getLatkeProperty("serverScheme");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getScheme();
} else ... | [
"public",
"static",
"String",
"getServerScheme",
"(",
")",
"{",
"String",
"ret",
"=",
"getLatkeProperty",
"(",
"\"serverScheme\"",
")",
";",
"if",
"(",
"null",
"==",
"ret",
")",
"{",
"final",
"RequestContext",
"requestContext",
"=",
"REQUEST_CONTEXT",
".",
"ge... | Gets server scheme.
@return server scheme | [
"Gets",
"server",
"scheme",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L286-L298 |
47,909 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getServerHost | public static String getServerHost() {
String ret = getLatkeProperty("serverHost");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerName();
} else ... | java | public static String getServerHost() {
String ret = getLatkeProperty("serverHost");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerName();
} else ... | [
"public",
"static",
"String",
"getServerHost",
"(",
")",
"{",
"String",
"ret",
"=",
"getLatkeProperty",
"(",
"\"serverHost\"",
")",
";",
"if",
"(",
"null",
"==",
"ret",
")",
"{",
"final",
"RequestContext",
"requestContext",
"=",
"REQUEST_CONTEXT",
".",
"get",
... | Gets server host.
@return server host | [
"Gets",
"server",
"host",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L305-L319 |
47,910 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.initPublicIP | public synchronized static void initPublicIP() {
if (StringUtils.isNotBlank(PUBLIC_IP)) {
return;
}
try {
final URL url = new URL("http://checkip.amazonaws.com");
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
ur... | java | public synchronized static void initPublicIP() {
if (StringUtils.isNotBlank(PUBLIC_IP)) {
return;
}
try {
final URL url = new URL("http://checkip.amazonaws.com");
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
ur... | [
"public",
"synchronized",
"static",
"void",
"initPublicIP",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"PUBLIC_IP",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"\"http://checkip.amazon... | Init public IP. | [
"Init",
"public",
"IP",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L326-L352 |
47,911 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getServerPort | public static String getServerPort() {
String ret = getLatkeProperty("serverPort");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerPort() + "";
}
... | java | public static String getServerPort() {
String ret = getLatkeProperty("serverPort");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerPort() + "";
}
... | [
"public",
"static",
"String",
"getServerPort",
"(",
")",
"{",
"String",
"ret",
"=",
"getLatkeProperty",
"(",
"\"serverPort\"",
")",
";",
"if",
"(",
"null",
"==",
"ret",
")",
"{",
"final",
"RequestContext",
"requestContext",
"=",
"REQUEST_CONTEXT",
".",
"get",
... | Gets server port.
@return server port | [
"Gets",
"server",
"port",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L359-L369 |
47,912 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getServer | public static String getServer() {
final StringBuilder serverBuilder = new StringBuilder(getServerScheme()).append("://").append(getServerHost());
final String port = getServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
serverBuilder.appen... | java | public static String getServer() {
final StringBuilder serverBuilder = new StringBuilder(getServerScheme()).append("://").append(getServerHost());
final String port = getServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
serverBuilder.appen... | [
"public",
"static",
"String",
"getServer",
"(",
")",
"{",
"final",
"StringBuilder",
"serverBuilder",
"=",
"new",
"StringBuilder",
"(",
"getServerScheme",
"(",
")",
")",
".",
"append",
"(",
"\"://\"",
")",
".",
"append",
"(",
"getServerHost",
"(",
")",
")",
... | Gets server.
@return server, ${serverScheme}://${serverHost}:${serverPort} | [
"Gets",
"server",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L376-L384 |
47,913 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getStaticServer | public static String getStaticServer() {
final StringBuilder staticServerBuilder = new StringBuilder(getStaticServerScheme()).append("://").append(getStaticServerHost());
final String port = getStaticServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
... | java | public static String getStaticServer() {
final StringBuilder staticServerBuilder = new StringBuilder(getStaticServerScheme()).append("://").append(getStaticServerHost());
final String port = getStaticServerPort();
if (StringUtils.isNotBlank(port) && !"80".equals(port) && !"443".equals(port)) {
... | [
"public",
"static",
"String",
"getStaticServer",
"(",
")",
"{",
"final",
"StringBuilder",
"staticServerBuilder",
"=",
"new",
"StringBuilder",
"(",
"getStaticServerScheme",
"(",
")",
")",
".",
"append",
"(",
"\"://\"",
")",
".",
"append",
"(",
"getStaticServerHost"... | Gets static server.
@return static server, ${staticServerScheme}://${staticServerHost}:${staticServerPort} | [
"Gets",
"static",
"server",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L442-L450 |
47,914 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getContextPath | public static String getContextPath() {
if (null != contextPath) {
return contextPath;
}
final String contextPathConf = getLatkeProperty("contextPath");
if (null != contextPathConf) {
contextPath = contextPathConf;
return contextPath;
}
... | java | public static String getContextPath() {
if (null != contextPath) {
return contextPath;
}
final String contextPathConf = getLatkeProperty("contextPath");
if (null != contextPathConf) {
contextPath = contextPathConf;
return contextPath;
}
... | [
"public",
"static",
"String",
"getContextPath",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"contextPath",
")",
"{",
"return",
"contextPath",
";",
"}",
"final",
"String",
"contextPathConf",
"=",
"getLatkeProperty",
"(",
"\"contextPath\"",
")",
";",
"if",
"(",
"n... | Gets context path.
@return context path | [
"Gets",
"context",
"path",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L466-L482 |
47,915 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getStaticPath | public static String getStaticPath() {
if (null == staticPath) {
staticPath = getLatkeProperty("staticPath");
if (null == staticPath) {
staticPath = getContextPath();
}
}
return staticPath;
} | java | public static String getStaticPath() {
if (null == staticPath) {
staticPath = getLatkeProperty("staticPath");
if (null == staticPath) {
staticPath = getContextPath();
}
}
return staticPath;
} | [
"public",
"static",
"String",
"getStaticPath",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"staticPath",
")",
"{",
"staticPath",
"=",
"getLatkeProperty",
"(",
"\"staticPath\"",
")",
";",
"if",
"(",
"null",
"==",
"staticPath",
")",
"{",
"staticPath",
"=",
"getC... | Gets static path.
@return static path | [
"Gets",
"static",
"path",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L498-L508 |
47,916 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.init | public static synchronized void init() {
if (inited) {
return;
}
inited = true;
LOGGER.log(Level.TRACE, "Initializing Latke");
loadLatkeProps();
loadLocalProps();
if (null == runtimeMode) {
final String runtimeModeValue = getLatkePropert... | java | public static synchronized void init() {
if (inited) {
return;
}
inited = true;
LOGGER.log(Level.TRACE, "Initializing Latke");
loadLatkeProps();
loadLocalProps();
if (null == runtimeMode) {
final String runtimeModeValue = getLatkePropert... | [
"public",
"static",
"synchronized",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"inited",
")",
"{",
"return",
";",
"}",
"inited",
"=",
"true",
";",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"TRACE",
",",
"\"Initializing Latke\"",
")",
";",
"loadLatkeProps",... | Initializes Latke framework. | [
"Initializes",
"Latke",
"framework",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L544-L614 |
47,917 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getRuntimeCache | public static RuntimeCache getRuntimeCache() {
final String runtimeCache = getLocalProperty("runtimeCache");
if (null == runtimeCache) {
LOGGER.debug("Not found [runtimeCache] in local.properties, uses [LOCAL_LRU] as default");
return RuntimeCache.LOCAL_LRU;
}
r... | java | public static RuntimeCache getRuntimeCache() {
final String runtimeCache = getLocalProperty("runtimeCache");
if (null == runtimeCache) {
LOGGER.debug("Not found [runtimeCache] in local.properties, uses [LOCAL_LRU] as default");
return RuntimeCache.LOCAL_LRU;
}
r... | [
"public",
"static",
"RuntimeCache",
"getRuntimeCache",
"(",
")",
"{",
"final",
"String",
"runtimeCache",
"=",
"getLocalProperty",
"(",
"\"runtimeCache\"",
")",
";",
"if",
"(",
"null",
"==",
"runtimeCache",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Not found [run... | Gets the runtime cache.
@return runtime cache | [
"Gets",
"the",
"runtime",
"cache",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L643-L652 |
47,918 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getRuntimeDatabase | public static RuntimeDatabase getRuntimeDatabase() {
final String runtimeDatabase = getLocalProperty("runtimeDatabase");
if (null == runtimeDatabase) {
throw new RuntimeException("Please configures runtime database in local.properties!");
}
final RuntimeDatabase ret = Runtim... | java | public static RuntimeDatabase getRuntimeDatabase() {
final String runtimeDatabase = getLocalProperty("runtimeDatabase");
if (null == runtimeDatabase) {
throw new RuntimeException("Please configures runtime database in local.properties!");
}
final RuntimeDatabase ret = Runtim... | [
"public",
"static",
"RuntimeDatabase",
"getRuntimeDatabase",
"(",
")",
"{",
"final",
"String",
"runtimeDatabase",
"=",
"getLocalProperty",
"(",
"\"runtimeDatabase\"",
")",
";",
"if",
"(",
"null",
"==",
"runtimeDatabase",
")",
"{",
"throw",
"new",
"RuntimeException",... | Gets the runtime database.
@return runtime database | [
"Gets",
"the",
"runtime",
"database",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L659-L671 |
47,919 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getLocalProperty | public static String getLocalProperty(final String key) {
String ret = localProps.getProperty(key);
if (StringUtils.isBlank(ret)) {
return ret;
}
ret = replaceEnvVars(ret);
return ret;
} | java | public static String getLocalProperty(final String key) {
String ret = localProps.getProperty(key);
if (StringUtils.isBlank(ret)) {
return ret;
}
ret = replaceEnvVars(ret);
return ret;
} | [
"public",
"static",
"String",
"getLocalProperty",
"(",
"final",
"String",
"key",
")",
"{",
"String",
"ret",
"=",
"localProps",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"ret",
")",
")",
"{",
"return",
"ret",... | Gets a property specified by the given key from file "local.properties".
@param key the given key
@return the value, returns {@code null} if not found | [
"Gets",
"a",
"property",
"specified",
"by",
"the",
"given",
"key",
"from",
"file",
"local",
".",
"properties",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L702-L711 |
47,920 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getLatkeProperty | public static String getLatkeProperty(final String key) {
String ret = latkeProps.getProperty(key);
if (StringUtils.isBlank(ret)) {
return ret;
}
ret = replaceEnvVars(ret);
return ret;
} | java | public static String getLatkeProperty(final String key) {
String ret = latkeProps.getProperty(key);
if (StringUtils.isBlank(ret)) {
return ret;
}
ret = replaceEnvVars(ret);
return ret;
} | [
"public",
"static",
"String",
"getLatkeProperty",
"(",
"final",
"String",
"key",
")",
"{",
"String",
"ret",
"=",
"latkeProps",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"ret",
")",
")",
"{",
"return",
"ret",... | Gets a property specified by the given key from file "latke.properties".
@param key the given key
@return the value, returns {@code null} if not found | [
"Gets",
"a",
"property",
"specified",
"by",
"the",
"given",
"key",
"from",
"file",
"latke",
".",
"properties",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L719-L728 |
47,921 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.shutdown | public static void shutdown() {
try {
EXECUTOR_SERVICE.shutdown();
if (RuntimeCache.REDIS == getRuntimeCache()) {
RedisCache.shutdown();
}
Connections.shutdownConnectionPool();
if (RuntimeDatabase.H2 == getRuntimeDatabase()) {
... | java | public static void shutdown() {
try {
EXECUTOR_SERVICE.shutdown();
if (RuntimeCache.REDIS == getRuntimeCache()) {
RedisCache.shutdown();
}
Connections.shutdownConnectionPool();
if (RuntimeDatabase.H2 == getRuntimeDatabase()) {
... | [
"public",
"static",
"void",
"shutdown",
"(",
")",
"{",
"try",
"{",
"EXECUTOR_SERVICE",
".",
"shutdown",
"(",
")",
";",
"if",
"(",
"RuntimeCache",
".",
"REDIS",
"==",
"getRuntimeCache",
"(",
")",
")",
"{",
"RedisCache",
".",
"shutdown",
"(",
")",
";",
"... | Shutdowns Latke. | [
"Shutdowns",
"Latke",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L733-L769 |
47,922 | b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.getWebFile | public static File getWebFile(final String path) {
final ServletContext servletContext = AbstractServletListener.getServletContext();
File ret;
try {
final URL resource = servletContext.getResource(path);
if (null == resource) {
return null;
... | java | public static File getWebFile(final String path) {
final ServletContext servletContext = AbstractServletListener.getServletContext();
File ret;
try {
final URL resource = servletContext.getResource(path);
if (null == resource) {
return null;
... | [
"public",
"static",
"File",
"getWebFile",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"ServletContext",
"servletContext",
"=",
"AbstractServletListener",
".",
"getServletContext",
"(",
")",
";",
"File",
"ret",
";",
"try",
"{",
"final",
"URL",
"resource",
... | Gets a file in web application with the specified path.
@param path the specified path
@return file,
@see javax.servlet.ServletContext#getResource(java.lang.String)
@see javax.servlet.ServletContext#getResourceAsStream(java.lang.String) | [
"Gets",
"a",
"file",
"in",
"web",
"application",
"with",
"the",
"specified",
"path",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L800-L826 |
47,923 | b3log/latke | latke-core/src/main/java/org/b3log/latke/event/SynchronizedEventQueue.java | SynchronizedEventQueue.fireEvent | synchronized void fireEvent(final Event<?> event) {
final String eventType = event.getType();
List<Event<?>> events = synchronizedEvents.get(eventType);
if (null == events) {
events = new ArrayList<>();
synchronizedEvents.put(eventType, events);
}
events.... | java | synchronized void fireEvent(final Event<?> event) {
final String eventType = event.getType();
List<Event<?>> events = synchronizedEvents.get(eventType);
if (null == events) {
events = new ArrayList<>();
synchronizedEvents.put(eventType, events);
}
events.... | [
"synchronized",
"void",
"fireEvent",
"(",
"final",
"Event",
"<",
"?",
">",
"event",
")",
"{",
"final",
"String",
"eventType",
"=",
"event",
".",
"getType",
"(",
")",
";",
"List",
"<",
"Event",
"<",
"?",
">",
">",
"events",
"=",
"synchronizedEvents",
".... | Fires the specified event.
@param event the specified event | [
"Fires",
"the",
"specified",
"event",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/event/SynchronizedEventQueue.java#L56-L67 |
47,924 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.getEnum | public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException {
E val = optEnum(clazz, index);
if(val==null) {
// JSONException should really take a throwable argument.
// If it did, I would re-implement this with the Enum.valueOf
// method and ... | java | public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException {
E val = optEnum(clazz, index);
if(val==null) {
// JSONException should really take a throwable argument.
// If it did, I would re-implement this with the Enum.valueOf
// method and ... | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"getEnum",
"(",
"Class",
"<",
"E",
">",
"clazz",
",",
"int",
"index",
")",
"throws",
"JSONException",
"{",
"E",
"val",
"=",
"optEnum",
"(",
"clazz",
",",
"index",
")",
";",
"if",
"("... | Get the enum value associated with an index.
@param <E>
Enum Type
@param clazz
The type of enum to retrieve.
@param index
The index must be between 0 and length() - 1.
@return The enum value at the index location
@throws JSONException
if the key is not found or if the value cannot be converted
to an enum. | [
"Get",
"the",
"enum",
"value",
"associated",
"with",
"an",
"index",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L319-L329 |
47,925 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optFloat | public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// ret... | java | public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// ret... | [
"public",
"float",
"optFloat",
"(",
"int",
"index",
",",
"float",
"defaultValue",
")",
"{",
"final",
"Number",
"val",
"=",
"this",
".",
"optNumber",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue"... | Get the optional float value associated with an index. The defaultValue
is returned if there is no value for the index, or if the value is not a
number and cannot be converted to a number.
@param index
subscript
@param defaultValue
The default value.
@return The value. | [
"Get",
"the",
"optional",
"float",
"value",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"there",
"is",
"no",
"value",
"for",
"the",
"index",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
"and",
"cann... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L605-L615 |
47,926 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optInt | public int optInt(int index, int defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.intValue();
} | java | public int optInt(int index, int defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.intValue();
} | [
"public",
"int",
"optInt",
"(",
"int",
"index",
",",
"int",
"defaultValue",
")",
"{",
"final",
"Number",
"val",
"=",
"this",
".",
"optNumber",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";... | Get the optional int value associated with an index. The defaultValue is
returned if there is no value for the index, or if the value is not a
number and cannot be converted to a number.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default value.
@return The value. | [
"Get",
"the",
"optional",
"int",
"value",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"there",
"is",
"no",
"value",
"for",
"the",
"index",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
"and",
"cannot... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L641-L647 |
47,927 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optJSONArray | public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray) o : null;
} | java | public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray) o : null;
} | [
"public",
"JSONArray",
"optJSONArray",
"(",
"int",
"index",
")",
"{",
"Object",
"o",
"=",
"this",
".",
"opt",
"(",
"index",
")",
";",
"return",
"o",
"instanceof",
"JSONArray",
"?",
"(",
"JSONArray",
")",
"o",
":",
"null",
";",
"}"
] | Get the optional JSONArray associated with an index.
@param index
subscript
@return A JSONArray value, or null if the index has no value, or if the
value is not a JSONArray. | [
"Get",
"the",
"optional",
"JSONArray",
"associated",
"with",
"an",
"index",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L741-L744 |
47,928 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optJSONObject | public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ? (JSONObject) o : null;
} | java | public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ? (JSONObject) o : null;
} | [
"public",
"JSONObject",
"optJSONObject",
"(",
"int",
"index",
")",
"{",
"Object",
"o",
"=",
"this",
".",
"opt",
"(",
"index",
")",
";",
"return",
"o",
"instanceof",
"JSONObject",
"?",
"(",
"JSONObject",
")",
"o",
":",
"null",
";",
"}"
] | Get the optional JSONObject associated with an index. Null is returned if
the key is not found, or null if the index has no value, or if the value
is not a JSONObject.
@param index
The index must be between 0 and length() - 1.
@return A JSONObject value. | [
"Get",
"the",
"optional",
"JSONObject",
"associated",
"with",
"an",
"index",
".",
"Null",
"is",
"returned",
"if",
"the",
"key",
"is",
"not",
"found",
"or",
"null",
"if",
"the",
"index",
"has",
"no",
"value",
"or",
"if",
"the",
"value",
"is",
"not",
"a"... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L755-L758 |
47,929 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optLong | public long optLong(int index, long defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.longValue();
} | java | public long optLong(int index, long defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.longValue();
} | [
"public",
"long",
"optLong",
"(",
"int",
"index",
",",
"long",
"defaultValue",
")",
"{",
"final",
"Number",
"val",
"=",
"this",
".",
"optNumber",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
... | Get the optional long value associated with an index. The defaultValue is
returned if there is no value for the index, or if the value is not a
number and cannot be converted to a number.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default value.
@return The value. | [
"Get",
"the",
"optional",
"long",
"value",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"there",
"is",
"no",
"value",
"for",
"the",
"index",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
"and",
"canno... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L784-L790 |
47,930 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optString | public String optString(int index, String defaultValue) {
Object object = this.opt(index);
return JSONObject.NULL.equals(object) ? defaultValue : object
.toString();
} | java | public String optString(int index, String defaultValue) {
Object object = this.opt(index);
return JSONObject.NULL.equals(object) ? defaultValue : object
.toString();
} | [
"public",
"String",
"optString",
"(",
"int",
"index",
",",
"String",
"defaultValue",
")",
"{",
"Object",
"object",
"=",
"this",
".",
"opt",
"(",
"index",
")",
";",
"return",
"JSONObject",
".",
"NULL",
".",
"equals",
"(",
"object",
")",
"?",
"defaultValue... | Get the optional string associated with an index. The defaultValue is
returned if the key is not found.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default value.
@return A String value. | [
"Get",
"the",
"optional",
"string",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"the",
"key",
"is",
"not",
"found",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L860-L864 |
47,931 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.put | public JSONArray put(int index, float value) throws JSONException {
return this.put(index, Float.valueOf(value));
} | java | public JSONArray put(int index, float value) throws JSONException {
return this.put(index, Float.valueOf(value));
} | [
"public",
"JSONArray",
"put",
"(",
"int",
"index",
",",
"float",
"value",
")",
"throws",
"JSONException",
"{",
"return",
"this",
".",
"put",
"(",
"index",
",",
"Float",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Put or replace a float value. If the index is greater than the length of
the JSONArray, then null elements will be added as necessary to pad it
out.
@param index
The subscript.
@param value
A float value.
@return this.
@throws JSONException
If the index is negative or if the value is non-finite. | [
"Put",
"or",
"replace",
"a",
"float",
"value",
".",
"If",
"the",
"index",
"is",
"greater",
"than",
"the",
"length",
"of",
"the",
"JSONArray",
"then",
"null",
"elements",
"will",
"be",
"added",
"as",
"necessary",
"to",
"pad",
"it",
"out",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L1035-L1037 |
47,932 | b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.write | public Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
int length = this.length();
writer.write('[');
if (length == 1) {
try {
JSONObject.writeValue(... | java | public Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
int length = this.length();
writer.write('[');
if (length == 1) {
try {
JSONObject.writeValue(... | [
"public",
"Writer",
"write",
"(",
"Writer",
"writer",
",",
"int",
"indentFactor",
",",
"int",
"indent",
")",
"throws",
"JSONException",
"{",
"try",
"{",
"boolean",
"commanate",
"=",
"false",
";",
"int",
"length",
"=",
"this",
".",
"length",
"(",
")",
";"... | Write the contents of the JSONArray as JSON text to a writer.
<p>If <code>indentFactor > 0</code> and the {@link JSONArray} has only
one element, then the array will be output on a single line:
<pre>{@code [1]}</pre>
<p>If an array has 2 or more elements, then it will be output across
multiple lines: <pre>{@code
[
1,... | [
"Write",
"the",
"contents",
"of",
"the",
"JSONArray",
"as",
"JSON",
"text",
"to",
"a",
"writer",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L1379-L1422 |
47,933 | b3log/latke | latke-core/src/main/java/org/b3log/latke/cache/redis/RedisCache.java | RedisCache.shutdown | public static void shutdown() {
try {
Connections.shutdown();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Shutdown redis connection pool failed", e);
}
} | java | public static void shutdown() {
try {
Connections.shutdown();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Shutdown redis connection pool failed", e);
}
} | [
"public",
"static",
"void",
"shutdown",
"(",
")",
"{",
"try",
"{",
"Connections",
".",
"shutdown",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"ERROR",
",",
"\"Shutdown redis connection ... | Shutdowns redis cache. | [
"Shutdowns",
"redis",
"cache",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/cache/redis/RedisCache.java#L162-L168 |
47,934 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Reflections.java | Reflections.getStereotypes | public static Set<Class<? extends Annotation>> getStereotypes(final Class<?> clazz) {
final Set<Class<? extends Annotation>> ret = new HashSet<>();
final Set<Annotation> annotations = getAnnotations(clazz.getAnnotations(), Stereotype.class);
if (annotations.isEmpty()) {
return ret;
... | java | public static Set<Class<? extends Annotation>> getStereotypes(final Class<?> clazz) {
final Set<Class<? extends Annotation>> ret = new HashSet<>();
final Set<Annotation> annotations = getAnnotations(clazz.getAnnotations(), Stereotype.class);
if (annotations.isEmpty()) {
return ret;
... | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"getStereotypes",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"final",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"ret",
"=",
"n... | Gets stereo types of the specified class.
@param clazz the specified class
@return stereo types of the specified class | [
"Gets",
"stereo",
"types",
"of",
"the",
"specified",
"class",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Reflections.java#L68-L81 |
47,935 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Reflections.java | Reflections.getAnnotations | private static Set<Annotation> getAnnotations(final Annotation[] annotations, final Class<? extends Annotation> neededAnnotationType) {
final Set<Annotation> ret = new HashSet<>();
for (final Annotation annotation : annotations) {
annotation.annotationType().getAnnotations();
fi... | java | private static Set<Annotation> getAnnotations(final Annotation[] annotations, final Class<? extends Annotation> neededAnnotationType) {
final Set<Annotation> ret = new HashSet<>();
for (final Annotation annotation : annotations) {
annotation.annotationType().getAnnotations();
fi... | [
"private",
"static",
"Set",
"<",
"Annotation",
">",
"getAnnotations",
"(",
"final",
"Annotation",
"[",
"]",
"annotations",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"neededAnnotationType",
")",
"{",
"final",
"Set",
"<",
"Annotation",
">",
... | Gets annotations match the needed annotation type from the specified annotation.
@param annotations the specified annotations
@param neededAnnotationType the needed annotation type
@return annotation set, returns an empty set if not found | [
"Gets",
"annotations",
"match",
"the",
"needed",
"annotation",
"type",
"from",
"the",
"specified",
"annotation",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Reflections.java#L139-L153 |
47,936 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Reflections.java | Reflections.getMethodVariableNames | public static String[] getMethodVariableNames(final Class<?> clazz, final String targetMethodName, final Class<?>[] types) {
CtClass cc;
CtMethod cm = null;
try {
if (null == CLASS_POOL.find(clazz.getName())) {
CLASS_POOL.insertClassPath(new ClassClassPath(clazz));
... | java | public static String[] getMethodVariableNames(final Class<?> clazz, final String targetMethodName, final Class<?>[] types) {
CtClass cc;
CtMethod cm = null;
try {
if (null == CLASS_POOL.find(clazz.getName())) {
CLASS_POOL.insertClassPath(new ClassClassPath(clazz));
... | [
"public",
"static",
"String",
"[",
"]",
"getMethodVariableNames",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"targetMethodName",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"CtClass",
"cc",
";",
"CtMetho... | Get method variable names of the specified class, target method name and parameter types.
@param clazz the specific clazz
@param targetMethodName the specified target method name
@param types the specified parameter types
@return the String[] of names | [
"Get",
"method",
"variable",
"names",
"of",
"the",
"specified",
"class",
"target",
"method",
"name",
"and",
"parameter",
"types",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Reflections.java#L163-L221 |
47,937 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.accumulate | public JSONObject accumulate(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key,
value instanceof JSONArray ? new JSONArray().put(value)
: value);
... | java | public JSONObject accumulate(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key,
value instanceof JSONArray ? new JSONArray().put(value)
: value);
... | [
"public",
"JSONObject",
"accumulate",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"testValidity",
"(",
"value",
")",
";",
"Object",
"object",
"=",
"this",
".",
"opt",
"(",
"key",
")",
";",
"if",
"(",
"object",
"==",... | Accumulate values under a key. It is similar to the put method except
that if there is already an object stored under the key then a JSONArray
is stored under the key to hold all of the accumulated values. If there
is already a JSONArray, then the new value is appended to it. In
contrast, the put method replaces the pr... | [
"Accumulate",
"values",
"under",
"a",
"key",
".",
"It",
"is",
"similar",
"to",
"the",
"put",
"method",
"except",
"that",
"if",
"there",
"is",
"already",
"an",
"object",
"stored",
"under",
"the",
"key",
"then",
"a",
"JSONArray",
"is",
"stored",
"under",
"... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L484-L497 |
47,938 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.getBoolean | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | java | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"this",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"object",
".",
"equals",
"(",
"Boolean",
".",
"FALSE",
")",
"||",
"(",
"object",... | Get the boolean value associated with a key.
@param key
A key string.
@return The truth.
@throws JSONException
if the value is not a Boolean or the String "true" or
"false". | [
"Get",
"the",
"boolean",
"value",
"associated",
"with",
"a",
"key",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L608-L621 |
47,939 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.optJSONArray | public JSONArray optJSONArray(String key) {
Object o = this.opt(key);
return o instanceof JSONArray ? (JSONArray) o : null;
} | java | public JSONArray optJSONArray(String key) {
Object o = this.opt(key);
return o instanceof JSONArray ? (JSONArray) o : null;
} | [
"public",
"JSONArray",
"optJSONArray",
"(",
"String",
"key",
")",
"{",
"Object",
"o",
"=",
"this",
".",
"opt",
"(",
"key",
")",
";",
"return",
"o",
"instanceof",
"JSONArray",
"?",
"(",
"JSONArray",
")",
"o",
":",
"null",
";",
"}"
] | Get an optional JSONArray associated with a key. It returns null if there
is no such key, or if its value is not a JSONArray.
@param key
A key string.
@return A JSONArray which is the value. | [
"Get",
"an",
"optional",
"JSONArray",
"associated",
"with",
"a",
"key",
".",
"It",
"returns",
"null",
"if",
"there",
"is",
"no",
"such",
"key",
"or",
"if",
"its",
"value",
"is",
"not",
"a",
"JSONArray",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1321-L1324 |
47,940 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.populateMap | private void populateMap(Object bean) {
Class<?> klass = bean.getClass();
// If klass is a System class then set includeSuperClass to false.
boolean includeSuperClass = klass.getClassLoader() != null;
Method[] methods = includeSuperClass ? klass.getMethods() : klass.getDeclaredMethods... | java | private void populateMap(Object bean) {
Class<?> klass = bean.getClass();
// If klass is a System class then set includeSuperClass to false.
boolean includeSuperClass = klass.getClassLoader() != null;
Method[] methods = includeSuperClass ? klass.getMethods() : klass.getDeclaredMethods... | [
"private",
"void",
"populateMap",
"(",
"Object",
"bean",
")",
"{",
"Class",
"<",
"?",
">",
"klass",
"=",
"bean",
".",
"getClass",
"(",
")",
";",
"// If klass is a System class then set includeSuperClass to false.",
"boolean",
"includeSuperClass",
"=",
"klass",
".",
... | Populates the internal map of the JSONObject with the bean properties. The
bean can not be recursive.
@see JSONObject#JSONObject(Object)
@param bean
the bean | [
"Populates",
"the",
"internal",
"map",
"of",
"the",
"JSONObject",
"with",
"the",
"bean",
"properties",
".",
"The",
"bean",
"can",
"not",
"be",
"recursive",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1451-L1490 |
47,941 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.getAnnotation | private static <A extends Annotation> A getAnnotation(final Method m, final Class<A> annotationClass) {
// if we have invalid data the result is null
if (m == null || annotationClass == null) {
return null;
}
if (m.isAnnotationPresent(annotationClass)) {
return m... | java | private static <A extends Annotation> A getAnnotation(final Method m, final Class<A> annotationClass) {
// if we have invalid data the result is null
if (m == null || annotationClass == null) {
return null;
}
if (m.isAnnotationPresent(annotationClass)) {
return m... | [
"private",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"final",
"Method",
"m",
",",
"final",
"Class",
"<",
"A",
">",
"annotationClass",
")",
"{",
"// if we have invalid data the result is null",
"if",
"(",
"m",
"==",
"null",
"|... | Searches the class hierarchy to see if the method or it's super
implementations and interfaces has the annotation.
@param <A>
type of the annotation
@param m
method to check
@param annotationClass
annotation to look for
@return the {@link Annotation} if the annotation exists on the current method
or one of it's super... | [
"Searches",
"the",
"class",
"hierarchy",
"to",
"see",
"if",
"the",
"method",
"or",
"it",
"s",
"super",
"implementations",
"and",
"interfaces",
"has",
"the",
"annotation",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1547-L1584 |
47,942 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.getAnnotationDepth | private static int getAnnotationDepth(final Method m, final Class<? extends Annotation> annotationClass) {
// if we have invalid data the result is -1
if (m == null || annotationClass == null) {
return -1;
}
if (m.isAnnotationPresent(annotationClass)) {
return 1;... | java | private static int getAnnotationDepth(final Method m, final Class<? extends Annotation> annotationClass) {
// if we have invalid data the result is -1
if (m == null || annotationClass == null) {
return -1;
}
if (m.isAnnotationPresent(annotationClass)) {
return 1;... | [
"private",
"static",
"int",
"getAnnotationDepth",
"(",
"final",
"Method",
"m",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"// if we have invalid data the result is -1",
"if",
"(",
"m",
"==",
"null",
"||",
"annotatio... | Searches the class hierarchy to see if the method or it's super
implementations and interfaces has the annotation. Returns the depth of the
annotation in the hierarchy.
@param <A>
type of the annotation
@param m
method to check
@param annotationClass
annotation to look for
@return Depth of the annotation or -1 if the... | [
"Searches",
"the",
"class",
"hierarchy",
"to",
"see",
"if",
"the",
"method",
"or",
"it",
"s",
"super",
"implementations",
"and",
"interfaces",
"has",
"the",
"annotation",
".",
"Returns",
"the",
"depth",
"of",
"the",
"annotation",
"in",
"the",
"hierarchy",
".... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1600-L1646 |
47,943 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.isDecimalNotation | protected static boolean isDecimalNotation(final String val) {
return val.indexOf('.') > -1 || val.indexOf('e') > -1
|| val.indexOf('E') > -1 || "-0".equals(val);
} | java | protected static boolean isDecimalNotation(final String val) {
return val.indexOf('.') > -1 || val.indexOf('e') > -1
|| val.indexOf('E') > -1 || "-0".equals(val);
} | [
"protected",
"static",
"boolean",
"isDecimalNotation",
"(",
"final",
"String",
"val",
")",
"{",
"return",
"val",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
"||",
"val",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
"||",
"val",
".",
... | Tests if the value should be tried as a decimal. It makes no test if there are actual digits.
@param val value to test
@return true if the string is "-0" or if it contains '.', 'e', or 'E', false otherwise. | [
"Tests",
"if",
"the",
"value",
"should",
"be",
"tried",
"as",
"a",
"decimal",
".",
"It",
"makes",
"no",
"test",
"if",
"there",
"are",
"actual",
"digits",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L2059-L2062 |
47,944 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.stringToNumber | protected static Number stringToNumber(final String val) throws NumberFormatException {
char initial = val.charAt(0);
if ((initial >= '0' && initial <= '9') || initial == '-') {
// decimal representation
if (isDecimalNotation(val)) {
// quick dirty way to see if w... | java | protected static Number stringToNumber(final String val) throws NumberFormatException {
char initial = val.charAt(0);
if ((initial >= '0' && initial <= '9') || initial == '-') {
// decimal representation
if (isDecimalNotation(val)) {
// quick dirty way to see if w... | [
"protected",
"static",
"Number",
"stringToNumber",
"(",
"final",
"String",
"val",
")",
"throws",
"NumberFormatException",
"{",
"char",
"initial",
"=",
"val",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"(",
"initial",
">=",
"'",
"'",
"&&",
"initial",
"... | Converts a string to a number using the narrowest possible type. Possible
returns for this function are BigDecimal, Double, BigInteger, Long, and Integer.
When a Double is returned, it should always be a valid Double and not NaN or +-infinity.
@param val value to convert
@return Number representation of the value.
@th... | [
"Converts",
"a",
"string",
"to",
"a",
"number",
"using",
"the",
"narrowest",
"possible",
"type",
".",
"Possible",
"returns",
"for",
"this",
"function",
"are",
"BigDecimal",
"Double",
"BigInteger",
"Long",
"and",
"Integer",
".",
"When",
"a",
"Double",
"is",
"... | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L2074-L2126 |
47,945 | b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.write | public Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
final int length = this.length();
writer.write('{');
if (length == 1) {
final Entry<String,?> entry = this.entrySet()... | java | public Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
final int length = this.length();
writer.write('{');
if (length == 1) {
final Entry<String,?> entry = this.entrySet()... | [
"public",
"Writer",
"write",
"(",
"Writer",
"writer",
",",
"int",
"indentFactor",
",",
"int",
"indent",
")",
"throws",
"JSONException",
"{",
"try",
"{",
"boolean",
"commanate",
"=",
"false",
";",
"final",
"int",
"length",
"=",
"this",
".",
"length",
"(",
... | Write the contents of the JSONObject as JSON text to a writer.
<p>If <code>indentFactor > 0</code> and the {@link JSONObject}
has only one key, then the object will be output on a single line:
<pre>{@code {"key": 1}}</pre>
<p>If an object has 2 or more keys, then it will be output across
multiple lines: <code><pre>{
... | [
"Write",
"the",
"contents",
"of",
"the",
"JSONObject",
"as",
"JSON",
"text",
"to",
"a",
"writer",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L2463-L2516 |
47,946 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Templates.java | Templates.hasExpression | public static boolean hasExpression(final Template template, final String expression) {
final TemplateElement rootTreeNode = template.getRootTreeNode();
return hasExpression(template, expression, rootTreeNode);
} | java | public static boolean hasExpression(final Template template, final String expression) {
final TemplateElement rootTreeNode = template.getRootTreeNode();
return hasExpression(template, expression, rootTreeNode);
} | [
"public",
"static",
"boolean",
"hasExpression",
"(",
"final",
"Template",
"template",
",",
"final",
"String",
"expression",
")",
"{",
"final",
"TemplateElement",
"rootTreeNode",
"=",
"template",
".",
"getRootTreeNode",
"(",
")",
";",
"return",
"hasExpression",
"("... | Determines whether exists a variable specified by the given expression
in the specified template.
@param template the specified template
@param expression the given expression, for example,
"${aVariable}", "<#list recentComments as comment>"
@return {@code true} if it exists, returns {@code false} otherwise | [
"Determines",
"whether",
"exists",
"a",
"variable",
"specified",
"by",
"the",
"given",
"expression",
"in",
"the",
"specified",
"template",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Templates.java#L53-L57 |
47,947 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Execs.java | Execs.exec | public static String exec(final String cmd, final long timeout) {
final StringTokenizer st = new StringTokenizer(cmd);
final String[] cmds = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
cmds[i] = st.nextToken();
}
return exec(cmds, timeout... | java | public static String exec(final String cmd, final long timeout) {
final StringTokenizer st = new StringTokenizer(cmd);
final String[] cmds = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
cmds[i] = st.nextToken();
}
return exec(cmds, timeout... | [
"public",
"static",
"String",
"exec",
"(",
"final",
"String",
"cmd",
",",
"final",
"long",
"timeout",
")",
"{",
"final",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"cmd",
")",
";",
"final",
"String",
"[",
"]",
"cmds",
"=",
"new",
"Strin... | Executes the specified command with the specified timeout.
@param cmd the specified command
@param timeout the specified timeout
@return execution output, returns {@code null} if execution failed | [
"Executes",
"the",
"specified",
"command",
"with",
"the",
"specified",
"timeout",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Execs.java#L48-L56 |
47,948 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Execs.java | Execs.exec | public static String exec(final String[] cmds, final long timeout) {
try {
final Process process = new ProcessBuilder(cmds).redirectErrorStream(true).start();
final StringWriter writer = new StringWriter();
new Thread(() -> {
try {
IOUtils.... | java | public static String exec(final String[] cmds, final long timeout) {
try {
final Process process = new ProcessBuilder(cmds).redirectErrorStream(true).start();
final StringWriter writer = new StringWriter();
new Thread(() -> {
try {
IOUtils.... | [
"public",
"static",
"String",
"exec",
"(",
"final",
"String",
"[",
"]",
"cmds",
",",
"final",
"long",
"timeout",
")",
"{",
"try",
"{",
"final",
"Process",
"process",
"=",
"new",
"ProcessBuilder",
"(",
"cmds",
")",
".",
"redirectErrorStream",
"(",
"true",
... | Executes the specified commands with the specified timeout.
@param cmds the specified commands
@param timeout the specified timeout in milliseconds
@return execution output, returns {@code null} if execution failed | [
"Executes",
"the",
"specified",
"commands",
"with",
"the",
"specified",
"timeout",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Execs.java#L65-L88 |
47,949 | b3log/latke | latke-core/src/main/java/org/b3log/latke/cache/CacheFactory.java | CacheFactory.getCache | public static synchronized Cache getCache(final String cacheName) {
LOGGER.log(Level.INFO, "Constructing cache [name={0}]....", cacheName);
Cache ret = CACHES.get(cacheName);
try {
if (null == ret) {
Class<Cache> cacheClass;
switch (Latkes.getRuntime... | java | public static synchronized Cache getCache(final String cacheName) {
LOGGER.log(Level.INFO, "Constructing cache [name={0}]....", cacheName);
Cache ret = CACHES.get(cacheName);
try {
if (null == ret) {
Class<Cache> cacheClass;
switch (Latkes.getRuntime... | [
"public",
"static",
"synchronized",
"Cache",
"getCache",
"(",
"final",
"String",
"cacheName",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Constructing cache [name={0}]....\"",
",",
"cacheName",
")",
";",
"Cache",
"ret",
"=",
"CACHES",
".... | Gets a cache specified by the given cache name.
@param cacheName the given cache name
@return a cache specified by the given cache name | [
"Gets",
"a",
"cache",
"specified",
"by",
"the",
"given",
"cache",
"name",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/cache/CacheFactory.java#L56-L93 |
47,950 | b3log/latke | latke-core/src/main/java/org/b3log/latke/cache/CacheFactory.java | CacheFactory.clear | public static synchronized void clear() {
for (final Map.Entry<String, Cache> entry : CACHES.entrySet()) {
final Cache cache = entry.getValue();
cache.clear();
LOGGER.log(Level.TRACE, "Cleared cache [name={0}]", entry.getKey());
}
} | java | public static synchronized void clear() {
for (final Map.Entry<String, Cache> entry : CACHES.entrySet()) {
final Cache cache = entry.getValue();
cache.clear();
LOGGER.log(Level.TRACE, "Cleared cache [name={0}]", entry.getKey());
}
} | [
"public",
"static",
"synchronized",
"void",
"clear",
"(",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"Cache",
">",
"entry",
":",
"CACHES",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"Cache",
"cache",
"=",
"entry",
".",... | Clears all caches. | [
"Clears",
"all",
"caches",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/cache/CacheFactory.java#L98-L104 |
47,951 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.getDataModel | public Map<String, Object> getDataModel() {
final AbstractResponseRenderer renderer = getRenderer();
if (null == renderer) {
return null;
}
return renderer.getRenderDataModel();
} | java | public Map<String, Object> getDataModel() {
final AbstractResponseRenderer renderer = getRenderer();
if (null == renderer) {
return null;
}
return renderer.getRenderDataModel();
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getDataModel",
"(",
")",
"{",
"final",
"AbstractResponseRenderer",
"renderer",
"=",
"getRenderer",
"(",
")",
";",
"if",
"(",
"null",
"==",
"renderer",
")",
"{",
"return",
"null",
";",
"}",
"return",
"r... | Gets the data model of renderer bound with this context.
@return data model, returns {@code null} if not found | [
"Gets",
"the",
"data",
"model",
"of",
"renderer",
"bound",
"with",
"this",
"context",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L146-L153 |
47,952 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.sendRedirect | public void sendRedirect(final String location) {
try {
response.sendRedirect(location);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends redirect [" + location + "] failed: " + e.getMessage());
}
} | java | public void sendRedirect(final String location) {
try {
response.sendRedirect(location);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends redirect [" + location + "] failed: " + e.getMessage());
}
} | [
"public",
"void",
"sendRedirect",
"(",
"final",
"String",
"location",
")",
"{",
"try",
"{",
"response",
".",
"sendRedirect",
"(",
"location",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"ER... | Sends redirect to the specified location.
@param location the specified location | [
"Sends",
"redirect",
"to",
"the",
"specified",
"location",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L169-L175 |
47,953 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.param | public String param(final String name) {
try {
return request.getParameter(name);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Can't parse request parameter [uri=" + request.getRequestURI() + ", method=" + request.getMethod() + ", parameterName=" + name + "]: " + e.getM... | java | public String param(final String name) {
try {
return request.getParameter(name);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Can't parse request parameter [uri=" + request.getRequestURI() + ", method=" + request.getMethod() + ", parameterName=" + name + "]: " + e.getM... | [
"public",
"String",
"param",
"(",
"final",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"request",
".",
"getParameter",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"ERRO... | Gets a parameter specified by the given name from request body form or query string.
@param name the given name
@return parameter, returns {@code null} if not found | [
"Gets",
"a",
"parameter",
"specified",
"by",
"the",
"given",
"name",
"from",
"request",
"body",
"form",
"or",
"query",
"string",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L259-L267 |
47,954 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.sendError | public void sendError(final int sc) {
try {
response.sendError(sc);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends error status code [" + sc + "] failed: " + e.getMessage());
}
} | java | public void sendError(final int sc) {
try {
response.sendError(sc);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends error status code [" + sc + "] failed: " + e.getMessage());
}
} | [
"public",
"void",
"sendError",
"(",
"final",
"int",
"sc",
")",
"{",
"try",
"{",
"response",
".",
"sendError",
"(",
"sc",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"ERROR",
",",
"\"Sen... | Sends the specified error status code.
@param sc the specified error status code | [
"Sends",
"the",
"specified",
"error",
"status",
"code",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L312-L318 |
47,955 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.renderJSONPretty | public RequestContext renderJSONPretty(final JSONObject json) {
final JsonRenderer jsonRenderer = new JsonRenderer();
jsonRenderer.setJSONObject(json);
jsonRenderer.setPretty(true);
this.renderer = jsonRenderer;
return this;
} | java | public RequestContext renderJSONPretty(final JSONObject json) {
final JsonRenderer jsonRenderer = new JsonRenderer();
jsonRenderer.setJSONObject(json);
jsonRenderer.setPretty(true);
this.renderer = jsonRenderer;
return this;
} | [
"public",
"RequestContext",
"renderJSONPretty",
"(",
"final",
"JSONObject",
"json",
")",
"{",
"final",
"JsonRenderer",
"jsonRenderer",
"=",
"new",
"JsonRenderer",
"(",
")",
";",
"jsonRenderer",
".",
"setJSONObject",
"(",
"json",
")",
";",
"jsonRenderer",
".",
"s... | Pretty rends with the specified json object.
@param json the specified json object
@return this context | [
"Pretty",
"rends",
"with",
"the",
"specified",
"json",
"object",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L352-L360 |
47,956 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.renderJSON | public RequestContext renderJSON(final JSONObject json) {
final JsonRenderer jsonRenderer = new JsonRenderer();
jsonRenderer.setJSONObject(json);
this.renderer = jsonRenderer;
return this;
} | java | public RequestContext renderJSON(final JSONObject json) {
final JsonRenderer jsonRenderer = new JsonRenderer();
jsonRenderer.setJSONObject(json);
this.renderer = jsonRenderer;
return this;
} | [
"public",
"RequestContext",
"renderJSON",
"(",
"final",
"JSONObject",
"json",
")",
"{",
"final",
"JsonRenderer",
"jsonRenderer",
"=",
"new",
"JsonRenderer",
"(",
")",
";",
"jsonRenderer",
".",
"setJSONObject",
"(",
"json",
")",
";",
"this",
".",
"renderer",
"=... | Renders with the specified json object.
@param json the specified json object
@return this context | [
"Renders",
"with",
"the",
"specified",
"json",
"object",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L383-L390 |
47,957 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.renderPretty | public RequestContext renderPretty() {
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
r.setPretty(true);
}
return this;
} | java | public RequestContext renderPretty() {
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
r.setPretty(true);
}
return this;
} | [
"public",
"RequestContext",
"renderPretty",
"(",
")",
"{",
"if",
"(",
"renderer",
"instanceof",
"JsonRenderer",
")",
"{",
"final",
"JsonRenderer",
"r",
"=",
"(",
"JsonRenderer",
")",
"renderer",
";",
"r",
".",
"setPretty",
"(",
"true",
")",
";",
"}",
"retu... | Pretty renders.
@return this context | [
"Pretty",
"renders",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L512-L519 |
47,958 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.handle | public void handle() {
try {
for (handleIndex++; handleIndex < handlers.size(); handleIndex++) {
handlers.get(handleIndex).handle(this);
}
} catch (final Exception e) {
final String requestLog = Requests.getLog(request);
LOGGER.log(Level.ER... | java | public void handle() {
try {
for (handleIndex++; handleIndex < handlers.size(); handleIndex++) {
handlers.get(handleIndex).handle(this);
}
} catch (final Exception e) {
final String requestLog = Requests.getLog(request);
LOGGER.log(Level.ER... | [
"public",
"void",
"handle",
"(",
")",
"{",
"try",
"{",
"for",
"(",
"handleIndex",
"++",
";",
"handleIndex",
"<",
"handlers",
".",
"size",
"(",
")",
";",
"handleIndex",
"++",
")",
"{",
"handlers",
".",
"get",
"(",
"handleIndex",
")",
".",
"handle",
"(... | Handles this context with handlers. | [
"Handles",
"this",
"context",
"with",
"handlers",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L542-L553 |
47,959 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.parseRequestJSONObject | private static JSONObject parseRequestJSONObject(final HttpServletRequest request, final HttpServletResponse response) {
response.setContentType("application/json");
try {
BufferedReader reader;
try {
reader = request.getReader();
} catch (final Illeg... | java | private static JSONObject parseRequestJSONObject(final HttpServletRequest request, final HttpServletResponse response) {
response.setContentType("application/json");
try {
BufferedReader reader;
try {
reader = request.getReader();
} catch (final Illeg... | [
"private",
"static",
"JSONObject",
"parseRequestJSONObject",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"response",
".",
"setContentType",
"(",
"\"application/json\"",
")",
";",
"try",
"{",
"BufferedReader",... | Gets the request json object with the specified request.
@param request the specified request
@param response the specified response, sets its content type with "application/json"
@return a json object | [
"Gets",
"the",
"request",
"json",
"object",
"with",
"the",
"specified",
"request",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L578-L604 |
47,960 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Paginator.java | Paginator.getPage | public static int getPage(final HttpServletRequest request) {
int ret = 1;
final String p = request.getParameter("p");
if (Strings.isNumeric(p)) {
try {
ret = Integer.parseInt(p);
} catch (final Exception e) {
// ignored
}
... | java | public static int getPage(final HttpServletRequest request) {
int ret = 1;
final String p = request.getParameter("p");
if (Strings.isNumeric(p)) {
try {
ret = Integer.parseInt(p);
} catch (final Exception e) {
// ignored
}
... | [
"public",
"static",
"int",
"getPage",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"int",
"ret",
"=",
"1",
";",
"final",
"String",
"p",
"=",
"request",
".",
"getParameter",
"(",
"\"p\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNumeric",
"(",
... | Gets the current page number from the query string "p" of the specified request.
@param request the specified request
@return page number, returns {@code 1} as default | [
"Gets",
"the",
"current",
"page",
"number",
"from",
"the",
"query",
"string",
"p",
"of",
"the",
"specified",
"request",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Paginator.java#L42-L58 |
47,961 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Paginator.java | Paginator.paginate | public static List<Integer> paginate(final int currentPageNum,
final int pageSize,
final int pageCount,
final int windowSize) {
List<Integer> ret;
if (pageCount < windowSize) {
... | java | public static List<Integer> paginate(final int currentPageNum,
final int pageSize,
final int pageCount,
final int windowSize) {
List<Integer> ret;
if (pageCount < windowSize) {
... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"paginate",
"(",
"final",
"int",
"currentPageNum",
",",
"final",
"int",
"pageSize",
",",
"final",
"int",
"pageCount",
",",
"final",
"int",
"windowSize",
")",
"{",
"List",
"<",
"Integer",
">",
"ret",
";",
"... | Paginates with the specified current page number, page size, page count and window size.
@param currentPageNum the specified current page number
@param pageSize the specified page size
@param pageCount the specified page count
@param windowSize the specified window size
@return a list integer pagination... | [
"Paginates",
"with",
"the",
"specified",
"current",
"page",
"number",
"page",
"size",
"page",
"count",
"and",
"window",
"size",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Paginator.java#L69-L91 |
47,962 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.getPlugins | public List<AbstractPlugin> getPlugins() {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final List<AbstractPlugin> ret = new ArrayList<>();
for (final Map.Entry<String, HashSet<AbstractPlugin>> entry : pluginCache.entrySet())... | java | public List<AbstractPlugin> getPlugins() {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final List<AbstractPlugin> ret = new ArrayList<>();
for (final Map.Entry<String, HashSet<AbstractPlugin>> entry : pluginCache.entrySet())... | [
"public",
"List",
"<",
"AbstractPlugin",
">",
"getPlugins",
"(",
")",
"{",
"if",
"(",
"pluginCache",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Plugin cache miss, reload\"",
")",
";",
"load",
"(",
")",
";",
"}",
"final",
"List",
... | Gets all plugins.
@return all plugins, returns an empty list if not found | [
"Gets",
"all",
"plugins",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L86-L100 |
47,963 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.getPlugins | public Set<AbstractPlugin> getPlugins(final String viewName) {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final Set<AbstractPlugin> ret = pluginCache.get(viewName);
if (null == ret) {
return Collections.emptySet... | java | public Set<AbstractPlugin> getPlugins(final String viewName) {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final Set<AbstractPlugin> ret = pluginCache.get(viewName);
if (null == ret) {
return Collections.emptySet... | [
"public",
"Set",
"<",
"AbstractPlugin",
">",
"getPlugins",
"(",
"final",
"String",
"viewName",
")",
"{",
"if",
"(",
"pluginCache",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Plugin cache miss, reload\"",
")",
";",
"load",
"(",
")",
... | Gets a plugin by the specified view name.
@param viewName the specified view name
@return a plugin, returns an empty list if not found | [
"Gets",
"a",
"plugin",
"by",
"the",
"specified",
"view",
"name",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L108-L122 |
47,964 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.register | private void register(final AbstractPlugin plugin, final Map<String, HashSet<AbstractPlugin>> holder) {
final String rendererId = plugin.getRendererId();
/*
* the rendererId support multiple,using ';' to split.
* and using Map to match the plugin is not flexible, a regular expression ... | java | private void register(final AbstractPlugin plugin, final Map<String, HashSet<AbstractPlugin>> holder) {
final String rendererId = plugin.getRendererId();
/*
* the rendererId support multiple,using ';' to split.
* and using Map to match the plugin is not flexible, a regular expression ... | [
"private",
"void",
"register",
"(",
"final",
"AbstractPlugin",
"plugin",
",",
"final",
"Map",
"<",
"String",
",",
"HashSet",
"<",
"AbstractPlugin",
">",
">",
"holder",
")",
"{",
"final",
"String",
"rendererId",
"=",
"plugin",
".",
"getRendererId",
"(",
")",
... | Registers the specified plugin into the specified holder.
@param plugin the specified plugin
@param holder the specified holder | [
"Registers",
"the",
"specified",
"plugin",
"into",
"the",
"specified",
"holder",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L223-L240 |
47,965 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.setPluginProps | private static void setPluginProps(final String pluginDirName, final AbstractPlugin plugin, final Properties props) throws Exception {
final String author = props.getProperty(Plugin.PLUGIN_AUTHOR);
final String name = props.getProperty(Plugin.PLUGIN_NAME);
final String version = props.getPropert... | java | private static void setPluginProps(final String pluginDirName, final AbstractPlugin plugin, final Properties props) throws Exception {
final String author = props.getProperty(Plugin.PLUGIN_AUTHOR);
final String name = props.getProperty(Plugin.PLUGIN_NAME);
final String version = props.getPropert... | [
"private",
"static",
"void",
"setPluginProps",
"(",
"final",
"String",
"pluginDirName",
",",
"final",
"AbstractPlugin",
"plugin",
",",
"final",
"Properties",
"props",
")",
"throws",
"Exception",
"{",
"final",
"String",
"author",
"=",
"props",
".",
"getProperty",
... | Sets the specified plugin's properties from the specified properties file under the specified plugin directory.
@param pluginDirName the specified plugin directory
@param plugin the specified plugin
@param props the specified properties file
@throws Exception exception | [
"Sets",
"the",
"specified",
"plugin",
"s",
"properties",
"from",
"the",
"specified",
"properties",
"file",
"under",
"the",
"specified",
"plugin",
"directory",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L250-L282 |
47,966 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.registerEventListeners | private void registerEventListeners(final Properties props, final URLClassLoader classLoader, final AbstractPlugin plugin)
throws Exception {
final String eventListenerClasses = props.getProperty(Plugin.PLUGIN_EVENT_LISTENER_CLASSES);
final String[] eventListenerClassArray = eventListenerCla... | java | private void registerEventListeners(final Properties props, final URLClassLoader classLoader, final AbstractPlugin plugin)
throws Exception {
final String eventListenerClasses = props.getProperty(Plugin.PLUGIN_EVENT_LISTENER_CLASSES);
final String[] eventListenerClassArray = eventListenerCla... | [
"private",
"void",
"registerEventListeners",
"(",
"final",
"Properties",
"props",
",",
"final",
"URLClassLoader",
"classLoader",
",",
"final",
"AbstractPlugin",
"plugin",
")",
"throws",
"Exception",
"{",
"final",
"String",
"eventListenerClasses",
"=",
"props",
".",
... | Registers event listeners with the specified plugin properties, class loader and plugin.
@param props the specified plugin properties
@param classLoader the specified class loader
@param plugin the specified plugin
@throws Exception exception | [
"Registers",
"event",
"listeners",
"with",
"the",
"specified",
"plugin",
"properties",
"class",
"loader",
"and",
"plugin",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L292-L313 |
47,967 | b3log/latke | latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java | LangPropsService.getAll | public Map<String, String> getAll(final Locale locale) {
Map<String, String> ret = LANGS.get(locale);
if (null == ret) {
ret = new HashMap<>();
final ResourceBundle defaultLangBundle = ResourceBundle.getBundle(Keys.LANGUAGE, Latkes.getLocale());
final Enumeration<Stri... | java | public Map<String, String> getAll(final Locale locale) {
Map<String, String> ret = LANGS.get(locale);
if (null == ret) {
ret = new HashMap<>();
final ResourceBundle defaultLangBundle = ResourceBundle.getBundle(Keys.LANGUAGE, Latkes.getLocale());
final Enumeration<Stri... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getAll",
"(",
"final",
"Locale",
"locale",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"ret",
"=",
"LANGS",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"null",
"==",
"ret",
")",
"{"... | Gets all language properties as a map by the specified locale.
@param locale the specified locale
@return a map of language configurations | [
"Gets",
"all",
"language",
"properties",
"as",
"a",
"map",
"by",
"the",
"specified",
"locale",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java#L54-L80 |
47,968 | b3log/latke | latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java | LangPropsService.get | public String get(final String key, final Locale locale) {
return get(Keys.LANGUAGE, key, locale);
} | java | public String get(final String key, final Locale locale) {
return get(Keys.LANGUAGE, key, locale);
} | [
"public",
"String",
"get",
"(",
"final",
"String",
"key",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"get",
"(",
"Keys",
".",
"LANGUAGE",
",",
"key",
",",
"locale",
")",
";",
"}"
] | Gets a value with the specified key and locale.
@param key the specified key
@param locale the specified locale
@return value | [
"Gets",
"a",
"value",
"with",
"the",
"specified",
"key",
"and",
"locale",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java#L100-L102 |
47,969 | b3log/latke | latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java | LangPropsService.replaceVars | private String replaceVars(final String langValue) {
String ret = StringUtils.replace(langValue, "${servePath}", Latkes.getServePath());
ret = StringUtils.replace(ret, "${staticServePath}", Latkes.getStaticServePath());
return ret;
} | java | private String replaceVars(final String langValue) {
String ret = StringUtils.replace(langValue, "${servePath}", Latkes.getServePath());
ret = StringUtils.replace(ret, "${staticServePath}", Latkes.getStaticServePath());
return ret;
} | [
"private",
"String",
"replaceVars",
"(",
"final",
"String",
"langValue",
")",
"{",
"String",
"ret",
"=",
"StringUtils",
".",
"replace",
"(",
"langValue",
",",
"\"${servePath}\"",
",",
"Latkes",
".",
"getServePath",
"(",
")",
")",
";",
"ret",
"=",
"StringUtil... | Replaces all variables of the specified language value.
<p>
Variables:
<ul>
<li>${servePath}</li>
<li>${staticServePath}</li>
</ul>
</p>
@param langValue the specified language value
@return replaced value | [
"Replaces",
"all",
"variables",
"of",
"the",
"specified",
"language",
"value",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/service/LangPropsService.java#L148-L153 |
47,970 | b3log/latke | latke-core/src/main/java/org/json/XML.java | XML.unescape | public static String unescape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
if (c == '&') {
final int semic = string.indexOf(';', i);
... | java | public static String unescape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
if (c == '&') {
final int semic = string.indexOf(';', i);
... | [
"public",
"static",
"String",
"unescape",
"(",
"String",
"string",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"string",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"string",
".",
"l... | Removes XML escapes from the string.
@param string
string to remove escapes from
@return string with converted entities | [
"Removes",
"XML",
"escapes",
"from",
"the",
"string",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/XML.java#L187-L209 |
47,971 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/XMLs.java | XMLs.format | public static String format(final String xml) {
try {
final DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
final Document doc = db.parse(new InputSource(new StringReader(xml)));
final Transformer transformer = TransformerFactory.newInstance().... | java | public static String format(final String xml) {
try {
final DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
final Document doc = db.parse(new InputSource(new StringReader(xml)));
final Transformer transformer = TransformerFactory.newInstance().... | [
"public",
"static",
"String",
"format",
"(",
"final",
"String",
"xml",
")",
"{",
"try",
"{",
"final",
"DocumentBuilder",
"db",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"newDocumentBuilder",
"(",
")",
";",
"final",
"Document",
"doc",
... | Returns pretty print of the specified xml string.
@param xml the specified xml string
@return the pretty print of the specified xml string | [
"Returns",
"pretty",
"print",
"of",
"the",
"specified",
"xml",
"string",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/XMLs.java#L53-L70 |
47,972 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.initTemplateEngineCfg | private void initTemplateEngineCfg() {
configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
final ServletContext servletContext = AbstractServletListener.getServletContext();
configuration.setServletContextForTemplateLoading(servletContext, "/plugins/" + dirNa... | java | private void initTemplateEngineCfg() {
configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
final ServletContext servletContext = AbstractServletListener.getServletContext();
configuration.setServletContextForTemplateLoading(servletContext, "/plugins/" + dirNa... | [
"private",
"void",
"initTemplateEngineCfg",
"(",
")",
"{",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"configuration",
".",
"setDefaultEncoding",
"(",
"\"UTF-8\"",
")",
";",
"final",
"ServletContext",
"servletContext",
"=",
"AbstractServletListener",... | Initializes template engine configuration. | [
"Initializes",
"template",
"engine",
"configuration",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L172-L179 |
47,973 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.getLang | public String getLang(final Locale locale, final String key) {
return langs.get(locale.toString()).getProperty(key);
} | java | public String getLang(final Locale locale, final String key) {
return langs.get(locale.toString()).getProperty(key);
} | [
"public",
"String",
"getLang",
"(",
"final",
"Locale",
"locale",
",",
"final",
"String",
"key",
")",
"{",
"return",
"langs",
".",
"get",
"(",
"locale",
".",
"toString",
"(",
")",
")",
".",
"getProperty",
"(",
"key",
")",
";",
"}"
] | Gets language label with the specified locale and key.
@param locale the specified locale
@param key the specified key
@return language label | [
"Gets",
"language",
"label",
"with",
"the",
"specified",
"locale",
"and",
"key",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L217-L219 |
47,974 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.plug | public void plug(final Map<String, Object> dataModel, final RequestContext context) {
String content = (String) dataModel.get(Plugin.PLUGINS);
if (null == content) {
dataModel.put(Plugin.PLUGINS, "");
}
handleLangs(dataModel);
fillDefault(dataModel);
postPl... | java | public void plug(final Map<String, Object> dataModel, final RequestContext context) {
String content = (String) dataModel.get(Plugin.PLUGINS);
if (null == content) {
dataModel.put(Plugin.PLUGINS, "");
}
handleLangs(dataModel);
fillDefault(dataModel);
postPl... | [
"public",
"void",
"plug",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
",",
"final",
"RequestContext",
"context",
")",
"{",
"String",
"content",
"=",
"(",
"String",
")",
"dataModel",
".",
"get",
"(",
"Plugin",
".",
"PLUGINS",
")",... | Plugs with the specified data model and the args from request.
@param dataModel dataModel
@param context context | [
"Plugs",
"with",
"the",
"specified",
"data",
"model",
"and",
"the",
"args",
"from",
"request",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L271-L294 |
47,975 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.handleLangs | private void handleLangs(final Map<String, Object> dataModel) {
final Locale locale = Latkes.getLocale();
final String language = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
final StringBuilder keyBuilder = new St... | java | private void handleLangs(final Map<String, Object> dataModel) {
final Locale locale = Latkes.getLocale();
final String language = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
final StringBuilder keyBuilder = new St... | [
"private",
"void",
"handleLangs",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
")",
"{",
"final",
"Locale",
"locale",
"=",
"Latkes",
".",
"getLocale",
"(",
")",
";",
"final",
"String",
"language",
"=",
"locale",
".",
"getLanguage",
... | Processes languages. Retrieves language labels with default locale, then sets them into the specified data model.
@param dataModel the specified data model | [
"Processes",
"languages",
".",
"Retrieves",
"language",
"labels",
"with",
"default",
"locale",
"then",
"sets",
"them",
"into",
"the",
"specified",
"data",
"model",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L301-L328 |
47,976 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.fillDefault | private void fillDefault(final Map<String, Object> dataModel) {
Keys.fillServer(dataModel);
Keys.fillRuntime(dataModel);
} | java | private void fillDefault(final Map<String, Object> dataModel) {
Keys.fillServer(dataModel);
Keys.fillRuntime(dataModel);
} | [
"private",
"void",
"fillDefault",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
")",
"{",
"Keys",
".",
"fillServer",
"(",
"dataModel",
")",
";",
"Keys",
".",
"fillRuntime",
"(",
"dataModel",
")",
";",
"}"
] | Fills default values into the specified data model.
<p>
The default data model variable values includes:
<ul>
<li>{@code Keys.SERVER.*}</li>
<li>{@code Keys.RUNTIME.*}</li>
</ul>
</p>
@param dataModel the specified data model
@see Keys#fillServer(java.util.Map) | [
"Fills",
"default",
"values",
"into",
"the",
"specified",
"data",
"model",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L344-L347 |
47,977 | b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.getViewContent | private String getViewContent(final Map<String, Object> dataModel) {
if (null == configuration) {
initTemplateEngineCfg();
}
try {
final Template template = configuration.getTemplate("plugin.ftl");
final StringWriter sw = new StringWriter();
temp... | java | private String getViewContent(final Map<String, Object> dataModel) {
if (null == configuration) {
initTemplateEngineCfg();
}
try {
final Template template = configuration.getTemplate("plugin.ftl");
final StringWriter sw = new StringWriter();
temp... | [
"private",
"String",
"getViewContent",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
")",
"{",
"if",
"(",
"null",
"==",
"configuration",
")",
"{",
"initTemplateEngineCfg",
"(",
")",
";",
"}",
"try",
"{",
"final",
"Template",
"templat... | Gets view content of a plugin. The content is processed with the
specified data model by template engine.
@param dataModel the specified data model
@return plugin view content | [
"Gets",
"view",
"content",
"of",
"a",
"plugin",
".",
"The",
"content",
"is",
"processed",
"with",
"the",
"specified",
"data",
"model",
"by",
"template",
"engine",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L356-L373 |
47,978 | b3log/latke | latke-core/src/main/java/org/b3log/latke/event/AbstractEventQueue.java | AbstractEventQueue.addListener | synchronized void addListener(final AbstractEventListener<?> listener) {
if (null == listener) {
throw new NullPointerException();
}
final String eventType = listener.getEventType();
if (null == eventType) {
throw new NullPointerException();
}
Li... | java | synchronized void addListener(final AbstractEventListener<?> listener) {
if (null == listener) {
throw new NullPointerException();
}
final String eventType = listener.getEventType();
if (null == eventType) {
throw new NullPointerException();
}
Li... | [
"synchronized",
"void",
"addListener",
"(",
"final",
"AbstractEventListener",
"<",
"?",
">",
"listener",
")",
"{",
"if",
"(",
"null",
"==",
"listener",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"final",
"String",
"eventType",
"=",... | Adds the specified listener to the set of listeners for this object,
provided that it is not the same as some listener already in the set.
@param listener the specified listener | [
"Adds",
"the",
"specified",
"listener",
"to",
"the",
"set",
"of",
"listeners",
"for",
"this",
"object",
"provided",
"that",
"it",
"is",
"not",
"the",
"same",
"as",
"some",
"listener",
"already",
"in",
"the",
"set",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/event/AbstractEventQueue.java#L48-L65 |
47,979 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/ArrayUtils.java | ArrayUtils.concatenate | public static <T> T[] concatenate(final T[] first, final T[]... rest) {
int totalLength = first.length;
for (final T[] array : rest) {
totalLength += array.length;
}
final T[] ret = Arrays.copyOf(first, totalLength);
int offset = first.length;
for (final T[... | java | public static <T> T[] concatenate(final T[] first, final T[]... rest) {
int totalLength = first.length;
for (final T[] array : rest) {
totalLength += array.length;
}
final T[] ret = Arrays.copyOf(first, totalLength);
int offset = first.length;
for (final T[... | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"concatenate",
"(",
"final",
"T",
"[",
"]",
"first",
",",
"final",
"T",
"[",
"]",
"...",
"rest",
")",
"{",
"int",
"totalLength",
"=",
"first",
".",
"length",
";",
"for",
"(",
"final",
"T",
"[",
... | Concatenates the specified arrays.
@param <T> the type of array element
@param first the specified first array
@param rest the specified rest arrays
@return concatenated array | [
"Concatenates",
"the",
"specified",
"arrays",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/ArrayUtils.java#L36-L52 |
47,980 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java | ClassPathResolver.getResourcesFromRoot | private static Set<URL> getResourcesFromRoot(final String rootPath) {
final Set<URL> rets = new LinkedHashSet<URL>();
String path = rootPath;
if (path.startsWith("/")) {
path = path.substring(1);
}
try {
final Enumeration<URL> resources = Thread.curren... | java | private static Set<URL> getResourcesFromRoot(final String rootPath) {
final Set<URL> rets = new LinkedHashSet<URL>();
String path = rootPath;
if (path.startsWith("/")) {
path = path.substring(1);
}
try {
final Enumeration<URL> resources = Thread.curren... | [
"private",
"static",
"Set",
"<",
"URL",
">",
"getResourcesFromRoot",
"(",
"final",
"String",
"rootPath",
")",
"{",
"final",
"Set",
"<",
"URL",
">",
"rets",
"=",
"new",
"LinkedHashSet",
"<",
"URL",
">",
"(",
")",
";",
"String",
"path",
"=",
"rootPath",
... | the URLS under Root path ,each of which we should scan from.
@param rootPath rootPath
@return the URLS under the Root path | [
"the",
"URLS",
"under",
"Root",
"path",
"each",
"of",
"which",
"we",
"should",
"scan",
"from",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java#L123-L146 |
47,981 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java | ClassPathResolver.isJarURL | private static boolean isJarURL(final URL rootDirResource) {
final String protocol = rootDirResource.getProtocol();
/**
* Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip",
* "wsjar" or "code-source".
* <p>
* "zip... | java | private static boolean isJarURL(final URL rootDirResource) {
final String protocol = rootDirResource.getProtocol();
/**
* Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip",
* "wsjar" or "code-source".
* <p>
* "zip... | [
"private",
"static",
"boolean",
"isJarURL",
"(",
"final",
"URL",
"rootDirResource",
")",
"{",
"final",
"String",
"protocol",
"=",
"rootDirResource",
".",
"getProtocol",
"(",
")",
";",
"/**\n * Determine whether the given URL points to a resource in a jar file, that is... | check if the URL of the Rousource is a JAR resource.
@param rootDirResource rootDirResource
@return isJAR | [
"check",
"if",
"the",
"URL",
"of",
"the",
"Rousource",
"is",
"a",
"JAR",
"resource",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java#L154-L170 |
47,982 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java | ClassPathResolver.doFindPathMatchingJarResources | private static Collection<? extends URL> doFindPathMatchingJarResources(final URL rootDirResource, final String subPattern) {
final Set<URL> result = new LinkedHashSet<URL>();
JarFile jarFile = null;
String jarFileUrl;
String rootEntryPath = null;
URLConnection con;
boo... | java | private static Collection<? extends URL> doFindPathMatchingJarResources(final URL rootDirResource, final String subPattern) {
final Set<URL> result = new LinkedHashSet<URL>();
JarFile jarFile = null;
String jarFileUrl;
String rootEntryPath = null;
URLConnection con;
boo... | [
"private",
"static",
"Collection",
"<",
"?",
"extends",
"URL",
">",
"doFindPathMatchingJarResources",
"(",
"final",
"URL",
"rootDirResource",
",",
"final",
"String",
"subPattern",
")",
"{",
"final",
"Set",
"<",
"URL",
">",
"result",
"=",
"new",
"LinkedHashSet",
... | scan the jar to get the URLS of the Classes.
@param rootDirResource which is "Jar"
@param subPattern subPattern
@return the URLs of all the matched classes | [
"scan",
"the",
"jar",
"to",
"get",
"the",
"URLS",
"of",
"the",
"Classes",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java#L179-L268 |
47,983 | b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java | ClassPathResolver.doFindPathMatchingFileResources | private static Collection<? extends URL> doFindPathMatchingFileResources(final URL rootDirResource, final String subPattern) {
File rootFile = null;
final Set<URL> rets = new LinkedHashSet<URL>();
try {
rootFile = new File(rootDirResource.toURI());
} catch (final URISyntaxE... | java | private static Collection<? extends URL> doFindPathMatchingFileResources(final URL rootDirResource, final String subPattern) {
File rootFile = null;
final Set<URL> rets = new LinkedHashSet<URL>();
try {
rootFile = new File(rootDirResource.toURI());
} catch (final URISyntaxE... | [
"private",
"static",
"Collection",
"<",
"?",
"extends",
"URL",
">",
"doFindPathMatchingFileResources",
"(",
"final",
"URL",
"rootDirResource",
",",
"final",
"String",
"subPattern",
")",
"{",
"File",
"rootFile",
"=",
"null",
";",
"final",
"Set",
"<",
"URL",
">"... | scan the system file to get the URLS of the Classes.
@param rootDirResource rootDirResource which is in File System
@param subPattern subPattern
@return the URLs of all the matched classes | [
"scan",
"the",
"system",
"file",
"to",
"get",
"the",
"URLS",
"of",
"the",
"Classes",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/ClassPathResolver.java#L298-L345 |
47,984 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.handle | public static RequestContext handle(final HttpServletRequest request, final HttpServletResponse response) {
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sets request context... | java | public static RequestContext handle(final HttpServletRequest request, final HttpServletResponse response) {
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sets request context... | [
"public",
"static",
"RequestContext",
"handle",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"try",
"{",
"request",
".",
"setCharacterEncoding",
"(",
"\"UTF-8\"",
")",
";",
"response",
".",
"setCharacterEn... | Handle flow.
@param request the specified request
@param response the specified response
@return context | [
"Handle",
"flow",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L79-L101 |
47,985 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.result | public static void result(final RequestContext context) {
final HttpServletResponse response = context.getResponse();
if (response.isCommitted()) { // Response sends redirect or error
return;
}
AbstractResponseRenderer renderer = context.getRenderer();
if (null == re... | java | public static void result(final RequestContext context) {
final HttpServletResponse response = context.getResponse();
if (response.isCommitted()) { // Response sends redirect or error
return;
}
AbstractResponseRenderer renderer = context.getRenderer();
if (null == re... | [
"public",
"static",
"void",
"result",
"(",
"final",
"RequestContext",
"context",
")",
"{",
"final",
"HttpServletResponse",
"response",
"=",
"context",
".",
"getResponse",
"(",
")",
";",
"if",
"(",
"response",
".",
"isCommitted",
"(",
")",
")",
"{",
"// Respo... | Do HTTP response.
@param context {@link RequestContext} | [
"Do",
"HTTP",
"response",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L108-L119 |
47,986 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.delete | public static Router delete(final String uriTemplate, final ContextHandler handler) {
return route().delete(uriTemplate, handler);
} | java | public static Router delete(final String uriTemplate, final ContextHandler handler) {
return route().delete(uriTemplate, handler);
} | [
"public",
"static",
"Router",
"delete",
"(",
"final",
"String",
"uriTemplate",
",",
"final",
"ContextHandler",
"handler",
")",
"{",
"return",
"route",
"(",
")",
".",
"delete",
"(",
"uriTemplate",
",",
"handler",
")",
";",
"}"
] | HTTP DELETE routing.
@param uriTemplate the specified request URI template
@param handler the specified handler
@return router | [
"HTTP",
"DELETE",
"routing",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L133-L135 |
47,987 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.put | public static Router put(final String uriTemplate, final ContextHandler handler) {
return route().put(uriTemplate, handler);
} | java | public static Router put(final String uriTemplate, final ContextHandler handler) {
return route().put(uriTemplate, handler);
} | [
"public",
"static",
"Router",
"put",
"(",
"final",
"String",
"uriTemplate",
",",
"final",
"ContextHandler",
"handler",
")",
"{",
"return",
"route",
"(",
")",
".",
"put",
"(",
"uriTemplate",
",",
"handler",
")",
";",
"}"
] | HTTP PUT routing.
@param uriTemplate the specified request URI template
@param handler the specified handler
@return router | [
"HTTP",
"PUT",
"routing",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L144-L146 |
47,988 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.get | public static Router get(final String uriTemplate, final ContextHandler handler) {
return route().get(uriTemplate, handler);
} | java | public static Router get(final String uriTemplate, final ContextHandler handler) {
return route().get(uriTemplate, handler);
} | [
"public",
"static",
"Router",
"get",
"(",
"final",
"String",
"uriTemplate",
",",
"final",
"ContextHandler",
"handler",
")",
"{",
"return",
"route",
"(",
")",
".",
"get",
"(",
"uriTemplate",
",",
"handler",
")",
";",
"}"
] | HTTP GET routing.
@param uriTemplate the specified request URI template
@param handler the specified handler
@return router | [
"HTTP",
"GET",
"routing",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L155-L157 |
47,989 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.post | public static Router post(final String uriTemplate, final ContextHandler handler) {
return route().post(uriTemplate, handler);
} | java | public static Router post(final String uriTemplate, final ContextHandler handler) {
return route().post(uriTemplate, handler);
} | [
"public",
"static",
"Router",
"post",
"(",
"final",
"String",
"uriTemplate",
",",
"final",
"ContextHandler",
"handler",
")",
"{",
"return",
"route",
"(",
")",
".",
"post",
"(",
"uriTemplate",
",",
"handler",
")",
";",
"}"
] | HTTP POST routing.
@param uriTemplate the specified request URI template
@param handler the specified handler
@return router | [
"HTTP",
"POST",
"routing",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L166-L168 |
47,990 | b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java | DispatcherServlet.mapping | public static void mapping() {
for (final Router router : routers) {
final ContextHandlerMeta contextHandlerMeta = router.toContextHandlerMeta();
RouteHandler.addContextHandlerMeta(contextHandlerMeta);
}
} | java | public static void mapping() {
for (final Router router : routers) {
final ContextHandlerMeta contextHandlerMeta = router.toContextHandlerMeta();
RouteHandler.addContextHandlerMeta(contextHandlerMeta);
}
} | [
"public",
"static",
"void",
"mapping",
"(",
")",
"{",
"for",
"(",
"final",
"Router",
"router",
":",
"routers",
")",
"{",
"final",
"ContextHandlerMeta",
"contextHandlerMeta",
"=",
"router",
".",
"toContextHandlerMeta",
"(",
")",
";",
"RouteHandler",
".",
"addCo... | Performs mapping for all routers. | [
"Performs",
"mapping",
"for",
"all",
"routers",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/DispatcherServlet.java#L185-L190 |
47,991 | b3log/latke | latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcTransaction.java | JdbcTransaction.dispose | public void dispose() {
try {
connection.close();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
} finally {
isActive = false;
connection = null;
JdbcRepository.TX.set(null);
... | java | public void dispose() {
try {
connection.close();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
} finally {
isActive = false;
connection = null;
JdbcRepository.TX.set(null);
... | [
"public",
"void",
"dispose",
"(",
")",
"{",
"try",
"{",
"connection",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"ERROR",
",",
"\"Disposes transaction [\"",
"+",
"getId"... | Disposes this transaction. | [
"Disposes",
"this",
"transaction",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcTransaction.java#L118-L128 |
47,992 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Callstacks.java | Callstacks.isCaller | public static boolean isCaller(final String className, final String methodName) {
final Throwable throwable = new Throwable();
final StackTraceElement[] stackElements = throwable.getStackTrace();
if (null == stackElements) {
LOGGER.log(Level.WARN, "Empty call stack");
r... | java | public static boolean isCaller(final String className, final String methodName) {
final Throwable throwable = new Throwable();
final StackTraceElement[] stackElements = throwable.getStackTrace();
if (null == stackElements) {
LOGGER.log(Level.WARN, "Empty call stack");
r... | [
"public",
"static",
"boolean",
"isCaller",
"(",
"final",
"String",
"className",
",",
"final",
"String",
"methodName",
")",
"{",
"final",
"Throwable",
"throwable",
"=",
"new",
"Throwable",
"(",
")",
";",
"final",
"StackTraceElement",
"[",
"]",
"stackElements",
... | Checks the current method is whether invoked by a caller specified by the given class name and method name.
@param className the given class name
@param methodName the given method name, "*" for matching all methods
@return {@code true} if it is invoked by the specified caller, returns {@code false} otherwise | [
"Checks",
"the",
"current",
"method",
"is",
"whether",
"invoked",
"by",
"a",
"caller",
"specified",
"by",
"the",
"given",
"class",
"name",
"and",
"method",
"name",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Callstacks.java#L42-L61 |
47,993 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Callstacks.java | Callstacks.printCallstack | public static void printCallstack(final Level logLevel, final String[] carePackages, final String[] exceptablePackages) {
if (null == logLevel) {
LOGGER.log(Level.WARN, "Requires parameter [logLevel]");
return;
}
final Throwable throwable = new Throwable();
fina... | java | public static void printCallstack(final Level logLevel, final String[] carePackages, final String[] exceptablePackages) {
if (null == logLevel) {
LOGGER.log(Level.WARN, "Requires parameter [logLevel]");
return;
}
final Throwable throwable = new Throwable();
fina... | [
"public",
"static",
"void",
"printCallstack",
"(",
"final",
"Level",
"logLevel",
",",
"final",
"String",
"[",
"]",
"carePackages",
",",
"final",
"String",
"[",
"]",
"exceptablePackages",
")",
"{",
"if",
"(",
"null",
"==",
"logLevel",
")",
"{",
"LOGGER",
".... | Prints call stack with the specified logging level.
@param logLevel the specified logging level
@param carePackages the specified packages to print, for example, ["org.b3log.latke", "org.b3log.solo"], {@code null} to care
nothing
@param exceptablePackages the specified packages to skip, for example, ["... | [
"Prints",
"call",
"stack",
"with",
"the",
"specified",
"logging",
"level",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Callstacks.java#L72-L105 |
47,994 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java | Stopwatchs.start | public static void start(final String taskTitle) {
Stopwatch root = STOPWATCH.get();
if (null == root) {
root = new Stopwatch(taskTitle); // Creates the root stopwatch
STOPWATCH.set(root);
return;
}
final Stopwatch recent = getRecentRunning(STOPWATC... | java | public static void start(final String taskTitle) {
Stopwatch root = STOPWATCH.get();
if (null == root) {
root = new Stopwatch(taskTitle); // Creates the root stopwatch
STOPWATCH.set(root);
return;
}
final Stopwatch recent = getRecentRunning(STOPWATC... | [
"public",
"static",
"void",
"start",
"(",
"final",
"String",
"taskTitle",
")",
"{",
"Stopwatch",
"root",
"=",
"STOPWATCH",
".",
"get",
"(",
")",
";",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"root",
"=",
"new",
"Stopwatch",
"(",
"taskTitle",
")",
"... | Starts a task timing with the specified task title.
@param taskTitle the specified task title | [
"Starts",
"a",
"task",
"timing",
"with",
"the",
"specified",
"task",
"title",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java#L105-L122 |
47,995 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java | Stopwatchs.getTimingStat | public static String getTimingStat() {
final Stopwatch root = STOPWATCH.get();
if (null == root) {
return "No stopwatch";
}
final StringBuilder stringBuilder = new StringBuilder();
root.appendTimingStat(1, stringBuilder);
return stringBuilder.toString();
... | java | public static String getTimingStat() {
final Stopwatch root = STOPWATCH.get();
if (null == root) {
return "No stopwatch";
}
final StringBuilder stringBuilder = new StringBuilder();
root.appendTimingStat(1, stringBuilder);
return stringBuilder.toString();
... | [
"public",
"static",
"String",
"getTimingStat",
"(",
")",
"{",
"final",
"Stopwatch",
"root",
"=",
"STOPWATCH",
".",
"get",
"(",
")",
";",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"return",
"\"No stopwatch\"",
";",
"}",
"final",
"StringBuilder",
"stringBui... | Gets the current timing statistics.
<p>
If a task is not ended, the outputs will be minus for percentage and elapsed, the absolute value of the elapsed
filed is the start time.
</p>
@return the current timing statistics, returns {@code "No stopwatch"} if not stopwatch | [
"Gets",
"the",
"current",
"timing",
"statistics",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java#L164-L176 |
47,996 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java | Stopwatchs.getElapsed | public static long getElapsed(final String taskTitle) {
final long currentTimeMillis = System.currentTimeMillis();
if (StringUtils.isBlank(taskTitle)) {
return -1;
}
final Stopwatch root = STOPWATCH.get();
if (null == root) {
return -1;
}
... | java | public static long getElapsed(final String taskTitle) {
final long currentTimeMillis = System.currentTimeMillis();
if (StringUtils.isBlank(taskTitle)) {
return -1;
}
final Stopwatch root = STOPWATCH.get();
if (null == root) {
return -1;
}
... | [
"public",
"static",
"long",
"getElapsed",
"(",
"final",
"String",
"taskTitle",
")",
"{",
"final",
"long",
"currentTimeMillis",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"taskTitle",
")",
")",
"{",
... | Gets elapsed time from the specified parent stopwatch with the specified task title.
@param taskTitle the specified task title
@return <ul>
<li>{@linkplain org.b3log.latke.util.Stopwatchs.Stopwatch#getElapsedTime() elapsed time} of the found task if it
{@linkplain org.b3log.latke.util.Stopwatchs.Stopwatch#isEnded() is... | [
"Gets",
"elapsed",
"time",
"from",
"the",
"specified",
"parent",
"stopwatch",
"with",
"the",
"specified",
"task",
"title",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java#L191-L215 |
47,997 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java | Stopwatchs.get | private static Stopwatch get(final Stopwatch parent, final String taskTitle) {
if (taskTitle.equals(parent.getTaskTitle())) {
return parent;
}
for (final Stopwatch leaf : parent.getLeaves()) {
final Stopwatch ret = get(leaf, taskTitle);
if (null != ret) {
... | java | private static Stopwatch get(final Stopwatch parent, final String taskTitle) {
if (taskTitle.equals(parent.getTaskTitle())) {
return parent;
}
for (final Stopwatch leaf : parent.getLeaves()) {
final Stopwatch ret = get(leaf, taskTitle);
if (null != ret) {
... | [
"private",
"static",
"Stopwatch",
"get",
"(",
"final",
"Stopwatch",
"parent",
",",
"final",
"String",
"taskTitle",
")",
"{",
"if",
"(",
"taskTitle",
".",
"equals",
"(",
"parent",
".",
"getTaskTitle",
"(",
")",
")",
")",
"{",
"return",
"parent",
";",
"}",... | Gets stopwatch from the specified parent stopwatch with the specified task title.
@param parent the specified parent
@param taskTitle the specified task title
@return stopwatch, returns {@code null} if not found | [
"Gets",
"stopwatch",
"from",
"the",
"specified",
"parent",
"stopwatch",
"with",
"the",
"specified",
"task",
"title",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java#L224-L238 |
47,998 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java | Stopwatchs.getRecentRunning | private static Stopwatch getRecentRunning(final Stopwatch parent) {
if (null == parent) {
return null;
}
final List<Stopwatch> leaves = parent.getLeaves();
if (leaves.isEmpty()) {
if (parent.isRunning()) {
return parent;
} else {
... | java | private static Stopwatch getRecentRunning(final Stopwatch parent) {
if (null == parent) {
return null;
}
final List<Stopwatch> leaves = parent.getLeaves();
if (leaves.isEmpty()) {
if (parent.isRunning()) {
return parent;
} else {
... | [
"private",
"static",
"Stopwatch",
"getRecentRunning",
"(",
"final",
"Stopwatch",
"parent",
")",
"{",
"if",
"(",
"null",
"==",
"parent",
")",
"{",
"return",
"null",
";",
"}",
"final",
"List",
"<",
"Stopwatch",
">",
"leaves",
"=",
"parent",
".",
"getLeaves",... | Gets the recent running stopwatch with the specified parent stopwatch.
@param parent the specified parent stopwatch
@return the recent stopwatch, returns {@code null} if not found | [
"Gets",
"the",
"recent",
"running",
"stopwatch",
"with",
"the",
"specified",
"parent",
"stopwatch",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Stopwatchs.java#L246-L272 |
47,999 | b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Strings.java | Strings.isIPv4 | public static boolean isIPv4(final String ip) {
if (StringUtils.isBlank(ip)) {
return false;
}
final String regex = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
... | java | public static boolean isIPv4(final String ip) {
if (StringUtils.isBlank(ip)) {
return false;
}
final String regex = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
... | [
"public",
"static",
"boolean",
"isIPv4",
"(",
"final",
"String",
"ip",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"ip",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"String",
"regex",
"=",
"\"^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.(2... | Is IPv4.
@param ip ip
@return {@code true} if it is, returns {@code false} otherwise | [
"Is",
"IPv4",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L77-L87 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.