repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java | GlobalSyncRedis.setSyncCache | public static void setSyncCache(String name, Cache cache) {
if (null == name || "".equals(name.trim()) || null == cache) {
return;
}
GlobalSyncRedis.caches.put(name, cache);
} | java | public static void setSyncCache(String name, Cache cache) {
if (null == name || "".equals(name.trim()) || null == cache) {
return;
}
GlobalSyncRedis.caches.put(name, cache);
} | [
"public",
"static",
"void",
"setSyncCache",
"(",
"String",
"name",
",",
"Cache",
"cache",
")",
"{",
"if",
"(",
"null",
"==",
"name",
"||",
"\"\"",
".",
"equals",
"(",
"name",
".",
"trim",
"(",
")",
")",
"||",
"null",
"==",
"cache",
")",
"{",
"retur... | Set cache to the memory.
@param name
@param cache | [
"Set",
"cache",
"to",
"the",
"memory",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java#L68-L73 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java | GlobalSyncRedis.removeSyncCache | public static void removeSyncCache(String name) {
if (StrKit.isBlank(name)) {
return;
}
if (GlobalSyncRedis.caches.containsKey(name)) {
GlobalSyncRedis.caches.remove(name);
}
} | java | public static void removeSyncCache(String name) {
if (StrKit.isBlank(name)) {
return;
}
if (GlobalSyncRedis.caches.containsKey(name)) {
GlobalSyncRedis.caches.remove(name);
}
} | [
"public",
"static",
"void",
"removeSyncCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"StrKit",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"GlobalSyncRedis",
".",
"caches",
".",
"containsKey",
"(",
"name",
")",
")",... | remove cache from memory.
@param name | [
"remove",
"cache",
"from",
"memory",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java#L79-L86 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java | GlobalSyncRedis.getSyncCache | public static Cache getSyncCache(String name) {
if (StrKit.isBlank(name) || !GlobalSyncRedis.caches.containsKey(name)) {
return Redis.use();
}
return GlobalSyncRedis.caches.get(name);
} | java | public static Cache getSyncCache(String name) {
if (StrKit.isBlank(name) || !GlobalSyncRedis.caches.containsKey(name)) {
return Redis.use();
}
return GlobalSyncRedis.caches.get(name);
} | [
"public",
"static",
"Cache",
"getSyncCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"StrKit",
".",
"isBlank",
"(",
"name",
")",
"||",
"!",
"GlobalSyncRedis",
".",
"caches",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"Redis",
".",
"u... | Get cache from memory.
@param name
@return | [
"Get",
"cache",
"from",
"memory",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/GlobalSyncRedis.java#L93-L98 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.redisColumnKey | private String redisColumnKey(SqlpKit.FLAG flag) {
StringBuilder key = new StringBuilder(this._getUsefulClass().toGenericString());
String[] attrs = this._getAttrNames();
Object val;
for (String attr : attrs) {
val = this.get(attr);
if (null == val) {
continue;
}
key.append(val.toString());
}
key = new StringBuilder(HashKit.md5(key.toString()));
if (flag.equals(SqlpKit.FLAG.ONE)) {
return "data:"+key;
}
return "datas:"+key;
} | java | private String redisColumnKey(SqlpKit.FLAG flag) {
StringBuilder key = new StringBuilder(this._getUsefulClass().toGenericString());
String[] attrs = this._getAttrNames();
Object val;
for (String attr : attrs) {
val = this.get(attr);
if (null == val) {
continue;
}
key.append(val.toString());
}
key = new StringBuilder(HashKit.md5(key.toString()));
if (flag.equals(SqlpKit.FLAG.ONE)) {
return "data:"+key;
}
return "datas:"+key;
} | [
"private",
"String",
"redisColumnKey",
"(",
"SqlpKit",
".",
"FLAG",
"flag",
")",
"{",
"StringBuilder",
"key",
"=",
"new",
"StringBuilder",
"(",
"this",
".",
"_getUsefulClass",
"(",
")",
".",
"toGenericString",
"(",
")",
")",
";",
"String",
"[",
"]",
"attrs... | redis key for attrs' values
@param flag : ids or id store
@return data[s]:md5(concat(columns' value)) | [
"redis",
"key",
"for",
"attrs",
"values"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L90-L106 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.fetchDatasFromRedis | private List<M> fetchDatasFromRedis(String... columns) {
// redis key
String key = this.redisColumnKey(SqlpKit.FLAG.ALL);
// fetch from redis
List<M> fetchDatas = this.redis().get(key);
if (null == fetchDatas) {
// fetch ids from db.
fetchDatas = this.find(SqlpKit.select(this, this.primaryKeys()));
}
if (null == fetchDatas || fetchDatas.size() == 0) {
return fetchDatas;
}
//put ids to redis
this.redis().setex(key, GlobalSyncRedis.syncExpire(), fetchDatas);
for (M m : fetchDatas) {
// fetch data from redis
if (null == m) {
continue;
}
m = this.fetchOne(m, columns);
}
return fetchDatas;
} | java | private List<M> fetchDatasFromRedis(String... columns) {
// redis key
String key = this.redisColumnKey(SqlpKit.FLAG.ALL);
// fetch from redis
List<M> fetchDatas = this.redis().get(key);
if (null == fetchDatas) {
// fetch ids from db.
fetchDatas = this.find(SqlpKit.select(this, this.primaryKeys()));
}
if (null == fetchDatas || fetchDatas.size() == 0) {
return fetchDatas;
}
//put ids to redis
this.redis().setex(key, GlobalSyncRedis.syncExpire(), fetchDatas);
for (M m : fetchDatas) {
// fetch data from redis
if (null == m) {
continue;
}
m = this.fetchOne(m, columns);
}
return fetchDatas;
} | [
"private",
"List",
"<",
"M",
">",
"fetchDatasFromRedis",
"(",
"String",
"...",
"columns",
")",
"{",
"// redis key",
"String",
"key",
"=",
"this",
".",
"redisColumnKey",
"(",
"SqlpKit",
".",
"FLAG",
".",
"ALL",
")",
";",
"// fetch from redis",
"List",
"<",
... | Use the columns that must contains primary keys fetch Data from db, and use the fetched primary keys fetch from redis.
@param columns | [
"Use",
"the",
"columns",
"that",
"must",
"contains",
"primary",
"keys",
"fetch",
"Data",
"from",
"db",
"and",
"use",
"the",
"fetched",
"primary",
"keys",
"fetch",
"from",
"redis",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L144-L167 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.attrType | public Class<?> attrType(String attr) {
Table table = this.table();
if (null != table) {
return table.getColumnType(attr);
}
Method[] methods = this._getUsefulClass().getMethods();
String methodName;
for (Method method : methods) {
methodName = method.getName();
if (methodName.startsWith("set") && methodName.substring(3).toLowerCase().equals(attr)) {
return method.getParameterTypes()[0];
}
}
return null;
} | java | public Class<?> attrType(String attr) {
Table table = this.table();
if (null != table) {
return table.getColumnType(attr);
}
Method[] methods = this._getUsefulClass().getMethods();
String methodName;
for (Method method : methods) {
methodName = method.getName();
if (methodName.startsWith("set") && methodName.substring(3).toLowerCase().equals(attr)) {
return method.getParameterTypes()[0];
}
}
return null;
} | [
"public",
"Class",
"<",
"?",
">",
"attrType",
"(",
"String",
"attr",
")",
"{",
"Table",
"table",
"=",
"this",
".",
"table",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"table",
")",
"{",
"return",
"table",
".",
"getColumnType",
"(",
"attr",
")",
";",
... | Get attr type
@param attr
@return attr type class | [
"Get",
"attr",
"type"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L219-L234 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.attrNames | public List<String> attrNames() {
String[] names = this._getAttrNames();
if (null != names && names.length != 0) {
return Arrays.asList(names);
}
Method[] methods = this._getUsefulClass().getMethods();
String methodName;
List<String> attrs = new ArrayList<String>();
for (Method method : methods) {
methodName = method.getName();
if (methodName.startsWith("set") ) {
String attr = methodName.substring(3).toLowerCase();
if (StrKit.notBlank(attr)) {
attrs.add(attr);
}
}
}
return attrs;
} | java | public List<String> attrNames() {
String[] names = this._getAttrNames();
if (null != names && names.length != 0) {
return Arrays.asList(names);
}
Method[] methods = this._getUsefulClass().getMethods();
String methodName;
List<String> attrs = new ArrayList<String>();
for (Method method : methods) {
methodName = method.getName();
if (methodName.startsWith("set") ) {
String attr = methodName.substring(3).toLowerCase();
if (StrKit.notBlank(attr)) {
attrs.add(attr);
}
}
}
return attrs;
} | [
"public",
"List",
"<",
"String",
">",
"attrNames",
"(",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"this",
".",
"_getAttrNames",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"names",
"&&",
"names",
".",
"length",
"!=",
"0",
")",
"{",
"return",
"Arrays"... | Get attr names | [
"Get",
"attr",
"names"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L239-L257 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.attrsCp | public Map<Object, Object> attrsCp() {
Map<Object, Object> attrs = new HashMap<Object, Object>();
String[] attrNames = this._getAttrNames();
for (String attr : attrNames) {
attrs.put(attr, this.get(attr));
}
return attrs;
} | java | public Map<Object, Object> attrsCp() {
Map<Object, Object> attrs = new HashMap<Object, Object>();
String[] attrNames = this._getAttrNames();
for (String attr : attrNames) {
attrs.put(attr, this.get(attr));
}
return attrs;
} | [
"public",
"Map",
"<",
"Object",
",",
"Object",
">",
"attrsCp",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"attrs",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"String",
"[",
"]",
"attrNames",
"=",
"this",
... | Model attr copy version , the model just use default "DbKit.brokenConfig" | [
"Model",
"attr",
"copy",
"version",
"the",
"model",
"just",
"use",
"default",
"DbKit",
".",
"brokenConfig"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L269-L276 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.shotCacheName | public void shotCacheName(String cacheName) {
//reset cache
if (StrKit.notBlank(cacheName) && !cacheName.equals(this.cacheName)) {
GlobalSyncRedis.removeSyncCache(this.cacheName);
}
this.cacheName = cacheName;
//auto open sync to redis
this.syncToRedis = true;
//update model redis mapping
ModelRedisMapping.me().put(this.tableName(), this.cacheName);
} | java | public void shotCacheName(String cacheName) {
//reset cache
if (StrKit.notBlank(cacheName) && !cacheName.equals(this.cacheName)) {
GlobalSyncRedis.removeSyncCache(this.cacheName);
}
this.cacheName = cacheName;
//auto open sync to redis
this.syncToRedis = true;
//update model redis mapping
ModelRedisMapping.me().put(this.tableName(), this.cacheName);
} | [
"public",
"void",
"shotCacheName",
"(",
"String",
"cacheName",
")",
"{",
"//reset cache",
"if",
"(",
"StrKit",
".",
"notBlank",
"(",
"cacheName",
")",
"&&",
"!",
"cacheName",
".",
"equals",
"(",
"this",
".",
"cacheName",
")",
")",
"{",
"GlobalSyncRedis",
"... | shot cache's name.
if current cacheName != the old cacheName, will reset old cache, update cache use the current cacheName and open syncToRedis. | [
"shot",
"cache",
"s",
"name",
".",
"if",
"current",
"cacheName",
"!",
"=",
"the",
"old",
"cacheName",
"will",
"reset",
"old",
"cache",
"update",
"cache",
"use",
"the",
"current",
"cacheName",
"and",
"open",
"syncToRedis",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L297-L307 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.save | @Override
public boolean save() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeSave(this);
}
boolean ret = super.save();
if (this.syncToRedis && ret) {
this.saveToRedis();
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterSave(this);
}
return ret;
} | java | @Override
public boolean save() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeSave(this);
}
boolean ret = super.save();
if (this.syncToRedis && ret) {
this.saveToRedis();
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterSave(this);
}
return ret;
} | [
"@",
"Override",
"public",
"boolean",
"save",
"(",
")",
"{",
"for",
"(",
"CallbackListener",
"callbackListener",
":",
"this",
".",
"callbackListeners",
")",
"{",
"callbackListener",
".",
"beforeSave",
"(",
"this",
")",
";",
"}",
"boolean",
"ret",
"=",
"super... | save to db, if `syncToRedis` is true , this model will save to redis in the same time. | [
"save",
"to",
"db",
"if",
"syncToRedis",
"is",
"true",
"this",
"model",
"will",
"save",
"to",
"redis",
"in",
"the",
"same",
"time",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L353-L366 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.delete | @Override
public boolean delete() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeDelete(this);
}
boolean ret = super.delete();
if (this.syncToRedis && ret) {
//delete from Redis
this.redis().del(this.redisKey(this));
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterDelete(this);
}
return ret;
} | java | @Override
public boolean delete() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeDelete(this);
}
boolean ret = super.delete();
if (this.syncToRedis && ret) {
//delete from Redis
this.redis().del(this.redisKey(this));
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterDelete(this);
}
return ret;
} | [
"@",
"Override",
"public",
"boolean",
"delete",
"(",
")",
"{",
"for",
"(",
"CallbackListener",
"callbackListener",
":",
"this",
".",
"callbackListeners",
")",
"{",
"callbackListener",
".",
"beforeDelete",
"(",
"this",
")",
";",
"}",
"boolean",
"ret",
"=",
"s... | delete from db, if `syncToRedis` is true , this model will delete from redis in the same time. | [
"delete",
"from",
"db",
"if",
"syncToRedis",
"is",
"true",
"this",
"model",
"will",
"delete",
"from",
"redis",
"in",
"the",
"same",
"time",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L371-L385 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.update | @Override
public boolean update() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeUpdate(this);
}
boolean ret = super.update();
if (this.syncToRedis && ret) {
this.saveToRedis();
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterUpdate(this);
}
return ret;
} | java | @Override
public boolean update() {
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.beforeUpdate(this);
}
boolean ret = super.update();
if (this.syncToRedis && ret) {
this.saveToRedis();
}
for (CallbackListener callbackListener : this.callbackListeners) {
callbackListener.afterUpdate(this);
}
return ret;
} | [
"@",
"Override",
"public",
"boolean",
"update",
"(",
")",
"{",
"for",
"(",
"CallbackListener",
"callbackListener",
":",
"this",
".",
"callbackListeners",
")",
"{",
"callbackListener",
".",
"beforeUpdate",
"(",
"this",
")",
";",
"}",
"boolean",
"ret",
"=",
"s... | update db, if `syncToRedis` is true , this model will update redis in the same time. | [
"update",
"db",
"if",
"syncToRedis",
"is",
"true",
"this",
"model",
"will",
"update",
"redis",
"in",
"the",
"same",
"time",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L390-L403 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java | ModelExt.hcode | public int hcode() {
final int prime = 31;
int result = 1;
Table table = this.table();
Set<Entry<String, Object>> attrsEntrySet = this._getAttrsEntrySet();
for (Entry<String, Object> entry : attrsEntrySet) {
String key = entry.getKey();
Object value = entry.getValue();
Class<?> clazz = table.getColumnType(key);
if (clazz == Integer.class) {
result = prime * result + (Integer) value;
} else if (clazz == Short.class) {
result = prime * result + (Short) value;
} else if (clazz == Long.class) {
result = prime * result + (int) ((Long) value ^ ((Long) value >>> 32));
} else if (clazz == Float.class) {
result = prime * result + Float.floatToIntBits((Float) value);
} else if (clazz == Double.class) {
long temp = Double.doubleToLongBits((Double) value);
result = prime * result + (int) (temp ^ (temp >>> 32));
} else if (clazz == Boolean.class) {
result = prime * result + ((Boolean) value ? 1231 : 1237);
} else if (clazz == Model.class) {
result = this.hcode();
} else {
result = prime * result + ((value == null) ? 0 : value.hashCode());
}
}
return result;
} | java | public int hcode() {
final int prime = 31;
int result = 1;
Table table = this.table();
Set<Entry<String, Object>> attrsEntrySet = this._getAttrsEntrySet();
for (Entry<String, Object> entry : attrsEntrySet) {
String key = entry.getKey();
Object value = entry.getValue();
Class<?> clazz = table.getColumnType(key);
if (clazz == Integer.class) {
result = prime * result + (Integer) value;
} else if (clazz == Short.class) {
result = prime * result + (Short) value;
} else if (clazz == Long.class) {
result = prime * result + (int) ((Long) value ^ ((Long) value >>> 32));
} else if (clazz == Float.class) {
result = prime * result + Float.floatToIntBits((Float) value);
} else if (clazz == Double.class) {
long temp = Double.doubleToLongBits((Double) value);
result = prime * result + (int) (temp ^ (temp >>> 32));
} else if (clazz == Boolean.class) {
result = prime * result + ((Boolean) value ? 1231 : 1237);
} else if (clazz == Model.class) {
result = this.hcode();
} else {
result = prime * result + ((value == null) ? 0 : value.hashCode());
}
}
return result;
} | [
"public",
"int",
"hcode",
"(",
")",
"{",
"final",
"int",
"prime",
"=",
"31",
";",
"int",
"result",
"=",
"1",
";",
"Table",
"table",
"=",
"this",
".",
"table",
"(",
")",
";",
"Set",
"<",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"attrsEntry... | wrapper hash code | [
"wrapper",
"hash",
"code"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/plugin/activerecord/ModelExt.java#L560-L589 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverManagerAccessorSupport.java | DriverManagerAccessorSupport.define | public static Class<?> define(ClassLoader loader) {
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
String packageName = DriverManagerAccessor.class.getPackage().getName();
RuntimePermission permission = new RuntimePermission("defineClassInPackage." + packageName);
sm.checkPermission(permission);
}
byte[] b = loadBytes();
Object[] args = new Object[]{DriverManagerAccessor.class.getName().replace('/', '.'), b, new Integer(0), new Integer(b.length)};
Class<?> clazz = (Class<?>) defineClass.invoke(loader, args);
return clazz;
} catch (RuntimeException e) {
//we have to attempt to define the class first
//otherwise it may be returned by a different class loader
try {
return loader.loadClass(DriverManagerAccessor.class.getName());
} catch (ClassNotFoundException ex) {
//ignore
}
throw e;
} catch (Exception e) {
try {
return loader.loadClass(DriverManagerAccessor.class.getName());
} catch (ClassNotFoundException ex) {
//ignore
}
throw new RuntimeException(e);
}
} | java | public static Class<?> define(ClassLoader loader) {
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
String packageName = DriverManagerAccessor.class.getPackage().getName();
RuntimePermission permission = new RuntimePermission("defineClassInPackage." + packageName);
sm.checkPermission(permission);
}
byte[] b = loadBytes();
Object[] args = new Object[]{DriverManagerAccessor.class.getName().replace('/', '.'), b, new Integer(0), new Integer(b.length)};
Class<?> clazz = (Class<?>) defineClass.invoke(loader, args);
return clazz;
} catch (RuntimeException e) {
//we have to attempt to define the class first
//otherwise it may be returned by a different class loader
try {
return loader.loadClass(DriverManagerAccessor.class.getName());
} catch (ClassNotFoundException ex) {
//ignore
}
throw e;
} catch (Exception e) {
try {
return loader.loadClass(DriverManagerAccessor.class.getName());
} catch (ClassNotFoundException ex) {
//ignore
}
throw new RuntimeException(e);
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"define",
"(",
"ClassLoader",
"loader",
")",
"{",
"try",
"{",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"String",
"packageName",
... | Definines the class using the given ClassLoader and ProtectionDomain | [
"Definines",
"the",
"class",
"using",
"the",
"given",
"ClassLoader",
"and",
"ProtectionDomain"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverManagerAccessorSupport.java#L59-L90 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java | JstlBaseTLV.validate | public synchronized ValidationMessage[] validate(
int type, String prefix, String uri, PageData page) {
try {
this.tlvType = type;
this.uri = uri;
// initialize
messageVector = new Vector();
// save the prefix
this.prefix = prefix;
// parse parameters if necessary
try {
if (config == null) {
configure((String) getInitParameters().get(EXP_ATT_PARAM));
}
} catch (NoSuchElementException ex) {
// parsing error
return vmFromString(
Resources.getMessage("TLV_PARAMETER_ERROR",
EXP_ATT_PARAM));
}
// get a handler
DefaultHandler h = getHandler();
// parse the page
XMLReader xmlReader = XmlUtil.newXMLReader(null);
xmlReader.setContentHandler(h);
InputStream inputStream = page.getInputStream();
try {
xmlReader.parse(new InputSource(inputStream));
} finally {
try {
inputStream.close();
} catch (IOException e) {
// Suppressed.
}
}
if (messageVector.size() == 0) {
return null;
} else {
return vmFromVector(messageVector);
}
} catch (SAXException ex) {
return vmFromString(ex.toString());
} catch (IOException ex) {
return vmFromString(ex.toString());
} catch (ParserConfigurationException ex) {
return vmFromString(ex.toString());
}
} | java | public synchronized ValidationMessage[] validate(
int type, String prefix, String uri, PageData page) {
try {
this.tlvType = type;
this.uri = uri;
// initialize
messageVector = new Vector();
// save the prefix
this.prefix = prefix;
// parse parameters if necessary
try {
if (config == null) {
configure((String) getInitParameters().get(EXP_ATT_PARAM));
}
} catch (NoSuchElementException ex) {
// parsing error
return vmFromString(
Resources.getMessage("TLV_PARAMETER_ERROR",
EXP_ATT_PARAM));
}
// get a handler
DefaultHandler h = getHandler();
// parse the page
XMLReader xmlReader = XmlUtil.newXMLReader(null);
xmlReader.setContentHandler(h);
InputStream inputStream = page.getInputStream();
try {
xmlReader.parse(new InputSource(inputStream));
} finally {
try {
inputStream.close();
} catch (IOException e) {
// Suppressed.
}
}
if (messageVector.size() == 0) {
return null;
} else {
return vmFromVector(messageVector);
}
} catch (SAXException ex) {
return vmFromString(ex.toString());
} catch (IOException ex) {
return vmFromString(ex.toString());
} catch (ParserConfigurationException ex) {
return vmFromString(ex.toString());
}
} | [
"public",
"synchronized",
"ValidationMessage",
"[",
"]",
"validate",
"(",
"int",
"type",
",",
"String",
"prefix",
",",
"String",
"uri",
",",
"PageData",
"page",
")",
"{",
"try",
"{",
"this",
".",
"tlvType",
"=",
"type",
";",
"this",
".",
"uri",
"=",
"u... | do the validation. | [
"do",
"the",
"validation",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java#L127-L180 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java | JstlBaseTLV.isTag | protected boolean isTag(String tagUri,
String tagLn,
String matchUri,
String matchLn) {
if (tagUri == null
|| tagUri.length() == 0
|| tagLn == null
|| matchUri == null
|| matchLn == null) {
return false;
}
// match beginning of URI since some suffix *_rt tags can
// be nested in EL enabled tags as defined by the spec
if (tagUri.length() > matchUri.length()) {
return (tagUri.startsWith(matchUri) && tagLn.equals(matchLn));
} else {
return (matchUri.startsWith(tagUri) && tagLn.equals(matchLn));
}
} | java | protected boolean isTag(String tagUri,
String tagLn,
String matchUri,
String matchLn) {
if (tagUri == null
|| tagUri.length() == 0
|| tagLn == null
|| matchUri == null
|| matchLn == null) {
return false;
}
// match beginning of URI since some suffix *_rt tags can
// be nested in EL enabled tags as defined by the spec
if (tagUri.length() > matchUri.length()) {
return (tagUri.startsWith(matchUri) && tagLn.equals(matchLn));
} else {
return (matchUri.startsWith(tagUri) && tagLn.equals(matchLn));
}
} | [
"protected",
"boolean",
"isTag",
"(",
"String",
"tagUri",
",",
"String",
"tagLn",
",",
"String",
"matchUri",
",",
"String",
"matchLn",
")",
"{",
"if",
"(",
"tagUri",
"==",
"null",
"||",
"tagUri",
".",
"length",
"(",
")",
"==",
"0",
"||",
"tagLn",
"==",... | utility methods to help us match elements in our tagset | [
"utility",
"methods",
"to",
"help",
"us",
"match",
"elements",
"in",
"our",
"tagset"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java#L197-L215 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java | WhenTag.condition | protected boolean condition() throws JspTagException {
try {
Object r = ExpressionEvaluatorManager.evaluate(
"test", test, Boolean.class, this, pageContext);
if (r == null) {
throw new NullAttributeException("when", "test");
} else {
return (((Boolean) r).booleanValue());
}
} catch (JspException ex) {
throw new JspTagException(ex.toString(), ex);
}
} | java | protected boolean condition() throws JspTagException {
try {
Object r = ExpressionEvaluatorManager.evaluate(
"test", test, Boolean.class, this, pageContext);
if (r == null) {
throw new NullAttributeException("when", "test");
} else {
return (((Boolean) r).booleanValue());
}
} catch (JspException ex) {
throw new JspTagException(ex.toString(), ex);
}
} | [
"protected",
"boolean",
"condition",
"(",
")",
"throws",
"JspTagException",
"{",
"try",
"{",
"Object",
"r",
"=",
"ExpressionEvaluatorManager",
".",
"evaluate",
"(",
"\"test\"",
",",
"test",
",",
"Boolean",
".",
"class",
",",
"this",
",",
"pageContext",
")",
... | Supplied conditional logic | [
"Supplied",
"conditional",
"logic"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java#L57-L69 | train |
agentgt/jirm | jirm-orm/src/main/java/co/jirm/mapper/definition/DefaultNamingStrategy.java | DefaultNamingStrategy.logicalColumnName | public String logicalColumnName(String columnName, String propertyName) {
return ! isNullOrEmpty( columnName ) ? columnName : unqualify( propertyName );
} | java | public String logicalColumnName(String columnName, String propertyName) {
return ! isNullOrEmpty( columnName ) ? columnName : unqualify( propertyName );
} | [
"public",
"String",
"logicalColumnName",
"(",
"String",
"columnName",
",",
"String",
"propertyName",
")",
"{",
"return",
"!",
"isNullOrEmpty",
"(",
"columnName",
")",
"?",
"columnName",
":",
"unqualify",
"(",
"propertyName",
")",
";",
"}"
] | Return the column name or the unqualified property name | [
"Return",
"the",
"column",
"name",
"or",
"the",
"unqualified",
"property",
"name"
] | 95a2fcdef4121c439053524407af3d4ce8035722 | https://github.com/agentgt/jirm/blob/95a2fcdef4121c439053524407af3d4ce8035722/jirm-orm/src/main/java/co/jirm/mapper/definition/DefaultNamingStrategy.java#L105-L108 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java | DataSourceUtil.getDataSource | static DataSource getDataSource(Object rawDataSource, PageContext pc)
throws JspException {
DataSource dataSource = null;
if (rawDataSource == null) {
rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
}
if (rawDataSource == null) {
return null;
}
/*
* If the 'dataSource' attribute's value resolves to a String
* after rtexpr/EL evaluation, use the string as JNDI path to
* a DataSource
*/
if (rawDataSource instanceof String) {
try {
Context ctx = new InitialContext();
// relative to standard JNDI root for J2EE app
Context envCtx = (Context) ctx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup((String) rawDataSource);
} catch (NamingException ex) {
dataSource = getDataSource((String) rawDataSource);
}
} else if (rawDataSource instanceof DataSource) {
dataSource = (DataSource) rawDataSource;
} else {
throw new JspException(
Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
}
return dataSource;
} | java | static DataSource getDataSource(Object rawDataSource, PageContext pc)
throws JspException {
DataSource dataSource = null;
if (rawDataSource == null) {
rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
}
if (rawDataSource == null) {
return null;
}
/*
* If the 'dataSource' attribute's value resolves to a String
* after rtexpr/EL evaluation, use the string as JNDI path to
* a DataSource
*/
if (rawDataSource instanceof String) {
try {
Context ctx = new InitialContext();
// relative to standard JNDI root for J2EE app
Context envCtx = (Context) ctx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup((String) rawDataSource);
} catch (NamingException ex) {
dataSource = getDataSource((String) rawDataSource);
}
} else if (rawDataSource instanceof DataSource) {
dataSource = (DataSource) rawDataSource;
} else {
throw new JspException(
Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
}
return dataSource;
} | [
"static",
"DataSource",
"getDataSource",
"(",
"Object",
"rawDataSource",
",",
"PageContext",
"pc",
")",
"throws",
"JspException",
"{",
"DataSource",
"dataSource",
"=",
"null",
";",
"if",
"(",
"rawDataSource",
"==",
"null",
")",
"{",
"rawDataSource",
"=",
"Config... | If dataSource is a String first do JNDI lookup.
If lookup fails parse String like it was a set of JDBC parameters
Otherwise check to see if dataSource is a DataSource object and use as
is | [
"If",
"dataSource",
"is",
"a",
"String",
"first",
"do",
"JNDI",
"lookup",
".",
"If",
"lookup",
"fails",
"parse",
"String",
"like",
"it",
"was",
"a",
"set",
"of",
"JDBC",
"parameters",
"Otherwise",
"check",
"to",
"see",
"if",
"dataSource",
"is",
"a",
"Dat... | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java#L50-L84 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java | DataSourceUtil.getDataSource | private static DataSource getDataSource(String params)
throws JspException {
DataSourceWrapper dataSource = new DataSourceWrapper();
String[] paramString = new String[4];
int escCount = 0;
int aryCount = 0;
int begin = 0;
for (int index = 0; index < params.length(); index++) {
char nextChar = params.charAt(index);
if (TOKEN.indexOf(nextChar) != -1) {
if (escCount == 0) {
paramString[aryCount] = params.substring(begin, index).trim();
begin = index + 1;
if (++aryCount > 4) {
throw new JspTagException(
Resources.getMessage("JDBC_PARAM_COUNT"));
}
}
}
if (ESCAPE.indexOf(nextChar) != -1) {
escCount++;
} else {
escCount = 0;
}
}
paramString[aryCount] = params.substring(begin).trim();
// use the JDBC URL from the parameter string
dataSource.setJdbcURL(paramString[0]);
// try to load a driver if it's present
if (paramString[1] != null) {
try {
dataSource.setDriverClassName(paramString[1]);
} catch (Exception ex) {
throw new JspTagException(
Resources.getMessage("DRIVER_INVALID_CLASS",
ex.toString()), ex);
}
}
// set the username and password
dataSource.setUserName(paramString[2]);
dataSource.setPassword(paramString[3]);
return dataSource;
} | java | private static DataSource getDataSource(String params)
throws JspException {
DataSourceWrapper dataSource = new DataSourceWrapper();
String[] paramString = new String[4];
int escCount = 0;
int aryCount = 0;
int begin = 0;
for (int index = 0; index < params.length(); index++) {
char nextChar = params.charAt(index);
if (TOKEN.indexOf(nextChar) != -1) {
if (escCount == 0) {
paramString[aryCount] = params.substring(begin, index).trim();
begin = index + 1;
if (++aryCount > 4) {
throw new JspTagException(
Resources.getMessage("JDBC_PARAM_COUNT"));
}
}
}
if (ESCAPE.indexOf(nextChar) != -1) {
escCount++;
} else {
escCount = 0;
}
}
paramString[aryCount] = params.substring(begin).trim();
// use the JDBC URL from the parameter string
dataSource.setJdbcURL(paramString[0]);
// try to load a driver if it's present
if (paramString[1] != null) {
try {
dataSource.setDriverClassName(paramString[1]);
} catch (Exception ex) {
throw new JspTagException(
Resources.getMessage("DRIVER_INVALID_CLASS",
ex.toString()), ex);
}
}
// set the username and password
dataSource.setUserName(paramString[2]);
dataSource.setPassword(paramString[3]);
return dataSource;
} | [
"private",
"static",
"DataSource",
"getDataSource",
"(",
"String",
"params",
")",
"throws",
"JspException",
"{",
"DataSourceWrapper",
"dataSource",
"=",
"new",
"DataSourceWrapper",
"(",
")",
";",
"String",
"[",
"]",
"paramString",
"=",
"new",
"String",
"[",
"4",... | Parse JDBC parameters and setup dataSource appropriately | [
"Parse",
"JDBC",
"parameters",
"and",
"setup",
"dataSource",
"appropriately"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java#L89-L137 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java | SPathParser.main | public static void main(String args[]) throws ParseException
{
SPathParser parser = new SPathParser(System.in);
Path p = parser.expression();
java.util.List l = p.getSteps();
// output for simple testing
System.out.println();
if (p instanceof AbsolutePath)
System.out.println("Root: /");
for (int i = 0; i < l.size(); i++) {
Step s = (Step) l.get(i);
System.out.print("Step: " + s.getName());
if (s.isDepthUnlimited())
System.out.print("(*)");
System.out.println();
}
} | java | public static void main(String args[]) throws ParseException
{
SPathParser parser = new SPathParser(System.in);
Path p = parser.expression();
java.util.List l = p.getSteps();
// output for simple testing
System.out.println();
if (p instanceof AbsolutePath)
System.out.println("Root: /");
for (int i = 0; i < l.size(); i++) {
Step s = (Step) l.get(i);
System.out.print("Step: " + s.getName());
if (s.isDepthUnlimited())
System.out.print("(*)");
System.out.println();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"args",
"[",
"]",
")",
"throws",
"ParseException",
"{",
"SPathParser",
"parser",
"=",
"new",
"SPathParser",
"(",
"System",
".",
"in",
")",
";",
"Path",
"p",
"=",
"parser",
".",
"expression",
"(",
")",
... | Simple command-line parser interface, primarily for testing. | [
"Simple",
"command",
"-",
"line",
"parser",
"interface",
"primarily",
"for",
"testing",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java#L66-L83 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java | SPathParser.expression | final public Path expression() throws ParseException {
Path expr;
if (jj_2_1(2147483647)) {
expr = absolutePath();
jj_consume_token(0);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case QNAME:
case NSWILDCARD:
case SLASH:
case STAR:
expr = relativePath();
jj_consume_token(0);
break;
default:
jj_la1[0] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return expr;}
throw new Error("Missing return statement in function");
} | java | final public Path expression() throws ParseException {
Path expr;
if (jj_2_1(2147483647)) {
expr = absolutePath();
jj_consume_token(0);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case QNAME:
case NSWILDCARD:
case SLASH:
case STAR:
expr = relativePath();
jj_consume_token(0);
break;
default:
jj_la1[0] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return expr;}
throw new Error("Missing return statement in function");
} | [
"final",
"public",
"Path",
"expression",
"(",
")",
"throws",
"ParseException",
"{",
"Path",
"expr",
";",
"if",
"(",
"jj_2_1",
"(",
"2147483647",
")",
")",
"{",
"expr",
"=",
"absolutePath",
"(",
")",
";",
"jj_consume_token",
"(",
"0",
")",
";",
"}",
"el... | Actual SPath grammar | [
"Actual",
"SPath",
"grammar"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java#L92-L114 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java | SPathParser.relativePath | final public RelativePath relativePath() throws ParseException {
RelativePath relPath = null;
Step step;
step = step();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SLASH:
jj_consume_token(SLASH);
relPath = relativePath();
break;
default:
jj_la1[1] = jj_gen;
;
}
{if (true) return new RelativePath(step, relPath);}
throw new Error("Missing return statement in function");
} | java | final public RelativePath relativePath() throws ParseException {
RelativePath relPath = null;
Step step;
step = step();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SLASH:
jj_consume_token(SLASH);
relPath = relativePath();
break;
default:
jj_la1[1] = jj_gen;
;
}
{if (true) return new RelativePath(step, relPath);}
throw new Error("Missing return statement in function");
} | [
"final",
"public",
"RelativePath",
"relativePath",
"(",
")",
"throws",
"ParseException",
"{",
"RelativePath",
"relPath",
"=",
"null",
";",
"Step",
"step",
";",
"step",
"=",
"step",
"(",
")",
";",
"switch",
"(",
"(",
"jj_ntk",
"==",
"-",
"1",
")",
"?",
... | as an example, we use recursion here to handle a list | [
"as",
"an",
"example",
"we",
"use",
"recursion",
"here",
"to",
"handle",
"a",
"list"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java#L125-L140 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.newDocumentBuilder | public static DocumentBuilder newDocumentBuilder() {
try {
return PARSER_FACTORY.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw (Error) new AssertionError().initCause(e);
}
} | java | public static DocumentBuilder newDocumentBuilder() {
try {
return PARSER_FACTORY.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw (Error) new AssertionError().initCause(e);
}
} | [
"public",
"static",
"DocumentBuilder",
"newDocumentBuilder",
"(",
")",
"{",
"try",
"{",
"return",
"PARSER_FACTORY",
".",
"newDocumentBuilder",
"(",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"throw",
"(",
"Error",
")",
"new",
"... | Create a new DocumentBuilder configured for namespaces but not validating.
@return a new, configured DocumentBuilder | [
"Create",
"a",
"new",
"DocumentBuilder",
"configured",
"for",
"namespaces",
"but",
"not",
"validating",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L172-L178 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.newTransformer | public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException {
TRANSFORMER_FACTORY.setURIResolver(uriResolver);
Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source);
// Although newTansformer() is not allowed to return null, Xalan does.
// Trap that here by throwing the expected TransformerConfigurationException.
if (transformer == null) {
throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid.");
}
return transformer;
} | java | public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException {
TRANSFORMER_FACTORY.setURIResolver(uriResolver);
Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source);
// Although newTansformer() is not allowed to return null, Xalan does.
// Trap that here by throwing the expected TransformerConfigurationException.
if (transformer == null) {
throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid.");
}
return transformer;
} | [
"public",
"static",
"Transformer",
"newTransformer",
"(",
"Source",
"source",
",",
"JstlUriResolver",
"uriResolver",
")",
"throws",
"TransformerConfigurationException",
"{",
"TRANSFORMER_FACTORY",
".",
"setURIResolver",
"(",
"uriResolver",
")",
";",
"Transformer",
"transf... | Create a new Transformer from an XSLT.
@param source the source of the XSLT.
@param uriResolver
@return a new Transformer
@throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT | [
"Create",
"a",
"new",
"Transformer",
"from",
"an",
"XSLT",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L195-L204 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.newInputSource | public static InputSource newInputSource(Reader reader, String systemId) {
InputSource source = new InputSource(reader);
source.setSystemId(wrapSystemId(systemId));
return source;
} | java | public static InputSource newInputSource(Reader reader, String systemId) {
InputSource source = new InputSource(reader);
source.setSystemId(wrapSystemId(systemId));
return source;
} | [
"public",
"static",
"InputSource",
"newInputSource",
"(",
"Reader",
"reader",
",",
"String",
"systemId",
")",
"{",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"reader",
")",
";",
"source",
".",
"setSystemId",
"(",
"wrapSystemId",
"(",
"systemId",
... | Create an InputSource from a Reader.
The systemId will be wrapped for use with JSTL's EntityResolver and UriResolver.
@param reader the source of the XML
@param systemId the system id
@return a configured InputSource | [
"Create",
"an",
"InputSource",
"from",
"a",
"Reader",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L215-L219 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.newXMLReader | public static XMLReader newXMLReader(JstlEntityResolver entityResolver)
throws ParserConfigurationException, SAXException {
XMLReader xmlReader = SAXPARSER_FACTORY.newSAXParser().getXMLReader();
xmlReader.setEntityResolver(entityResolver);
return xmlReader;
} | java | public static XMLReader newXMLReader(JstlEntityResolver entityResolver)
throws ParserConfigurationException, SAXException {
XMLReader xmlReader = SAXPARSER_FACTORY.newSAXParser().getXMLReader();
xmlReader.setEntityResolver(entityResolver);
return xmlReader;
} | [
"public",
"static",
"XMLReader",
"newXMLReader",
"(",
"JstlEntityResolver",
"entityResolver",
")",
"throws",
"ParserConfigurationException",
",",
"SAXException",
"{",
"XMLReader",
"xmlReader",
"=",
"SAXPARSER_FACTORY",
".",
"newSAXParser",
"(",
")",
".",
"getXMLReader",
... | Create an XMLReader that resolves entities using JSTL semantics.
@param entityResolver for resolving using JSTL semantics
@return a new XMLReader
@throws ParserConfigurationException if there was a configuration problem creating the reader
@throws SAXException if there was a problem creating the reader | [
"Create",
"an",
"XMLReader",
"that",
"resolves",
"entities",
"using",
"JSTL",
"semantics",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L228-L233 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.newSAXSource | public static SAXSource newSAXSource(Reader reader, String systemId, JstlEntityResolver entityResolver)
throws ParserConfigurationException, SAXException {
SAXSource source = new SAXSource(newXMLReader(entityResolver), new InputSource(reader));
source.setSystemId(wrapSystemId(systemId));
return source;
} | java | public static SAXSource newSAXSource(Reader reader, String systemId, JstlEntityResolver entityResolver)
throws ParserConfigurationException, SAXException {
SAXSource source = new SAXSource(newXMLReader(entityResolver), new InputSource(reader));
source.setSystemId(wrapSystemId(systemId));
return source;
} | [
"public",
"static",
"SAXSource",
"newSAXSource",
"(",
"Reader",
"reader",
",",
"String",
"systemId",
",",
"JstlEntityResolver",
"entityResolver",
")",
"throws",
"ParserConfigurationException",
",",
"SAXException",
"{",
"SAXSource",
"source",
"=",
"new",
"SAXSource",
"... | Create a SAXSource from a Reader. Any entities will be resolved using JSTL semantics.
@param reader the source of the XML
@param systemId the system id
@param entityResolver for resolving using JSTL semamtics
@return a new SAXSource
@throws ParserConfigurationException if there was a configuration problem creating the source
@throws SAXException if there was a problem creating the source | [
"Create",
"a",
"SAXSource",
"from",
"a",
"Reader",
".",
"Any",
"entities",
"will",
"be",
"resolved",
"using",
"JSTL",
"semantics",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L245-L250 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/XmlUtil.java | XmlUtil.runWithOurClassLoader | private static <T, E extends Exception> T runWithOurClassLoader(final Callable<T> action, Class<E> allowed) throws E {
PrivilegedExceptionAction<T> actionWithClassloader = new PrivilegedExceptionAction<T>() {
public T run() throws Exception {
ClassLoader original = Thread.currentThread().getContextClassLoader();
ClassLoader ours = XmlUtil.class.getClassLoader();
// Don't override the TCCL if it is not needed.
if (original == ours) {
return action.call();
} else {
try {
Thread.currentThread().setContextClassLoader(ours);
return action.call();
} finally {
Thread.currentThread().setContextClassLoader(original);
}
}
}
};
try {
return AccessController.doPrivileged(actionWithClassloader);
} catch (PrivilegedActionException e) {
Throwable cause = e.getCause();
if (allowed.isInstance(cause)) {
throw allowed.cast(cause);
} else {
throw (Error) new AssertionError().initCause(cause);
}
}
} | java | private static <T, E extends Exception> T runWithOurClassLoader(final Callable<T> action, Class<E> allowed) throws E {
PrivilegedExceptionAction<T> actionWithClassloader = new PrivilegedExceptionAction<T>() {
public T run() throws Exception {
ClassLoader original = Thread.currentThread().getContextClassLoader();
ClassLoader ours = XmlUtil.class.getClassLoader();
// Don't override the TCCL if it is not needed.
if (original == ours) {
return action.call();
} else {
try {
Thread.currentThread().setContextClassLoader(ours);
return action.call();
} finally {
Thread.currentThread().setContextClassLoader(original);
}
}
}
};
try {
return AccessController.doPrivileged(actionWithClassloader);
} catch (PrivilegedActionException e) {
Throwable cause = e.getCause();
if (allowed.isInstance(cause)) {
throw allowed.cast(cause);
} else {
throw (Error) new AssertionError().initCause(cause);
}
}
} | [
"private",
"static",
"<",
"T",
",",
"E",
"extends",
"Exception",
">",
"T",
"runWithOurClassLoader",
"(",
"final",
"Callable",
"<",
"T",
">",
"action",
",",
"Class",
"<",
"E",
">",
"allowed",
")",
"throws",
"E",
"{",
"PrivilegedExceptionAction",
"<",
"T",
... | Performs an action using this Class's ClassLoader as the Thread context ClassLoader.
@param action the action to perform
@param allowed an Exception that might be thrown by the action
@param <T> the type of the result
@param <E> the type of the allowed Exception
@return the result of the action
@throws E if the action threw the allowed Exception | [
"Performs",
"an",
"action",
"using",
"this",
"Class",
"s",
"ClassLoader",
"as",
"the",
"Thread",
"context",
"ClassLoader",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L384-L412 | train |
agentgt/jirm | jirm-orm/src/main/java/co/jirm/orm/builder/select/SelectBuilderFactory.java | SelectBuilderFactory.count | public SelectRootClauseBuilder<? extends QueryForNumber> count() {
//TODO its hard to know whether or not to innerjoin to get an accurate count here.
StringBuilder sb = new StringBuilder();
sb.append("SELECT count(*)");
sb.append(" FROM ").append(definition.getSqlName());
//definition.innerJoin(sb);
SelectRootClauseBuilder<? extends QueryForNumber> r = SelectRootClauseBuilder.newInstance(new RootClauseHandoff<CountBuilder<T>>(sb.toString()) {
@Override
protected CountBuilder<T> createBuilder(String sql) {
return new CountBuilder<T>(SelectBuilderFactory.this, sql);
}
@Override
public CountBuilder<T> transform(SelectRootClauseBuilder<CountBuilder<T>> clause) {
clause.where().limit(1);
return super.transform(clause);
}
});
return r;
} | java | public SelectRootClauseBuilder<? extends QueryForNumber> count() {
//TODO its hard to know whether or not to innerjoin to get an accurate count here.
StringBuilder sb = new StringBuilder();
sb.append("SELECT count(*)");
sb.append(" FROM ").append(definition.getSqlName());
//definition.innerJoin(sb);
SelectRootClauseBuilder<? extends QueryForNumber> r = SelectRootClauseBuilder.newInstance(new RootClauseHandoff<CountBuilder<T>>(sb.toString()) {
@Override
protected CountBuilder<T> createBuilder(String sql) {
return new CountBuilder<T>(SelectBuilderFactory.this, sql);
}
@Override
public CountBuilder<T> transform(SelectRootClauseBuilder<CountBuilder<T>> clause) {
clause.where().limit(1);
return super.transform(clause);
}
});
return r;
} | [
"public",
"SelectRootClauseBuilder",
"<",
"?",
"extends",
"QueryForNumber",
">",
"count",
"(",
")",
"{",
"//TODO its hard to know whether or not to innerjoin to get an accurate count here.",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"ap... | FIXME This may not work. | [
"FIXME",
"This",
"may",
"not",
"work",
"."
] | 95a2fcdef4121c439053524407af3d4ce8035722 | https://github.com/agentgt/jirm/blob/95a2fcdef4121c439053524407af3d4ce8035722/jirm-orm/src/main/java/co/jirm/orm/builder/select/SelectBuilderFactory.java#L125-L145 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java | ForEachSupport.prepare | @Override
protected void prepare() throws JspTagException {
// produce the right sort of ForEachIterator
if (rawItems == null) {
// if no items were specified, iterate from begin to end
items = new ToEndIterator(end);
} else if (rawItems instanceof ValueExpression) {
deferredExpression = (ValueExpression) rawItems;
Object o = deferredExpression.getValue(pageContext.getELContext());
Iterator iterator = toIterator(o);
if (isIndexed(o)) {
items = new IndexedDeferredIterator(iterator, deferredExpression);
} else {
items = new IteratedDeferredIterator(iterator, new IteratedExpression(deferredExpression, getDelims()));
}
} else {
items = toIterator(rawItems);
}
} | java | @Override
protected void prepare() throws JspTagException {
// produce the right sort of ForEachIterator
if (rawItems == null) {
// if no items were specified, iterate from begin to end
items = new ToEndIterator(end);
} else if (rawItems instanceof ValueExpression) {
deferredExpression = (ValueExpression) rawItems;
Object o = deferredExpression.getValue(pageContext.getELContext());
Iterator iterator = toIterator(o);
if (isIndexed(o)) {
items = new IndexedDeferredIterator(iterator, deferredExpression);
} else {
items = new IteratedDeferredIterator(iterator, new IteratedExpression(deferredExpression, getDelims()));
}
} else {
items = toIterator(rawItems);
}
} | [
"@",
"Override",
"protected",
"void",
"prepare",
"(",
")",
"throws",
"JspTagException",
"{",
"// produce the right sort of ForEachIterator",
"if",
"(",
"rawItems",
"==",
"null",
")",
"{",
"// if no items were specified, iterate from begin to end",
"items",
"=",
"new",
"To... | our 'raw' items | [
"our",
"raw",
"items"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java#L56-L74 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java | SetSupport.exportToVariable | void exportToVariable(Object result) throws JspTagException {
/*
* Store the result, letting an IllegalArgumentException
* propagate back if the scope is invalid (e.g., if an attempt
* is made to store something in the session without any
* HttpSession existing).
*/
int scopeValue = Util.getScope(scope);
ELContext myELContext = pageContext.getELContext();
VariableMapper vm = myELContext.getVariableMapper();
if (result != null) {
// if the result is a ValueExpression we just export to the mapper
if (result instanceof ValueExpression) {
if (scopeValue != PageContext.PAGE_SCOPE) {
throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
}
vm.setVariable(var, (ValueExpression) result);
} else {
// make sure to remove it from the VariableMapper if we will be setting into page scope
if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
pageContext.setAttribute(var, result, scopeValue);
}
} else {
//make sure to remove it from the Var mapper
if (vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
if (scope != null) {
pageContext.removeAttribute(var, Util.getScope(scope));
} else {
pageContext.removeAttribute(var);
}
}
} | java | void exportToVariable(Object result) throws JspTagException {
/*
* Store the result, letting an IllegalArgumentException
* propagate back if the scope is invalid (e.g., if an attempt
* is made to store something in the session without any
* HttpSession existing).
*/
int scopeValue = Util.getScope(scope);
ELContext myELContext = pageContext.getELContext();
VariableMapper vm = myELContext.getVariableMapper();
if (result != null) {
// if the result is a ValueExpression we just export to the mapper
if (result instanceof ValueExpression) {
if (scopeValue != PageContext.PAGE_SCOPE) {
throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
}
vm.setVariable(var, (ValueExpression) result);
} else {
// make sure to remove it from the VariableMapper if we will be setting into page scope
if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
pageContext.setAttribute(var, result, scopeValue);
}
} else {
//make sure to remove it from the Var mapper
if (vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
if (scope != null) {
pageContext.removeAttribute(var, Util.getScope(scope));
} else {
pageContext.removeAttribute(var);
}
}
} | [
"void",
"exportToVariable",
"(",
"Object",
"result",
")",
"throws",
"JspTagException",
"{",
"/*\n * Store the result, letting an IllegalArgumentException\n * propagate back if the scope is invalid (e.g., if an attempt\n * is made to store something in the session without any\n... | Export the result into a scoped variable.
@param result the value to export
@throws JspTagException if there was a problem exporting the result | [
"Export",
"the",
"result",
"into",
"a",
"scoped",
"variable",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java#L156-L191 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java | SetSupport.exportToMapProperty | void exportToMapProperty(Object target, String property, Object result) {
@SuppressWarnings("unchecked")
Map<Object, Object> map = (Map<Object, Object>) target;
if (result == null) {
map.remove(property);
} else {
map.put(property, result);
}
} | java | void exportToMapProperty(Object target, String property, Object result) {
@SuppressWarnings("unchecked")
Map<Object, Object> map = (Map<Object, Object>) target;
if (result == null) {
map.remove(property);
} else {
map.put(property, result);
}
} | [
"void",
"exportToMapProperty",
"(",
"Object",
"target",
",",
"String",
"property",
",",
"Object",
"result",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
"=",
"(",
"Map",
"<",
"Object",
",",
... | Export the result into a Map.
@param target the Map to export into
@param property the key to export into
@param result the value to export | [
"Export",
"the",
"result",
"into",
"a",
"Map",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java#L200-L208 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java | SetSupport.exportToBeanProperty | void exportToBeanProperty(Object target, String property, Object result) throws JspTagException {
PropertyDescriptor[] descriptors;
try {
descriptors = Introspector.getBeanInfo(target.getClass()).getPropertyDescriptors();
} catch (IntrospectionException ex) {
throw new JspTagException(ex);
}
for (PropertyDescriptor pd : descriptors) {
if (pd.getName().equals(property)) {
Method m = pd.getWriteMethod();
if (m == null) {
throw new JspTagException(Resources.getMessage("SET_NO_SETTER_METHOD", property));
}
try {
m.invoke(target, convertToExpectedType(result, m));
} catch (ELException ex) {
throw new JspTagException(ex);
} catch (IllegalAccessException ex) {
throw new JspTagException(ex);
} catch (InvocationTargetException ex) {
throw new JspTagException(ex);
}
return;
}
}
throw new JspTagException(Resources.getMessage("SET_INVALID_PROPERTY", property));
} | java | void exportToBeanProperty(Object target, String property, Object result) throws JspTagException {
PropertyDescriptor[] descriptors;
try {
descriptors = Introspector.getBeanInfo(target.getClass()).getPropertyDescriptors();
} catch (IntrospectionException ex) {
throw new JspTagException(ex);
}
for (PropertyDescriptor pd : descriptors) {
if (pd.getName().equals(property)) {
Method m = pd.getWriteMethod();
if (m == null) {
throw new JspTagException(Resources.getMessage("SET_NO_SETTER_METHOD", property));
}
try {
m.invoke(target, convertToExpectedType(result, m));
} catch (ELException ex) {
throw new JspTagException(ex);
} catch (IllegalAccessException ex) {
throw new JspTagException(ex);
} catch (InvocationTargetException ex) {
throw new JspTagException(ex);
}
return;
}
}
throw new JspTagException(Resources.getMessage("SET_INVALID_PROPERTY", property));
} | [
"void",
"exportToBeanProperty",
"(",
"Object",
"target",
",",
"String",
"property",
",",
"Object",
"result",
")",
"throws",
"JspTagException",
"{",
"PropertyDescriptor",
"[",
"]",
"descriptors",
";",
"try",
"{",
"descriptors",
"=",
"Introspector",
".",
"getBeanInf... | Export the result into a bean property.
@param target the bean to export into
@param property the bean property to set
@param result the value to export
@throws JspTagException if there was a problem exporting the result | [
"Export",
"the",
"result",
"into",
"a",
"bean",
"property",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java#L218-L245 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java | SetSupport.convertToExpectedType | private Object convertToExpectedType(final Object value, Method m) throws ELException {
if (value == null) {
return null;
}
Class<?> expectedType = m.getParameterTypes()[0];
return getExpressionFactory().coerceToType(value, expectedType);
} | java | private Object convertToExpectedType(final Object value, Method m) throws ELException {
if (value == null) {
return null;
}
Class<?> expectedType = m.getParameterTypes()[0];
return getExpressionFactory().coerceToType(value, expectedType);
} | [
"private",
"Object",
"convertToExpectedType",
"(",
"final",
"Object",
"value",
",",
"Method",
"m",
")",
"throws",
"ELException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
">",
"expectedType",
"=",
"m"... | Convert an object to an expected type of the method parameter according to the conversion
rules of the Expression Language.
@param value the value to convert
@param m the setter method
@return value converted to an instance of the expected type; will be null if value was null
@throws javax.el.ELException if there was a problem coercing the value | [
"Convert",
"an",
"object",
"to",
"an",
"expected",
"type",
"of",
"the",
"method",
"parameter",
"according",
"to",
"the",
"conversion",
"rules",
"of",
"the",
"Expression",
"Language",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java#L256-L262 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/kit/Reflect.java | Reflect.types | private static Class<?>[] types(Object... values) {
if (values == null) {
return new Class[0];
}
Class<?>[] result = new Class[values.length];
for (int i = 0; i < values.length; i++) {
Object value = values[i];
result[i] = value == null ? Object.class : value.getClass();
}
return result;
} | java | private static Class<?>[] types(Object... values) {
if (values == null) {
return new Class[0];
}
Class<?>[] result = new Class[values.length];
for (int i = 0; i < values.length; i++) {
Object value = values[i];
result[i] = value == null ? Object.class : value.getClass();
}
return result;
} | [
"private",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
"(",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
"new",
"Class",
"[",
"0",
"]",
";",
"}",
"Class",
"<",
"?",
">",
"[",
"]",
"result"... | Get an array of types for an array of objects
@see Object#getClass() | [
"Get",
"an",
"array",
"of",
"types",
"for",
"an",
"array",
"of",
"objects"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/Reflect.java#L649-L662 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java | JstlCoreTLV.validate | @Override
public ValidationMessage[] validate(
String prefix, String uri, PageData page) {
return super.validate(TYPE_CORE, prefix, uri, page);
} | java | @Override
public ValidationMessage[] validate(
String prefix, String uri, PageData page) {
return super.validate(TYPE_CORE, prefix, uri, page);
} | [
"@",
"Override",
"public",
"ValidationMessage",
"[",
"]",
"validate",
"(",
"String",
"prefix",
",",
"String",
"uri",
",",
"PageData",
"page",
")",
"{",
"return",
"super",
".",
"validate",
"(",
"TYPE_CORE",
",",
"prefix",
",",
"uri",
",",
"page",
")",
";"... | set its type and delegate validation to super-class | [
"set",
"its",
"type",
"and",
"delegate",
"validation",
"to",
"super",
"-",
"class"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java#L94-L98 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/kit/FastJsonKit.java | FastJsonKit.jsonToMap | @SuppressWarnings("unchecked")
public static <K,V> Map<K,V> jsonToMap(String json){
return FastJsonKit.parse(json, HashMap.class);
} | java | @SuppressWarnings("unchecked")
public static <K,V> Map<K,V> jsonToMap(String json){
return FastJsonKit.parse(json, HashMap.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"jsonToMap",
"(",
"String",
"json",
")",
"{",
"return",
"FastJsonKit",
".",
"parse",
"(",
"json",
",",
"HashMap",
".",
"c... | json string to map
@param json
@return | [
"json",
"string",
"to",
"map"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/FastJsonKit.java#L67-L70 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/kit/FastJsonKit.java | FastJsonKit.jsonToRecord | public static Record jsonToRecord(String json){
Map<String,Object> map = jsonToMap(json);
return new Record().setColumns(map);
} | java | public static Record jsonToRecord(String json){
Map<String,Object> map = jsonToMap(json);
return new Record().setColumns(map);
} | [
"public",
"static",
"Record",
"jsonToRecord",
"(",
"String",
"json",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"jsonToMap",
"(",
"json",
")",
";",
"return",
"new",
"Record",
"(",
")",
".",
"setColumns",
"(",
"map",
")",
";",
"}"... | json to Record
@param json
@return | [
"json",
"to",
"Record"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/FastJsonKit.java#L86-L89 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerce | public static Object coerce(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pClass == String.class) {
return coerceToString(pValue, pLogger);
} else if (isPrimitiveNumberClass(pClass)) {
return coerceToPrimitiveNumber(pValue, pClass, pLogger);
} else if (pClass == Character.class ||
pClass == Character.TYPE) {
return coerceToCharacter(pValue, pLogger);
} else if (pClass == Boolean.class ||
pClass == Boolean.TYPE) {
return coerceToBoolean(pValue, pLogger);
} else {
return coerceToObject(pValue, pClass, pLogger);
}
} | java | public static Object coerce(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pClass == String.class) {
return coerceToString(pValue, pLogger);
} else if (isPrimitiveNumberClass(pClass)) {
return coerceToPrimitiveNumber(pValue, pClass, pLogger);
} else if (pClass == Character.class ||
pClass == Character.TYPE) {
return coerceToCharacter(pValue, pLogger);
} else if (pClass == Boolean.class ||
pClass == Boolean.TYPE) {
return coerceToBoolean(pValue, pLogger);
} else {
return coerceToObject(pValue, pClass, pLogger);
}
} | [
"public",
"static",
"Object",
"coerce",
"(",
"Object",
"pValue",
",",
"Class",
"pClass",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pClass",
"==",
"String",
".",
"class",
")",
"{",
"return",
"coerceToString",
"(",
"pValue",
",... | Coerces the given value to the specified class. | [
"Coerces",
"the",
"given",
"value",
"to",
"the",
"specified",
"class",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L235-L252 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.isPrimitiveNumberClass | static boolean isPrimitiveNumberClass(Class pClass) {
return
pClass == Byte.class ||
pClass == Byte.TYPE ||
pClass == Short.class ||
pClass == Short.TYPE ||
pClass == Integer.class ||
pClass == Integer.TYPE ||
pClass == Long.class ||
pClass == Long.TYPE ||
pClass == Float.class ||
pClass == Float.TYPE ||
pClass == Double.class ||
pClass == Double.TYPE;
} | java | static boolean isPrimitiveNumberClass(Class pClass) {
return
pClass == Byte.class ||
pClass == Byte.TYPE ||
pClass == Short.class ||
pClass == Short.TYPE ||
pClass == Integer.class ||
pClass == Integer.TYPE ||
pClass == Long.class ||
pClass == Long.TYPE ||
pClass == Float.class ||
pClass == Float.TYPE ||
pClass == Double.class ||
pClass == Double.TYPE;
} | [
"static",
"boolean",
"isPrimitiveNumberClass",
"(",
"Class",
"pClass",
")",
"{",
"return",
"pClass",
"==",
"Byte",
".",
"class",
"||",
"pClass",
"==",
"Byte",
".",
"TYPE",
"||",
"pClass",
"==",
"Short",
".",
"class",
"||",
"pClass",
"==",
"Short",
".",
"... | Returns true if the given class is Byte, Short, Integer, Long,
Float, Double | [
"Returns",
"true",
"if",
"the",
"given",
"class",
"is",
"Byte",
"Short",
"Integer",
"Long",
"Float",
"Double"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L260-L274 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToString | public static String coerceToString(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null) {
return "";
} else if (pValue instanceof String) {
return (String) pValue;
} else {
try {
return pValue.toString();
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.TOSTRING_EXCEPTION,
exc,
pValue.getClass().getName());
}
return "";
}
}
} | java | public static String coerceToString(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null) {
return "";
} else if (pValue instanceof String) {
return (String) pValue;
} else {
try {
return pValue.toString();
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.TOSTRING_EXCEPTION,
exc,
pValue.getClass().getName());
}
return "";
}
}
} | [
"public",
"static",
"String",
"coerceToString",
"(",
"Object",
"pValue",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"else",
"if",
"(",
"pValue",
"instanceof",
"Strin... | Coerces the specified value to a String | [
"Coerces",
"the",
"specified",
"value",
"to",
"a",
"String"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L281-L301 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToPrimitiveNumber | public static Number coerceToPrimitiveNumber(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return coerceToPrimitiveNumber(0, pClass);
} else if (pValue instanceof Character) {
char val = ((Character) pValue).charValue();
return coerceToPrimitiveNumber((short) val, pClass);
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.BOOLEAN_TO_NUMBER,
pValue,
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
} else if (pValue.getClass() == pClass) {
return (Number) pValue;
} else if (pValue instanceof Number) {
return coerceToPrimitiveNumber((Number) pValue, pClass);
} else if (pValue instanceof String) {
try {
return coerceToPrimitiveNumber((String) pValue, pClass);
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.STRING_TO_NUMBER_EXCEPTION,
(String) pValue,
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_NUMBER,
pValue.getClass().getName(),
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
}
} | java | public static Number coerceToPrimitiveNumber(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return coerceToPrimitiveNumber(0, pClass);
} else if (pValue instanceof Character) {
char val = ((Character) pValue).charValue();
return coerceToPrimitiveNumber((short) val, pClass);
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.BOOLEAN_TO_NUMBER,
pValue,
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
} else if (pValue.getClass() == pClass) {
return (Number) pValue;
} else if (pValue instanceof Number) {
return coerceToPrimitiveNumber((Number) pValue, pClass);
} else if (pValue instanceof String) {
try {
return coerceToPrimitiveNumber((String) pValue, pClass);
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.STRING_TO_NUMBER_EXCEPTION,
(String) pValue,
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_NUMBER,
pValue.getClass().getName(),
pClass.getName());
}
return coerceToPrimitiveNumber(0, pClass);
}
} | [
"public",
"static",
"Number",
"coerceToPrimitiveNumber",
"(",
"Object",
"pValue",
",",
"Class",
"pClass",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"pValue",
")",
")",
... | Coerces a value to the given primitive number class | [
"Coerces",
"a",
"value",
"to",
"the",
"given",
"primitive",
"number",
"class"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L308-L351 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToInteger | public static Integer coerceToInteger(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null) {
return null;
} else if (pValue instanceof Character) {
return PrimitiveObjects.getInteger
((int) (((Character) pValue).charValue()));
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning(Constants.BOOLEAN_TO_NUMBER,
pValue,
Integer.class.getName());
}
return PrimitiveObjects.getInteger
(((Boolean) pValue).booleanValue() ? 1 : 0);
} else if (pValue instanceof Integer) {
return (Integer) pValue;
} else if (pValue instanceof Number) {
return PrimitiveObjects.getInteger(((Number) pValue).intValue());
} else if (pValue instanceof String) {
try {
return Integer.valueOf((String) pValue);
}
catch (Exception exc) {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning
(Constants.STRING_TO_NUMBER_EXCEPTION,
(String) pValue,
Integer.class.getName());
}
return null;
}
} else {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning
(Constants.COERCE_TO_NUMBER,
pValue.getClass().getName(),
Integer.class.getName());
}
return null;
}
} | java | public static Integer coerceToInteger(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null) {
return null;
} else if (pValue instanceof Character) {
return PrimitiveObjects.getInteger
((int) (((Character) pValue).charValue()));
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning(Constants.BOOLEAN_TO_NUMBER,
pValue,
Integer.class.getName());
}
return PrimitiveObjects.getInteger
(((Boolean) pValue).booleanValue() ? 1 : 0);
} else if (pValue instanceof Integer) {
return (Integer) pValue;
} else if (pValue instanceof Number) {
return PrimitiveObjects.getInteger(((Number) pValue).intValue());
} else if (pValue instanceof String) {
try {
return Integer.valueOf((String) pValue);
}
catch (Exception exc) {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning
(Constants.STRING_TO_NUMBER_EXCEPTION,
(String) pValue,
Integer.class.getName());
}
return null;
}
} else {
if (pLogger.isLoggingWarning()) {
pLogger.logWarning
(Constants.COERCE_TO_NUMBER,
pValue.getClass().getName(),
Integer.class.getName());
}
return null;
}
} | [
"public",
"static",
"Integer",
"coerceToInteger",
"(",
"Object",
"pValue",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"pValue",
"instanceof",
"Cha... | Coerces a value to an Integer, returning null if the coercion
isn't possible. | [
"Coerces",
"a",
"value",
"to",
"an",
"Integer",
"returning",
"null",
"if",
"the",
"coercion",
"isn",
"t",
"possible",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L359-L401 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToPrimitiveNumber | static Number coerceToPrimitiveNumber(long pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return PrimitiveObjects.getByte((byte) pValue);
} else if (pClass == Short.class || pClass == Short.TYPE) {
return PrimitiveObjects.getShort((short) pValue);
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return PrimitiveObjects.getInteger((int) pValue);
} else if (pClass == Long.class || pClass == Long.TYPE) {
return PrimitiveObjects.getLong((long) pValue);
} else if (pClass == Float.class || pClass == Float.TYPE) {
return PrimitiveObjects.getFloat((float) pValue);
} else if (pClass == Double.class || pClass == Double.TYPE) {
return PrimitiveObjects.getDouble((double) pValue);
} else {
return PrimitiveObjects.getInteger(0);
}
} | java | static Number coerceToPrimitiveNumber(long pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return PrimitiveObjects.getByte((byte) pValue);
} else if (pClass == Short.class || pClass == Short.TYPE) {
return PrimitiveObjects.getShort((short) pValue);
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return PrimitiveObjects.getInteger((int) pValue);
} else if (pClass == Long.class || pClass == Long.TYPE) {
return PrimitiveObjects.getLong((long) pValue);
} else if (pClass == Float.class || pClass == Float.TYPE) {
return PrimitiveObjects.getFloat((float) pValue);
} else if (pClass == Double.class || pClass == Double.TYPE) {
return PrimitiveObjects.getDouble((double) pValue);
} else {
return PrimitiveObjects.getInteger(0);
}
} | [
"static",
"Number",
"coerceToPrimitiveNumber",
"(",
"long",
"pValue",
",",
"Class",
"pClass",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pClass",
"==",
"Byte",
".",
"class",
"||",
"pClass",
"==",
"Byte",
".",
"TYPE",
")",
"{",
"return",
"PrimitiveObjects... | Coerces a long to the given primitive number class | [
"Coerces",
"a",
"long",
"to",
"the",
"given",
"primitive",
"number",
"class"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L408-L426 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToPrimitiveNumber | static Number coerceToPrimitiveNumber(Number pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return PrimitiveObjects.getByte(pValue.byteValue());
} else if (pClass == Short.class || pClass == Short.TYPE) {
return PrimitiveObjects.getShort(pValue.shortValue());
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return PrimitiveObjects.getInteger(pValue.intValue());
} else if (pClass == Long.class || pClass == Long.TYPE) {
return PrimitiveObjects.getLong(pValue.longValue());
} else if (pClass == Float.class || pClass == Float.TYPE) {
return PrimitiveObjects.getFloat(pValue.floatValue());
} else if (pClass == Double.class || pClass == Double.TYPE) {
return PrimitiveObjects.getDouble(pValue.doubleValue());
} else {
return PrimitiveObjects.getInteger(0);
}
} | java | static Number coerceToPrimitiveNumber(Number pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return PrimitiveObjects.getByte(pValue.byteValue());
} else if (pClass == Short.class || pClass == Short.TYPE) {
return PrimitiveObjects.getShort(pValue.shortValue());
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return PrimitiveObjects.getInteger(pValue.intValue());
} else if (pClass == Long.class || pClass == Long.TYPE) {
return PrimitiveObjects.getLong(pValue.longValue());
} else if (pClass == Float.class || pClass == Float.TYPE) {
return PrimitiveObjects.getFloat(pValue.floatValue());
} else if (pClass == Double.class || pClass == Double.TYPE) {
return PrimitiveObjects.getDouble(pValue.doubleValue());
} else {
return PrimitiveObjects.getInteger(0);
}
} | [
"static",
"Number",
"coerceToPrimitiveNumber",
"(",
"Number",
"pValue",
",",
"Class",
"pClass",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pClass",
"==",
"Byte",
".",
"class",
"||",
"pClass",
"==",
"Byte",
".",
"TYPE",
")",
"{",
"return",
"PrimitiveObjec... | Coerces a Number to the given primitive number class | [
"Coerces",
"a",
"Number",
"to",
"the",
"given",
"primitive",
"number",
"class"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L458-L476 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToPrimitiveNumber | static Number coerceToPrimitiveNumber(String pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return Byte.valueOf(pValue);
} else if (pClass == Short.class || pClass == Short.TYPE) {
return Short.valueOf(pValue);
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return Integer.valueOf(pValue);
} else if (pClass == Long.class || pClass == Long.TYPE) {
return Long.valueOf(pValue);
} else if (pClass == Float.class || pClass == Float.TYPE) {
return Float.valueOf(pValue);
} else if (pClass == Double.class || pClass == Double.TYPE) {
return Double.valueOf(pValue);
} else {
return PrimitiveObjects.getInteger(0);
}
} | java | static Number coerceToPrimitiveNumber(String pValue,
Class pClass)
throws ELException {
if (pClass == Byte.class || pClass == Byte.TYPE) {
return Byte.valueOf(pValue);
} else if (pClass == Short.class || pClass == Short.TYPE) {
return Short.valueOf(pValue);
} else if (pClass == Integer.class || pClass == Integer.TYPE) {
return Integer.valueOf(pValue);
} else if (pClass == Long.class || pClass == Long.TYPE) {
return Long.valueOf(pValue);
} else if (pClass == Float.class || pClass == Float.TYPE) {
return Float.valueOf(pValue);
} else if (pClass == Double.class || pClass == Double.TYPE) {
return Double.valueOf(pValue);
} else {
return PrimitiveObjects.getInteger(0);
}
} | [
"static",
"Number",
"coerceToPrimitiveNumber",
"(",
"String",
"pValue",
",",
"Class",
"pClass",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pClass",
"==",
"Byte",
".",
"class",
"||",
"pClass",
"==",
"Byte",
".",
"TYPE",
")",
"{",
"return",
"Byte",
".",
... | Coerces a String to the given primitive number class | [
"Coerces",
"a",
"String",
"to",
"the",
"given",
"primitive",
"number",
"class"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L483-L501 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToCharacter | public static Character coerceToCharacter(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return PrimitiveObjects.getCharacter((char) 0);
} else if (pValue instanceof Character) {
return (Character) pValue;
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.BOOLEAN_TO_CHARACTER, pValue);
}
return PrimitiveObjects.getCharacter((char) 0);
} else if (pValue instanceof Number) {
return PrimitiveObjects.getCharacter
((char) ((Number) pValue).shortValue());
} else if (pValue instanceof String) {
String str = (String) pValue;
return PrimitiveObjects.getCharacter(str.charAt(0));
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_CHARACTER,
pValue.getClass().getName());
}
return PrimitiveObjects.getCharacter((char) 0);
}
} | java | public static Character coerceToCharacter(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return PrimitiveObjects.getCharacter((char) 0);
} else if (pValue instanceof Character) {
return (Character) pValue;
} else if (pValue instanceof Boolean) {
if (pLogger.isLoggingError()) {
pLogger.logError(Constants.BOOLEAN_TO_CHARACTER, pValue);
}
return PrimitiveObjects.getCharacter((char) 0);
} else if (pValue instanceof Number) {
return PrimitiveObjects.getCharacter
((char) ((Number) pValue).shortValue());
} else if (pValue instanceof String) {
String str = (String) pValue;
return PrimitiveObjects.getCharacter(str.charAt(0));
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_CHARACTER,
pValue.getClass().getName());
}
return PrimitiveObjects.getCharacter((char) 0);
}
} | [
"public",
"static",
"Character",
"coerceToCharacter",
"(",
"Object",
"pValue",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"pValue",
")",
")",
"{",
"return",
"PrimitiveObje... | Coerces a value to a Character | [
"Coerces",
"a",
"value",
"to",
"a",
"Character"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L508-L535 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToBoolean | public static Boolean coerceToBoolean(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return Boolean.FALSE;
} else if (pValue instanceof Boolean) {
return (Boolean) pValue;
} else if (pValue instanceof String) {
String str = (String) pValue;
try {
return Boolean.valueOf(str);
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.STRING_TO_BOOLEAN,
exc,
(String) pValue);
}
return Boolean.FALSE;
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_BOOLEAN,
pValue.getClass().getName());
}
return Boolean.TRUE;
}
} | java | public static Boolean coerceToBoolean(Object pValue,
Logger pLogger)
throws ELException {
if (pValue == null ||
"".equals(pValue)) {
return Boolean.FALSE;
} else if (pValue instanceof Boolean) {
return (Boolean) pValue;
} else if (pValue instanceof String) {
String str = (String) pValue;
try {
return Boolean.valueOf(str);
}
catch (Exception exc) {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.STRING_TO_BOOLEAN,
exc,
(String) pValue);
}
return Boolean.FALSE;
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_BOOLEAN,
pValue.getClass().getName());
}
return Boolean.TRUE;
}
} | [
"public",
"static",
"Boolean",
"coerceToBoolean",
"(",
"Object",
"pValue",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"pValue",
")",
")",
"{",
"return",
"Boolean",
".",
... | Coerces a value to a Boolean | [
"Coerces",
"a",
"value",
"to",
"a",
"Boolean"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L542-L572 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.coerceToObject | public static Object coerceToObject(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pValue == null) {
return null;
} else if (pClass.isAssignableFrom(pValue.getClass())) {
return pValue;
} else if (pValue instanceof String) {
String str = (String) pValue;
PropertyEditor pe = PropertyEditorManager.findEditor(pClass);
if (pe == null) {
if ("".equals(str)) {
return null;
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.NO_PROPERTY_EDITOR,
str,
pClass.getName());
}
return null;
}
}
try {
pe.setAsText(str);
return pe.getValue();
}
catch (IllegalArgumentException exc) {
if ("".equals(str)) {
return null;
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.PROPERTY_EDITOR_ERROR,
exc,
pValue,
pClass.getName());
}
return null;
}
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_OBJECT,
pValue.getClass().getName(),
pClass.getName());
}
return null;
}
} | java | public static Object coerceToObject(Object pValue,
Class pClass,
Logger pLogger)
throws ELException {
if (pValue == null) {
return null;
} else if (pClass.isAssignableFrom(pValue.getClass())) {
return pValue;
} else if (pValue instanceof String) {
String str = (String) pValue;
PropertyEditor pe = PropertyEditorManager.findEditor(pClass);
if (pe == null) {
if ("".equals(str)) {
return null;
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.NO_PROPERTY_EDITOR,
str,
pClass.getName());
}
return null;
}
}
try {
pe.setAsText(str);
return pe.getValue();
}
catch (IllegalArgumentException exc) {
if ("".equals(str)) {
return null;
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.PROPERTY_EDITOR_ERROR,
exc,
pValue,
pClass.getName());
}
return null;
}
}
} else {
if (pLogger.isLoggingError()) {
pLogger.logError
(Constants.COERCE_TO_OBJECT,
pValue.getClass().getName(),
pClass.getName());
}
return null;
}
} | [
"public",
"static",
"Object",
"coerceToObject",
"(",
"Object",
"pValue",
",",
"Class",
"pClass",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"if",
"(",
"pValue",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"pCl... | Coerces a value to the specified Class that is not covered by any
of the above cases | [
"Coerces",
"a",
"value",
"to",
"the",
"specified",
"Class",
"that",
"is",
"not",
"covered",
"by",
"any",
"of",
"the",
"above",
"cases"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L580-L631 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.isFloatingPointType | public static boolean isFloatingPointType(Class pClass) {
return
pClass == Float.class ||
pClass == Float.TYPE ||
pClass == Double.class ||
pClass == Double.TYPE;
} | java | public static boolean isFloatingPointType(Class pClass) {
return
pClass == Float.class ||
pClass == Float.TYPE ||
pClass == Double.class ||
pClass == Double.TYPE;
} | [
"public",
"static",
"boolean",
"isFloatingPointType",
"(",
"Class",
"pClass",
")",
"{",
"return",
"pClass",
"==",
"Float",
".",
"class",
"||",
"pClass",
"==",
"Float",
".",
"TYPE",
"||",
"pClass",
"==",
"Double",
".",
"class",
"||",
"pClass",
"==",
"Double... | Returns true if the given class is of a floating point type | [
"Returns",
"true",
"if",
"the",
"given",
"class",
"is",
"of",
"a",
"floating",
"point",
"type"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L854-L860 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.isFloatingPointString | public static boolean isFloatingPointString(Object pObject) {
if (pObject instanceof String) {
String str = (String) pObject;
int len = str.length();
for (int i = 0; i < len; i++) {
char ch = str.charAt(i);
if (ch == '.' ||
ch == 'e' ||
ch == 'E') {
return true;
}
}
return false;
} else {
return false;
}
} | java | public static boolean isFloatingPointString(Object pObject) {
if (pObject instanceof String) {
String str = (String) pObject;
int len = str.length();
for (int i = 0; i < len; i++) {
char ch = str.charAt(i);
if (ch == '.' ||
ch == 'e' ||
ch == 'E') {
return true;
}
}
return false;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"isFloatingPointString",
"(",
"Object",
"pObject",
")",
"{",
"if",
"(",
"pObject",
"instanceof",
"String",
")",
"{",
"String",
"str",
"=",
"(",
"String",
")",
"pObject",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")... | Returns true if the given string might contain a floating point
number - i.e., it contains ".", "e", or "E" | [
"Returns",
"true",
"if",
"the",
"given",
"string",
"might",
"contain",
"a",
"floating",
"point",
"number",
"-",
"i",
".",
"e",
".",
"it",
"contains",
".",
"e",
"or",
"E"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L868-L884 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java | Coercions.isIntegerType | public static boolean isIntegerType(Class pClass) {
return
pClass == Byte.class ||
pClass == Byte.TYPE ||
pClass == Short.class ||
pClass == Short.TYPE ||
pClass == Character.class ||
pClass == Character.TYPE ||
pClass == Integer.class ||
pClass == Integer.TYPE ||
pClass == Long.class ||
pClass == Long.TYPE;
} | java | public static boolean isIntegerType(Class pClass) {
return
pClass == Byte.class ||
pClass == Byte.TYPE ||
pClass == Short.class ||
pClass == Short.TYPE ||
pClass == Character.class ||
pClass == Character.TYPE ||
pClass == Integer.class ||
pClass == Integer.TYPE ||
pClass == Long.class ||
pClass == Long.TYPE;
} | [
"public",
"static",
"boolean",
"isIntegerType",
"(",
"Class",
"pClass",
")",
"{",
"return",
"pClass",
"==",
"Byte",
".",
"class",
"||",
"pClass",
"==",
"Byte",
".",
"TYPE",
"||",
"pClass",
"==",
"Short",
".",
"class",
"||",
"pClass",
"==",
"Short",
".",
... | Returns true if the given class is of an integer type | [
"Returns",
"true",
"if",
"the",
"given",
"class",
"is",
"of",
"an",
"integer",
"type"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java#L902-L914 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/core/ControllerExt.java | ControllerExt.getFilesSaveToDatePath | public List<UploadFile> getFilesSaveToDatePath(Integer maxPostSize, String encoding) {
return super.getFiles(UploadPathKit.getDatePath(), maxPostSize, encoding);
} | java | public List<UploadFile> getFilesSaveToDatePath(Integer maxPostSize, String encoding) {
return super.getFiles(UploadPathKit.getDatePath(), maxPostSize, encoding);
} | [
"public",
"List",
"<",
"UploadFile",
">",
"getFilesSaveToDatePath",
"(",
"Integer",
"maxPostSize",
",",
"String",
"encoding",
")",
"{",
"return",
"super",
".",
"getFiles",
"(",
"UploadPathKit",
".",
"getDatePath",
"(",
")",
",",
"maxPostSize",
",",
"encoding",
... | Get upload file save to date path. | [
"Get",
"upload",
"file",
"save",
"to",
"date",
"path",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/core/ControllerExt.java#L61-L63 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/core/ControllerExt.java | ControllerExt.getParaToBigInteger | public BigInteger getParaToBigInteger(String name,BigInteger defaultValue){
return this.toBigInteger(getPara(name), defaultValue);
} | java | public BigInteger getParaToBigInteger(String name,BigInteger defaultValue){
return this.toBigInteger(getPara(name), defaultValue);
} | [
"public",
"BigInteger",
"getParaToBigInteger",
"(",
"String",
"name",
",",
"BigInteger",
"defaultValue",
")",
"{",
"return",
"this",
".",
"toBigInteger",
"(",
"getPara",
"(",
"name",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns the value of a request parameter and convert to BigInteger with a default value if it is null.
@param name a String specifying the name of the parameter
@return a BigInteger representing the single value of the parameter | [
"Returns",
"the",
"value",
"of",
"a",
"request",
"parameter",
"and",
"convert",
"to",
"BigInteger",
"with",
"a",
"default",
"value",
"if",
"it",
"is",
"null",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/core/ControllerExt.java#L101-L103 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java | JSTLVariableResolver.resolveVariable | public Object resolveVariable(String pName,
Object pContext)
throws ELException {
PageContext ctx = (PageContext) pContext;
// Check for implicit objects
if ("pageContext".equals(pName)) {
return ctx;
} else if ("pageScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getPageScopeMap();
} else if ("requestScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getRequestScopeMap();
} else if ("sessionScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getSessionScopeMap();
} else if ("applicationScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getApplicationScopeMap();
} else if ("param".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getParamMap();
} else if ("paramValues".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getParamsMap();
} else if ("header".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getHeaderMap();
} else if ("headerValues".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getHeadersMap();
} else if ("initParam".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getInitParamMap();
} else if ("cookie".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getCookieMap();
}
// Otherwise, just look it up in the page context
else {
return ctx.findAttribute(pName);
}
} | java | public Object resolveVariable(String pName,
Object pContext)
throws ELException {
PageContext ctx = (PageContext) pContext;
// Check for implicit objects
if ("pageContext".equals(pName)) {
return ctx;
} else if ("pageScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getPageScopeMap();
} else if ("requestScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getRequestScopeMap();
} else if ("sessionScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getSessionScopeMap();
} else if ("applicationScope".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getApplicationScopeMap();
} else if ("param".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getParamMap();
} else if ("paramValues".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getParamsMap();
} else if ("header".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getHeaderMap();
} else if ("headerValues".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getHeadersMap();
} else if ("initParam".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getInitParamMap();
} else if ("cookie".equals(pName)) {
return ImplicitObjects.
getImplicitObjects(ctx).
getCookieMap();
}
// Otherwise, just look it up in the page context
else {
return ctx.findAttribute(pName);
}
} | [
"public",
"Object",
"resolveVariable",
"(",
"String",
"pName",
",",
"Object",
"pContext",
")",
"throws",
"ELException",
"{",
"PageContext",
"ctx",
"=",
"(",
"PageContext",
")",
"pContext",
";",
"// Check for implicit objects",
"if",
"(",
"\"pageContext\"",
".",
"e... | Resolves the specified variable within the given context.
Returns null if the variable is not found. | [
"Resolves",
"the",
"specified",
"variable",
"within",
"the",
"given",
"context",
".",
"Returns",
"null",
"if",
"the",
"variable",
"is",
"not",
"found",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java#L38-L92 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java | RelativePath.getSteps | public List getSteps() {
// simply merge our 'step' with our 'next'
List l;
if (next != null)
l = next.getSteps();
else
l = new Vector();
l.add(0, step);
return l;
} | java | public List getSteps() {
// simply merge our 'step' with our 'next'
List l;
if (next != null)
l = next.getSteps();
else
l = new Vector();
l.add(0, step);
return l;
} | [
"public",
"List",
"getSteps",
"(",
")",
"{",
"// simply merge our 'step' with our 'next'",
"List",
"l",
";",
"if",
"(",
"next",
"!=",
"null",
")",
"l",
"=",
"next",
".",
"getSteps",
"(",
")",
";",
"else",
"l",
"=",
"new",
"Vector",
"(",
")",
";",
"l",
... | inherit JavaDoc comment | [
"inherit",
"JavaDoc",
"comment"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java#L88-L97 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/kit/JaxbKit.java | JaxbKit.marshal | public static String marshal(Object jaxbElement) {
StringWriter sw ;
try {
Marshaller fm = JAXBContext.newInstance(jaxbElement.getClass()).createMarshaller();
fm.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
sw = new StringWriter();
fm.marshal(jaxbElement, sw);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
return sw.toString();
} | java | public static String marshal(Object jaxbElement) {
StringWriter sw ;
try {
Marshaller fm = JAXBContext.newInstance(jaxbElement.getClass()).createMarshaller();
fm.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
sw = new StringWriter();
fm.marshal(jaxbElement, sw);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
return sw.toString();
} | [
"public",
"static",
"String",
"marshal",
"(",
"Object",
"jaxbElement",
")",
"{",
"StringWriter",
"sw",
";",
"try",
"{",
"Marshaller",
"fm",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"jaxbElement",
".",
"getClass",
"(",
")",
")",
".",
"createMarshaller",
"... | object -> string | [
"object",
"-",
">",
"string"
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/JaxbKit.java#L64-L75 | train |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java | ScriptFreeTLV.setInitParameters | @Override
public void setInitParameters(Map<java.lang.String, java.lang.Object> initParms) {
super.setInitParameters(initParms);
String declarationsParm = (String) initParms.get("allowDeclarations");
String scriptletsParm = (String) initParms.get("allowScriptlets");
String expressionsParm = (String) initParms.get("allowExpressions");
String rtExpressionsParm = (String) initParms.get("allowRTExpressions");
allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
allowExpressions = "true".equalsIgnoreCase(expressionsParm);
allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
} | java | @Override
public void setInitParameters(Map<java.lang.String, java.lang.Object> initParms) {
super.setInitParameters(initParms);
String declarationsParm = (String) initParms.get("allowDeclarations");
String scriptletsParm = (String) initParms.get("allowScriptlets");
String expressionsParm = (String) initParms.get("allowExpressions");
String rtExpressionsParm = (String) initParms.get("allowRTExpressions");
allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
allowExpressions = "true".equalsIgnoreCase(expressionsParm);
allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
} | [
"@",
"Override",
"public",
"void",
"setInitParameters",
"(",
"Map",
"<",
"java",
".",
"lang",
".",
"String",
",",
"java",
".",
"lang",
".",
"Object",
">",
"initParms",
")",
"{",
"super",
".",
"setInitParameters",
"(",
"initParms",
")",
";",
"String",
"de... | Sets the values of the initialization parameters, as supplied in the TLD.
@param initParms a mapping from the names of the initialization parameters
to their values, as specified in the TLD. | [
"Sets",
"the",
"values",
"of",
"the",
"initialization",
"parameters",
"as",
"supplied",
"in",
"the",
"TLD",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java#L68-L80 | train |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java | ScriptFreeTLV.validate | @Override
public ValidationMessage[] validate(String prefix, String uri, PageData page) {
try {
MyContentHandler handler = new MyContentHandler();
parser.parse(page, handler);
return handler.reportResults();
} catch (ParserConfigurationException e) {
return vmFromString(e.toString());
} catch (SAXException e) {
return vmFromString(e.toString());
} catch (IOException e) {
return vmFromString(e.toString());
}
} | java | @Override
public ValidationMessage[] validate(String prefix, String uri, PageData page) {
try {
MyContentHandler handler = new MyContentHandler();
parser.parse(page, handler);
return handler.reportResults();
} catch (ParserConfigurationException e) {
return vmFromString(e.toString());
} catch (SAXException e) {
return vmFromString(e.toString());
} catch (IOException e) {
return vmFromString(e.toString());
}
} | [
"@",
"Override",
"public",
"ValidationMessage",
"[",
"]",
"validate",
"(",
"String",
"prefix",
",",
"String",
"uri",
",",
"PageData",
"page",
")",
"{",
"try",
"{",
"MyContentHandler",
"handler",
"=",
"new",
"MyContentHandler",
"(",
")",
";",
"parser",
".",
... | Validates a single JSP page.
@param prefix the namespace prefix specified by the page for the
custom tag library being validated.
@param uri the URI specified by the page for the TLD of the
custom tag library being validated.
@param page a wrapper around the XML representation of the page
being validated.
@return null, if the page is valid; otherwise, a ValidationMessage[]
containing one or more messages indicating why the page is not valid. | [
"Validates",
"a",
"single",
"JSP",
"page",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java#L94-L107 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java | LessThanOrEqualsOperator.apply | public boolean apply(String pLeft,
String pRight,
Logger pLogger) {
return pLeft.compareTo(pRight) <= 0;
} | java | public boolean apply(String pLeft,
String pRight,
Logger pLogger) {
return pLeft.compareTo(pRight) <= 0;
} | [
"public",
"boolean",
"apply",
"(",
"String",
"pLeft",
",",
"String",
"pRight",
",",
"Logger",
"pLogger",
")",
"{",
"return",
"pLeft",
".",
"compareTo",
"(",
"pRight",
")",
"<=",
"0",
";",
"}"
] | Applies the operator to the given String values | [
"Applies",
"the",
"operator",
"to",
"the",
"given",
"String",
"values"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java#L101-L105 | train |
audit4j/audit4j-spring | src/main/java/org/audit4j/integration/spring/AuditAspect.java | AuditAspect.audit | @Before("@within(org.audit4j.core.annotation.Audit) || @annotation(org.audit4j.core.annotation.Audit)")
public void audit(final JoinPoint jointPoint) throws Throwable {
MethodSignature methodSignature = (MethodSignature) jointPoint.getSignature();
Method method = methodSignature.getMethod();
if (method.getDeclaringClass().isInterface()) {
try {
method = jointPoint.getTarget().getClass()
.getDeclaredMethod(jointPoint.getSignature().getName(), method.getParameterTypes());
} catch (final SecurityException exception) {
throw new Audit4jRuntimeException(
"Exception occured while proceding Audit Aspect in Audit4j Spring Integration", exception);
} catch (final NoSuchMethodException exception) {
throw new Audit4jRuntimeException(
"Exception occured while proceding Audit Aspect in Audit4j Spring Integration", exception);
}
}
AuditManager.getInstance().audit(jointPoint.getTarget().getClass(), method, jointPoint.getArgs());
} | java | @Before("@within(org.audit4j.core.annotation.Audit) || @annotation(org.audit4j.core.annotation.Audit)")
public void audit(final JoinPoint jointPoint) throws Throwable {
MethodSignature methodSignature = (MethodSignature) jointPoint.getSignature();
Method method = methodSignature.getMethod();
if (method.getDeclaringClass().isInterface()) {
try {
method = jointPoint.getTarget().getClass()
.getDeclaredMethod(jointPoint.getSignature().getName(), method.getParameterTypes());
} catch (final SecurityException exception) {
throw new Audit4jRuntimeException(
"Exception occured while proceding Audit Aspect in Audit4j Spring Integration", exception);
} catch (final NoSuchMethodException exception) {
throw new Audit4jRuntimeException(
"Exception occured while proceding Audit Aspect in Audit4j Spring Integration", exception);
}
}
AuditManager.getInstance().audit(jointPoint.getTarget().getClass(), method, jointPoint.getArgs());
} | [
"@",
"Before",
"(",
"\"@within(org.audit4j.core.annotation.Audit) || @annotation(org.audit4j.core.annotation.Audit)\"",
")",
"public",
"void",
"audit",
"(",
"final",
"JoinPoint",
"jointPoint",
")",
"throws",
"Throwable",
"{",
"MethodSignature",
"methodSignature",
"=",
"(",
"M... | Audit Aspect.
@param jointPoint
the joint point
@throws Throwable
the throwable | [
"Audit",
"Aspect",
"."
] | 52de1e3370608890292a72194df247b50a2d4bed | https://github.com/audit4j/audit4j-spring/blob/52de1e3370608890292a72194df247b50a2d4bed/src/main/java/org/audit4j/integration/spring/AuditAspect.java#L59-L79 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java | ELParser.ValuePrefix | final public Expression ValuePrefix() throws ParseException {
Expression ret;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
case TRUE:
case FALSE:
case NULL:
ret = Literal();
break;
case LPAREN:
jj_consume_token(LPAREN);
ret = Expression();
jj_consume_token(RPAREN);
break;
default:
jj_la1[27] = jj_gen;
if (jj_2_1(2147483647)) {
ret = FunctionInvocation();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENTIFIER:
ret = NamedValue();
break;
default:
jj_la1[28] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if (true) return ret;}
throw new Error("Missing return statement in function");
} | java | final public Expression ValuePrefix() throws ParseException {
Expression ret;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
case TRUE:
case FALSE:
case NULL:
ret = Literal();
break;
case LPAREN:
jj_consume_token(LPAREN);
ret = Expression();
jj_consume_token(RPAREN);
break;
default:
jj_la1[27] = jj_gen;
if (jj_2_1(2147483647)) {
ret = FunctionInvocation();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENTIFIER:
ret = NamedValue();
break;
default:
jj_la1[28] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if (true) return ret;}
throw new Error("Missing return statement in function");
} | [
"final",
"public",
"Expression",
"ValuePrefix",
"(",
")",
"throws",
"ParseException",
"{",
"Expression",
"ret",
";",
"switch",
"(",
"(",
"jj_ntk",
"==",
"-",
"1",
")",
"?",
"jj_ntk",
"(",
")",
":",
"jj_ntk",
")",
"{",
"case",
"INTEGER_LITERAL",
":",
"cas... | This is an element that can start a value | [
"This",
"is",
"an",
"element",
"that",
"can",
"start",
"a",
"value"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java#L674-L708 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.evaluate | public Object evaluate(String pExpressionString,
Object pContext,
Class pExpectedType,
Map functions,
String defaultPrefix)
throws ELException {
return evaluate(pExpressionString,
pContext,
pExpectedType,
functions,
defaultPrefix,
sLogger);
} | java | public Object evaluate(String pExpressionString,
Object pContext,
Class pExpectedType,
Map functions,
String defaultPrefix)
throws ELException {
return evaluate(pExpressionString,
pContext,
pExpectedType,
functions,
defaultPrefix,
sLogger);
} | [
"public",
"Object",
"evaluate",
"(",
"String",
"pExpressionString",
",",
"Object",
"pContext",
",",
"Class",
"pExpectedType",
",",
"Map",
"functions",
",",
"String",
"defaultPrefix",
")",
"throws",
"ELException",
"{",
"return",
"evaluate",
"(",
"pExpressionString",
... | Evaluates the given expression String
@param pExpressionString the expression String to be evaluated
@param pContext the context passed to the VariableResolver for
resolving variable names
@param pExpectedType the type to which the evaluated expression
should be coerced
@return the expression String evaluated to the given expected
type | [
"Evaluates",
"the",
"given",
"expression",
"String"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L171-L183 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.evaluate | Object evaluate(String pExpressionString,
Object pContext,
Class pExpectedType,
Map functions,
String defaultPrefix,
Logger pLogger)
throws ELException {
// Check for null expression strings
if (pExpressionString == null) {
throw new ELException
(Constants.NULL_EXPRESSION_STRING);
}
// Set the PageContext;
pageContext = (PageContext) pContext;
// Get the parsed version of the expression string
Object parsedValue = parseExpressionString(pExpressionString);
// Evaluate differently based on the parsed type
if (parsedValue instanceof String) {
// Convert the String, and cache the conversion
String strValue = (String) parsedValue;
return convertStaticValueToExpectedType(strValue,
pExpectedType,
pLogger);
} else if (parsedValue instanceof Expression) {
// Evaluate the expression and convert
Object value =
((Expression) parsedValue).evaluate(pContext,
mResolver,
functions,
defaultPrefix,
pLogger);
return convertToExpectedType(value,
pExpectedType,
pLogger);
} else if (parsedValue instanceof ExpressionString) {
// Evaluate the expression/string list and convert
String strValue =
((ExpressionString) parsedValue).evaluate(pContext,
mResolver,
functions,
defaultPrefix,
pLogger);
return convertToExpectedType(strValue,
pExpectedType,
pLogger);
} else {
// This should never be reached
return null;
}
} | java | Object evaluate(String pExpressionString,
Object pContext,
Class pExpectedType,
Map functions,
String defaultPrefix,
Logger pLogger)
throws ELException {
// Check for null expression strings
if (pExpressionString == null) {
throw new ELException
(Constants.NULL_EXPRESSION_STRING);
}
// Set the PageContext;
pageContext = (PageContext) pContext;
// Get the parsed version of the expression string
Object parsedValue = parseExpressionString(pExpressionString);
// Evaluate differently based on the parsed type
if (parsedValue instanceof String) {
// Convert the String, and cache the conversion
String strValue = (String) parsedValue;
return convertStaticValueToExpectedType(strValue,
pExpectedType,
pLogger);
} else if (parsedValue instanceof Expression) {
// Evaluate the expression and convert
Object value =
((Expression) parsedValue).evaluate(pContext,
mResolver,
functions,
defaultPrefix,
pLogger);
return convertToExpectedType(value,
pExpectedType,
pLogger);
} else if (parsedValue instanceof ExpressionString) {
// Evaluate the expression/string list and convert
String strValue =
((ExpressionString) parsedValue).evaluate(pContext,
mResolver,
functions,
defaultPrefix,
pLogger);
return convertToExpectedType(strValue,
pExpectedType,
pLogger);
} else {
// This should never be reached
return null;
}
} | [
"Object",
"evaluate",
"(",
"String",
"pExpressionString",
",",
"Object",
"pContext",
",",
"Class",
"pExpectedType",
",",
"Map",
"functions",
",",
"String",
"defaultPrefix",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"// Check for null expression stri... | Evaluates the given expression string | [
"Evaluates",
"the",
"given",
"expression",
"string"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L190-L242 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.convertToExpectedType | Object convertToExpectedType(Object pValue,
Class pExpectedType,
Logger pLogger)
throws ELException {
return Coercions.coerce(pValue,
pExpectedType,
pLogger);
} | java | Object convertToExpectedType(Object pValue,
Class pExpectedType,
Logger pLogger)
throws ELException {
return Coercions.coerce(pValue,
pExpectedType,
pLogger);
} | [
"Object",
"convertToExpectedType",
"(",
"Object",
"pValue",
",",
"Class",
"pExpectedType",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"return",
"Coercions",
".",
"coerce",
"(",
"pValue",
",",
"pExpectedType",
",",
"pLogger",
")",
";",
"}"
] | Converts the given value to the specified expected type. | [
"Converts",
"the",
"given",
"value",
"to",
"the",
"specified",
"expected",
"type",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L300-L307 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.convertStaticValueToExpectedType | Object convertStaticValueToExpectedType(String pValue,
Class pExpectedType,
Logger pLogger)
throws ELException {
// See if the value is already of the expected type
if (pExpectedType == String.class ||
pExpectedType == Object.class) {
return pValue;
}
// Find the cached value
Map valueByString = getOrCreateExpectedTypeMap(pExpectedType);
if (!mBypassCache &&
valueByString.containsKey(pValue)) {
return valueByString.get(pValue);
} else {
// Convert from a String
Object ret = Coercions.coerce(pValue, pExpectedType, pLogger);
valueByString.put(pValue, ret);
return ret;
}
} | java | Object convertStaticValueToExpectedType(String pValue,
Class pExpectedType,
Logger pLogger)
throws ELException {
// See if the value is already of the expected type
if (pExpectedType == String.class ||
pExpectedType == Object.class) {
return pValue;
}
// Find the cached value
Map valueByString = getOrCreateExpectedTypeMap(pExpectedType);
if (!mBypassCache &&
valueByString.containsKey(pValue)) {
return valueByString.get(pValue);
} else {
// Convert from a String
Object ret = Coercions.coerce(pValue, pExpectedType, pLogger);
valueByString.put(pValue, ret);
return ret;
}
} | [
"Object",
"convertStaticValueToExpectedType",
"(",
"String",
"pValue",
",",
"Class",
"pExpectedType",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"// See if the value is already of the expected type",
"if",
"(",
"pExpectedType",
"==",
"String",
".",
"clas... | Converts the given String, specified as a static expression
string, to the given expected type. The conversion is cached. | [
"Converts",
"the",
"given",
"String",
"specified",
"as",
"a",
"static",
"expression",
"string",
"to",
"the",
"given",
"expected",
"type",
".",
"The",
"conversion",
"is",
"cached",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L315-L336 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.getOrCreateExpectedTypeMap | static Map getOrCreateExpectedTypeMap(Class pExpectedType) {
synchronized (sCachedExpectedTypes) {
Map ret = (Map) sCachedExpectedTypes.get(pExpectedType);
if (ret == null) {
ret = Collections.synchronizedMap(new HashMap());
sCachedExpectedTypes.put(pExpectedType, ret);
}
return ret;
}
} | java | static Map getOrCreateExpectedTypeMap(Class pExpectedType) {
synchronized (sCachedExpectedTypes) {
Map ret = (Map) sCachedExpectedTypes.get(pExpectedType);
if (ret == null) {
ret = Collections.synchronizedMap(new HashMap());
sCachedExpectedTypes.put(pExpectedType, ret);
}
return ret;
}
} | [
"static",
"Map",
"getOrCreateExpectedTypeMap",
"(",
"Class",
"pExpectedType",
")",
"{",
"synchronized",
"(",
"sCachedExpectedTypes",
")",
"{",
"Map",
"ret",
"=",
"(",
"Map",
")",
"sCachedExpectedTypes",
".",
"get",
"(",
"pExpectedType",
")",
";",
"if",
"(",
"r... | Creates or returns the Map that maps string literals to parsed
values for the specified expected type. | [
"Creates",
"or",
"returns",
"the",
"Map",
"that",
"maps",
"string",
"literals",
"to",
"parsed",
"values",
"for",
"the",
"specified",
"expected",
"type",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L344-L353 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.createExpressionStringMap | private synchronized void createExpressionStringMap() {
if (sCachedExpressionStrings != null) {
return;
}
final int maxSize;
if ((pageContext != null) && (pageContext.getServletContext() != null)) {
String value = pageContext.getServletContext().getInitParameter(EXPR_CACHE_PARAM);
if (value != null) {
maxSize = Integer.valueOf(value);
} else {
maxSize = MAX_SIZE;
}
} else {
maxSize = MAX_SIZE;
}
// fall through if it couldn't find the parameter
sCachedExpressionStrings = Collections.synchronizedMap(new LinkedHashMap() {
@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > maxSize;
}
});
} | java | private synchronized void createExpressionStringMap() {
if (sCachedExpressionStrings != null) {
return;
}
final int maxSize;
if ((pageContext != null) && (pageContext.getServletContext() != null)) {
String value = pageContext.getServletContext().getInitParameter(EXPR_CACHE_PARAM);
if (value != null) {
maxSize = Integer.valueOf(value);
} else {
maxSize = MAX_SIZE;
}
} else {
maxSize = MAX_SIZE;
}
// fall through if it couldn't find the parameter
sCachedExpressionStrings = Collections.synchronizedMap(new LinkedHashMap() {
@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > maxSize;
}
});
} | [
"private",
"synchronized",
"void",
"createExpressionStringMap",
"(",
")",
"{",
"if",
"(",
"sCachedExpressionStrings",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"final",
"int",
"maxSize",
";",
"if",
"(",
"(",
"pageContext",
"!=",
"null",
")",
"&&",
"(",
"... | Creates LRU map of expression strings. If context parameter
specifying cache size is present use that as the maximum size
of the LRU map otherwise use default. | [
"Creates",
"LRU",
"map",
"of",
"expression",
"strings",
".",
"If",
"context",
"parameter",
"specifying",
"cache",
"size",
"is",
"present",
"use",
"that",
"as",
"the",
"maximum",
"size",
"of",
"the",
"LRU",
"map",
"otherwise",
"use",
"default",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L362-L386 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.formatParseException | static String formatParseException(String pExpressionString,
ParseException pExc) {
// Generate the String of expected tokens
StringBuffer expectedBuf = new StringBuffer();
int maxSize = 0;
boolean printedOne = false;
if (pExc.expectedTokenSequences == null) {
return pExc.toString();
}
for (int i = 0; i < pExc.expectedTokenSequences.length; i++) {
if (maxSize < pExc.expectedTokenSequences[i].length) {
maxSize = pExc.expectedTokenSequences[i].length;
}
for (int j = 0; j < pExc.expectedTokenSequences[i].length; j++) {
if (printedOne) {
expectedBuf.append(", ");
}
expectedBuf.append
(pExc.tokenImage[pExc.expectedTokenSequences[i][j]]);
printedOne = true;
}
}
String expected = expectedBuf.toString();
// Generate the String of encountered tokens
StringBuffer encounteredBuf = new StringBuffer();
Token tok = pExc.currentToken.next;
for (int i = 0; i < maxSize; i++) {
if (i != 0) {
encounteredBuf.append(" ");
}
if (tok.kind == 0) {
encounteredBuf.append(pExc.tokenImage[0]);
break;
}
encounteredBuf.append(addEscapes(tok.image));
tok = tok.next;
}
String encountered = encounteredBuf.toString();
// Format the error message
return MessageFormat.format
(Constants.PARSE_EXCEPTION,
new Object[]{
expected,
encountered,
});
} | java | static String formatParseException(String pExpressionString,
ParseException pExc) {
// Generate the String of expected tokens
StringBuffer expectedBuf = new StringBuffer();
int maxSize = 0;
boolean printedOne = false;
if (pExc.expectedTokenSequences == null) {
return pExc.toString();
}
for (int i = 0; i < pExc.expectedTokenSequences.length; i++) {
if (maxSize < pExc.expectedTokenSequences[i].length) {
maxSize = pExc.expectedTokenSequences[i].length;
}
for (int j = 0; j < pExc.expectedTokenSequences[i].length; j++) {
if (printedOne) {
expectedBuf.append(", ");
}
expectedBuf.append
(pExc.tokenImage[pExc.expectedTokenSequences[i][j]]);
printedOne = true;
}
}
String expected = expectedBuf.toString();
// Generate the String of encountered tokens
StringBuffer encounteredBuf = new StringBuffer();
Token tok = pExc.currentToken.next;
for (int i = 0; i < maxSize; i++) {
if (i != 0) {
encounteredBuf.append(" ");
}
if (tok.kind == 0) {
encounteredBuf.append(pExc.tokenImage[0]);
break;
}
encounteredBuf.append(addEscapes(tok.image));
tok = tok.next;
}
String encountered = encounteredBuf.toString();
// Format the error message
return MessageFormat.format
(Constants.PARSE_EXCEPTION,
new Object[]{
expected,
encountered,
});
} | [
"static",
"String",
"formatParseException",
"(",
"String",
"pExpressionString",
",",
"ParseException",
"pExc",
")",
"{",
"// Generate the String of expected tokens",
"StringBuffer",
"expectedBuf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"maxSize",
"=",
"0",
... | Formats a ParseException into an error message suitable for
displaying on a web page | [
"Formats",
"a",
"ParseException",
"into",
"an",
"error",
"message",
"suitable",
"for",
"displaying",
"on",
"a",
"web",
"page"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L396-L445 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java | ELEvaluator.parseAndRender | public String parseAndRender(String pExpressionString)
throws ELException {
Object val = parseExpressionString(pExpressionString);
if (val instanceof String) {
return (String) val;
} else if (val instanceof Expression) {
return "${" + ((Expression) val).getExpressionString() + "}";
} else if (val instanceof ExpressionString) {
return ((ExpressionString) val).getExpressionString();
} else {
return "";
}
} | java | public String parseAndRender(String pExpressionString)
throws ELException {
Object val = parseExpressionString(pExpressionString);
if (val instanceof String) {
return (String) val;
} else if (val instanceof Expression) {
return "${" + ((Expression) val).getExpressionString() + "}";
} else if (val instanceof ExpressionString) {
return ((ExpressionString) val).getExpressionString();
} else {
return "";
}
} | [
"public",
"String",
"parseAndRender",
"(",
"String",
"pExpressionString",
")",
"throws",
"ELException",
"{",
"Object",
"val",
"=",
"parseExpressionString",
"(",
"pExpressionString",
")",
";",
"if",
"(",
"val",
"instanceof",
"String",
")",
"{",
"return",
"(",
"St... | Parses the given expression string, then converts it back to a
String in its canonical form. This is used to test parsing. | [
"Parses",
"the",
"given",
"expression",
"string",
"then",
"converts",
"it",
"back",
"to",
"a",
"String",
"in",
"its",
"canonical",
"form",
".",
"This",
"is",
"used",
"to",
"test",
"parsing",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java#L497-L509 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java | TransformSupport.getSourceFromXmlAttribute | Source getSourceFromXmlAttribute() throws JspTagException, SAXException, ParserConfigurationException {
Object xml = this.xml;
if (xml == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_IS_NULL"));
}
// other JSTL XML tags may produce a list
if (xml instanceof List) {
List<?> list = (List<?>) xml;
if (list.size() != 1) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_LIST_SIZE"));
}
xml = list.get(0);
}
if (xml instanceof Source) {
return (Source) xml;
}
if (xml instanceof String) {
String s = (String) xml;
s = s.trim();
if (s.length() == 0) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_IS_EMPTY"));
}
return XmlUtil.newSAXSource(new StringReader(s), xmlSystemId, entityResolver);
}
if (xml instanceof Reader) {
return XmlUtil.newSAXSource((Reader) xml, xmlSystemId, entityResolver);
}
if (xml instanceof Node) {
return new DOMSource((Node) xml, xmlSystemId);
}
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_UNSUPPORTED_TYPE", xml.getClass()));
} | java | Source getSourceFromXmlAttribute() throws JspTagException, SAXException, ParserConfigurationException {
Object xml = this.xml;
if (xml == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_IS_NULL"));
}
// other JSTL XML tags may produce a list
if (xml instanceof List) {
List<?> list = (List<?>) xml;
if (list.size() != 1) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_LIST_SIZE"));
}
xml = list.get(0);
}
if (xml instanceof Source) {
return (Source) xml;
}
if (xml instanceof String) {
String s = (String) xml;
s = s.trim();
if (s.length() == 0) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_IS_EMPTY"));
}
return XmlUtil.newSAXSource(new StringReader(s), xmlSystemId, entityResolver);
}
if (xml instanceof Reader) {
return XmlUtil.newSAXSource((Reader) xml, xmlSystemId, entityResolver);
}
if (xml instanceof Node) {
return new DOMSource((Node) xml, xmlSystemId);
}
throw new JspTagException(Resources.getMessage("TRANSFORM_XML_UNSUPPORTED_TYPE", xml.getClass()));
} | [
"Source",
"getSourceFromXmlAttribute",
"(",
")",
"throws",
"JspTagException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"Object",
"xml",
"=",
"this",
".",
"xml",
";",
"if",
"(",
"xml",
"==",
"null",
")",
"{",
"throw",
"new",
"JspTagException... | Return the Source for a document specified in the "doc" or "xml" attribute.
@return the document Source
@throws JspTagException if there is a problem with the attribute | [
"Return",
"the",
"Source",
"for",
"a",
"document",
"specified",
"in",
"the",
"doc",
"or",
"xml",
"attribute",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java#L201-L234 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java | TransformSupport.getSourceFromBodyContent | Source getSourceFromBodyContent() throws JspTagException, SAXException, ParserConfigurationException {
if (bodyContent == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_IS_NULL"));
}
String s = bodyContent.getString();
if (s == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_CONTENT_IS_NULL"));
}
s = s.trim();
if (s.length() == 0) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_IS_EMPTY"));
}
return XmlUtil.newSAXSource(new StringReader(s), xmlSystemId, entityResolver);
} | java | Source getSourceFromBodyContent() throws JspTagException, SAXException, ParserConfigurationException {
if (bodyContent == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_IS_NULL"));
}
String s = bodyContent.getString();
if (s == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_CONTENT_IS_NULL"));
}
s = s.trim();
if (s.length() == 0) {
throw new JspTagException(Resources.getMessage("TRANSFORM_BODY_IS_EMPTY"));
}
return XmlUtil.newSAXSource(new StringReader(s), xmlSystemId, entityResolver);
} | [
"Source",
"getSourceFromBodyContent",
"(",
")",
"throws",
"JspTagException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"if",
"(",
"bodyContent",
"==",
"null",
")",
"{",
"throw",
"new",
"JspTagException",
"(",
"Resources",
".",
"getMessage",
"(",... | Return the Source for a document specified as body content.
@return the document Source
@throws JspTagException if there is a problem with the body content | [
"Return",
"the",
"Source",
"for",
"a",
"document",
"specified",
"as",
"body",
"content",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java#L242-L255 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java | Evaluator.validate | public String validate(String pAttributeName,
String pAttributeValue) {
try {
sEvaluator.setBypassCache(true);
sEvaluator.parseExpressionString(pAttributeValue);
sEvaluator.setBypassCache(false);
return null;
}
catch (ELException exc) {
return
MessageFormat.format
(Constants.ATTRIBUTE_PARSE_EXCEPTION,
"" + pAttributeName,
"" + pAttributeValue,
exc.getMessage());
}
} | java | public String validate(String pAttributeName,
String pAttributeValue) {
try {
sEvaluator.setBypassCache(true);
sEvaluator.parseExpressionString(pAttributeValue);
sEvaluator.setBypassCache(false);
return null;
}
catch (ELException exc) {
return
MessageFormat.format
(Constants.ATTRIBUTE_PARSE_EXCEPTION,
"" + pAttributeName,
"" + pAttributeValue,
exc.getMessage());
}
} | [
"public",
"String",
"validate",
"(",
"String",
"pAttributeName",
",",
"String",
"pAttributeValue",
")",
"{",
"try",
"{",
"sEvaluator",
".",
"setBypassCache",
"(",
"true",
")",
";",
"sEvaluator",
".",
"parseExpressionString",
"(",
"pAttributeValue",
")",
";",
"sE... | Translation time validation of an attribute value. This method
will return a null String if the attribute value is valid;
otherwise an error message. | [
"Translation",
"time",
"validation",
"of",
"an",
"attribute",
"value",
".",
"This",
"method",
"will",
"return",
"a",
"null",
"String",
"if",
"the",
"attribute",
"value",
"is",
"valid",
";",
"otherwise",
"an",
"error",
"message",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java#L67-L83 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java | Evaluator.evaluate | public Object evaluate(String pAttributeName,
String pAttributeValue,
Class pExpectedType,
Tag pTag,
PageContext pPageContext,
Map functions,
String defaultPrefix)
throws JspException {
try {
return sEvaluator.evaluate
(pAttributeValue,
pPageContext,
pExpectedType,
functions,
defaultPrefix);
}
catch (ELException exc) {
throw new JspException
(MessageFormat.format
(Constants.ATTRIBUTE_EVALUATION_EXCEPTION,
"" + pAttributeName,
"" + pAttributeValue,
exc.getMessage(),
exc.getRootCause()), exc.getRootCause());
}
} | java | public Object evaluate(String pAttributeName,
String pAttributeValue,
Class pExpectedType,
Tag pTag,
PageContext pPageContext,
Map functions,
String defaultPrefix)
throws JspException {
try {
return sEvaluator.evaluate
(pAttributeValue,
pPageContext,
pExpectedType,
functions,
defaultPrefix);
}
catch (ELException exc) {
throw new JspException
(MessageFormat.format
(Constants.ATTRIBUTE_EVALUATION_EXCEPTION,
"" + pAttributeName,
"" + pAttributeValue,
exc.getMessage(),
exc.getRootCause()), exc.getRootCause());
}
} | [
"public",
"Object",
"evaluate",
"(",
"String",
"pAttributeName",
",",
"String",
"pAttributeValue",
",",
"Class",
"pExpectedType",
",",
"Tag",
"pTag",
",",
"PageContext",
"pPageContext",
",",
"Map",
"functions",
",",
"String",
"defaultPrefix",
")",
"throws",
"JspEx... | Evaluates the expression at request time | [
"Evaluates",
"the",
"expression",
"at",
"request",
"time"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java#L90-L115 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java | Evaluator.evaluate | public Object evaluate(String pAttributeName,
String pAttributeValue,
Class pExpectedType,
Tag pTag,
PageContext pPageContext)
throws JspException {
return evaluate(pAttributeName,
pAttributeValue,
pExpectedType,
pTag,
pPageContext,
null,
null);
} | java | public Object evaluate(String pAttributeName,
String pAttributeValue,
Class pExpectedType,
Tag pTag,
PageContext pPageContext)
throws JspException {
return evaluate(pAttributeName,
pAttributeValue,
pExpectedType,
pTag,
pPageContext,
null,
null);
} | [
"public",
"Object",
"evaluate",
"(",
"String",
"pAttributeName",
",",
"String",
"pAttributeValue",
",",
"Class",
"pExpectedType",
",",
"Tag",
"pTag",
",",
"PageContext",
"pPageContext",
")",
"throws",
"JspException",
"{",
"return",
"evaluate",
"(",
"pAttributeName",... | Conduit to old-style call for convenience. | [
"Conduit",
"to",
"old",
"-",
"style",
"call",
"for",
"convenience",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java#L120-L133 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java | Evaluator.parseAndRender | public static String parseAndRender(String pAttributeValue)
throws JspException {
try {
return sEvaluator.parseAndRender(pAttributeValue);
}
catch (ELException exc) {
throw new JspException
(MessageFormat.format
(Constants.ATTRIBUTE_PARSE_EXCEPTION,
"test",
"" + pAttributeValue,
exc.getMessage()));
}
} | java | public static String parseAndRender(String pAttributeValue)
throws JspException {
try {
return sEvaluator.parseAndRender(pAttributeValue);
}
catch (ELException exc) {
throw new JspException
(MessageFormat.format
(Constants.ATTRIBUTE_PARSE_EXCEPTION,
"test",
"" + pAttributeValue,
exc.getMessage()));
}
} | [
"public",
"static",
"String",
"parseAndRender",
"(",
"String",
"pAttributeValue",
")",
"throws",
"JspException",
"{",
"try",
"{",
"return",
"sEvaluator",
".",
"parseAndRender",
"(",
"pAttributeValue",
")",
";",
"}",
"catch",
"(",
"ELException",
"exc",
")",
"{",
... | Parses the given attribute value, then converts it back to a
String in its canonical form. | [
"Parses",
"the",
"given",
"attribute",
"value",
"then",
"converts",
"it",
"back",
"to",
"a",
"String",
"in",
"its",
"canonical",
"form",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java#L144-L157 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java | DeclareTEI.getVariableInfo | @Override
public VariableInfo[] getVariableInfo(TagData data) {
// construct the relevant VariableInfo object
VariableInfo id = new VariableInfo(
data.getAttributeString("id"),
data.getAttributeString("type") == null ?
"java.lang.Object" : data.getAttributeString("type"),
true,
VariableInfo.AT_END);
return new VariableInfo[]{id};
} | java | @Override
public VariableInfo[] getVariableInfo(TagData data) {
// construct the relevant VariableInfo object
VariableInfo id = new VariableInfo(
data.getAttributeString("id"),
data.getAttributeString("type") == null ?
"java.lang.Object" : data.getAttributeString("type"),
true,
VariableInfo.AT_END);
return new VariableInfo[]{id};
} | [
"@",
"Override",
"public",
"VariableInfo",
"[",
"]",
"getVariableInfo",
"(",
"TagData",
"data",
")",
"{",
"// construct the relevant VariableInfo object",
"VariableInfo",
"id",
"=",
"new",
"VariableInfo",
"(",
"data",
".",
"getAttributeString",
"(",
"\"id\"",
")",
"... | purposely inherit JavaDoc and semantics from TagExtraInfo | [
"purposely",
"inherit",
"JavaDoc",
"and",
"semantics",
"from",
"TagExtraInfo"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java#L37-L47 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java | DriverTag.setScope | public void setScope(String scopeName) {
if ("page".equals(scopeName)) {
scope = PageContext.PAGE_SCOPE;
}
else if ("request".equals(scopeName)) {
scope = PageContext.REQUEST_SCOPE;
}
else if ("session".equals(scopeName)) {
scope = PageContext.SESSION_SCOPE;
}
else if ("application".equals(scopeName)) {
scope = PageContext.APPLICATION_SCOPE;
}
} | java | public void setScope(String scopeName) {
if ("page".equals(scopeName)) {
scope = PageContext.PAGE_SCOPE;
}
else if ("request".equals(scopeName)) {
scope = PageContext.REQUEST_SCOPE;
}
else if ("session".equals(scopeName)) {
scope = PageContext.SESSION_SCOPE;
}
else if ("application".equals(scopeName)) {
scope = PageContext.APPLICATION_SCOPE;
}
} | [
"public",
"void",
"setScope",
"(",
"String",
"scopeName",
")",
"{",
"if",
"(",
"\"page\"",
".",
"equals",
"(",
"scopeName",
")",
")",
"{",
"scope",
"=",
"PageContext",
".",
"PAGE_SCOPE",
";",
"}",
"else",
"if",
"(",
"\"request\"",
".",
"equals",
"(",
"... | Setter method for the scope of the variable to hold the
result. | [
"Setter",
"method",
"for",
"the",
"scope",
"of",
"the",
"variable",
"to",
"hold",
"the",
"result",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java#L105-L118 | train |
audit4j/audit4j-spring | src/main/java/org/audit4j/integration/spring/SpringAudit4jConfig.java | SpringAudit4jConfig.afterPropertiesSet | @Override
public void afterPropertiesSet() throws Exception {
Configuration configuration = Configuration.INSTANCE;
configuration.setLayout(layout);
configuration.setHandlers(handlers);
configuration.setFilters(filters);
configuration.setCommands(commands);
configuration.setJmx(jmx);
configuration.setProperties(properties);
if (metaData == null) {
if (actorSessionAttributeName == null) {
configuration.setMetaData(new SpringSecurityWebAuditMetaData());
} else {
configuration.setMetaData(new WebSessionAuditMetaData());
}
} else {
configuration.setMetaData(metaData);
}
if (annotationTransformer != null) {
configuration.setAnnotationTransformer(annotationTransformer);
}
AuditManager.startWithConfiguration(configuration);
} | java | @Override
public void afterPropertiesSet() throws Exception {
Configuration configuration = Configuration.INSTANCE;
configuration.setLayout(layout);
configuration.setHandlers(handlers);
configuration.setFilters(filters);
configuration.setCommands(commands);
configuration.setJmx(jmx);
configuration.setProperties(properties);
if (metaData == null) {
if (actorSessionAttributeName == null) {
configuration.setMetaData(new SpringSecurityWebAuditMetaData());
} else {
configuration.setMetaData(new WebSessionAuditMetaData());
}
} else {
configuration.setMetaData(metaData);
}
if (annotationTransformer != null) {
configuration.setAnnotationTransformer(annotationTransformer);
}
AuditManager.startWithConfiguration(configuration);
} | [
"@",
"Override",
"public",
"void",
"afterPropertiesSet",
"(",
")",
"throws",
"Exception",
"{",
"Configuration",
"configuration",
"=",
"Configuration",
".",
"INSTANCE",
";",
"configuration",
".",
"setLayout",
"(",
"layout",
")",
";",
"configuration",
".",
"setHandl... | Initialize audit4j when starting spring application context.
{@inheritDoc}
@see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() | [
"Initialize",
"audit4j",
"when",
"starting",
"spring",
"application",
"context",
"."
] | 52de1e3370608890292a72194df247b50a2d4bed | https://github.com/audit4j/audit4j-spring/blob/52de1e3370608890292a72194df247b50a2d4bed/src/main/java/org/audit4j/integration/spring/SpringAudit4jConfig.java#L77-L102 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/EscapeXML.java | EscapeXML.escape | public static String escape(String src) {
// first pass to determine the length of the buffer so we only allocate once
int length = 0;
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
length += escape.length();
} else {
length += 1;
}
}
// skip copy if no escaping is needed
if (length == src.length()) {
return src;
}
// second pass to build the escaped string
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
buf.append(escape);
} else {
buf.append(c);
}
}
return buf.toString();
} | java | public static String escape(String src) {
// first pass to determine the length of the buffer so we only allocate once
int length = 0;
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
length += escape.length();
} else {
length += 1;
}
}
// skip copy if no escaping is needed
if (length == src.length()) {
return src;
}
// second pass to build the escaped string
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
buf.append(escape);
} else {
buf.append(c);
}
}
return buf.toString();
} | [
"public",
"static",
"String",
"escape",
"(",
"String",
"src",
")",
"{",
"// first pass to determine the length of the buffer so we only allocate once",
"int",
"length",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"src",
".",
"length",
"(",
... | Escape a string.
@param src the string to escape; must not be null
@return the escaped string | [
"Escape",
"a",
"string",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/EscapeXML.java#L69-L99 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/EscapeXML.java | EscapeXML.emit | public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException {
if (src instanceof Reader) {
emit((Reader) src, escapeXml, out);
} else {
emit(String.valueOf(src), escapeXml, out);
}
} | java | public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException {
if (src instanceof Reader) {
emit((Reader) src, escapeXml, out);
} else {
emit(String.valueOf(src), escapeXml, out);
}
} | [
"public",
"static",
"void",
"emit",
"(",
"Object",
"src",
",",
"boolean",
"escapeXml",
",",
"JspWriter",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"src",
"instanceof",
"Reader",
")",
"{",
"emit",
"(",
"(",
"Reader",
")",
"src",
",",
"escapeXml... | Emit the supplied object to the specified writer, escaping characters if needed.
@param src the object to write
@param escapeXml if true, escape unsafe characters before writing
@param out the JspWriter to emit to
@throws IOException if there was a problem emitting the content | [
"Emit",
"the",
"supplied",
"object",
"to",
"the",
"specified",
"writer",
"escaping",
"characters",
"if",
"needed",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/EscapeXML.java#L109-L115 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/EscapeXML.java | EscapeXML.emit | public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException {
if (escapeXml) {
emit(src, out);
} else {
out.write(src);
}
} | java | public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException {
if (escapeXml) {
emit(src, out);
} else {
out.write(src);
}
} | [
"public",
"static",
"void",
"emit",
"(",
"String",
"src",
",",
"boolean",
"escapeXml",
",",
"JspWriter",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"escapeXml",
")",
"{",
"emit",
"(",
"src",
",",
"out",
")",
";",
"}",
"else",
"{",
"out",
".... | Emit the supplied String to the specified writer, escaping characters if needed.
@param src the String to write
@param escapeXml if true, escape unsafe characters before writing
@param out the JspWriter to emit to
@throws IOException if there was a problem emitting the content | [
"Emit",
"the",
"supplied",
"String",
"to",
"the",
"specified",
"writer",
"escaping",
"characters",
"if",
"needed",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/EscapeXML.java#L125-L131 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/util/EscapeXML.java | EscapeXML.emit | public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException {
int bufferSize = out.getBufferSize();
if (bufferSize == 0) {
bufferSize = 4096;
}
char[] buffer = new char[bufferSize];
int count;
while ((count = src.read(buffer)) > 0) {
if (escapeXml) {
emit(buffer, 0, count, out);
} else {
out.write(buffer, 0, count);
}
}
} | java | public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException {
int bufferSize = out.getBufferSize();
if (bufferSize == 0) {
bufferSize = 4096;
}
char[] buffer = new char[bufferSize];
int count;
while ((count = src.read(buffer)) > 0) {
if (escapeXml) {
emit(buffer, 0, count, out);
} else {
out.write(buffer, 0, count);
}
}
} | [
"public",
"static",
"void",
"emit",
"(",
"Reader",
"src",
",",
"boolean",
"escapeXml",
",",
"JspWriter",
"out",
")",
"throws",
"IOException",
"{",
"int",
"bufferSize",
"=",
"out",
".",
"getBufferSize",
"(",
")",
";",
"if",
"(",
"bufferSize",
"==",
"0",
"... | Copy the content of a Reader into the specified JSPWriter escaping characters if needed.
@param src the Reader to read from
@param escapeXml if true, escape characters
@param out the JspWriter to emit to
@throws IOException if there was a problem emitting the content | [
"Copy",
"the",
"content",
"of",
"a",
"Reader",
"into",
"the",
"specified",
"JSPWriter",
"escaping",
"characters",
"if",
"needed",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/EscapeXML.java#L166-L180 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java | UpdateTagSupport.addSQLParameter | public void addSQLParameter(Object o) {
if (parameters == null) {
parameters = new ArrayList();
}
parameters.add(o);
} | java | public void addSQLParameter(Object o) {
if (parameters == null) {
parameters = new ArrayList();
}
parameters.add(o);
} | [
"public",
"void",
"addSQLParameter",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"parameters",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"parameters",
".",
"add",
"(",
"o",
")",
";",
"}"
] | Called by nested parameter elements to add PreparedStatement
parameter values. | [
"Called",
"by",
"nested",
"parameter",
"elements",
"to",
"add",
"PreparedStatement",
"parameter",
"values",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java#L210-L215 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java | ComplexValue.evaluate | public Object evaluate(Object pContext,
VariableResolver pResolver,
Map functions,
String defaultPrefix,
Logger pLogger)
throws ELException {
Object ret = mPrefix.evaluate(pContext, pResolver, functions,
defaultPrefix, pLogger);
// Apply the suffixes
for (int i = 0; mSuffixes != null && i < mSuffixes.size(); i++) {
ValueSuffix suffix = (ValueSuffix) mSuffixes.get(i);
ret = suffix.evaluate(ret, pContext, pResolver, functions,
defaultPrefix, pLogger);
}
return ret;
} | java | public Object evaluate(Object pContext,
VariableResolver pResolver,
Map functions,
String defaultPrefix,
Logger pLogger)
throws ELException {
Object ret = mPrefix.evaluate(pContext, pResolver, functions,
defaultPrefix, pLogger);
// Apply the suffixes
for (int i = 0; mSuffixes != null && i < mSuffixes.size(); i++) {
ValueSuffix suffix = (ValueSuffix) mSuffixes.get(i);
ret = suffix.evaluate(ret, pContext, pResolver, functions,
defaultPrefix, pLogger);
}
return ret;
} | [
"public",
"Object",
"evaluate",
"(",
"Object",
"pContext",
",",
"VariableResolver",
"pResolver",
",",
"Map",
"functions",
",",
"String",
"defaultPrefix",
",",
"Logger",
"pLogger",
")",
"throws",
"ELException",
"{",
"Object",
"ret",
"=",
"mPrefix",
".",
"evaluate... | Evaluates by evaluating the prefix, then applying the suffixes | [
"Evaluates",
"by",
"evaluating",
"the",
"prefix",
"then",
"applying",
"the",
"suffixes"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java#L98-L115 | train |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/config/JFinalConfigExt.java | JFinalConfigExt.configInterceptor | public void configInterceptor(Interceptors me) {
// add excetion interceptor
me.add(new ExceptionInterceptor());
if (this.getHttpPostMethod()) {
me.add(new POST());
}
// config others
configMoreInterceptors(me);
} | java | public void configInterceptor(Interceptors me) {
// add excetion interceptor
me.add(new ExceptionInterceptor());
if (this.getHttpPostMethod()) {
me.add(new POST());
}
// config others
configMoreInterceptors(me);
} | [
"public",
"void",
"configInterceptor",
"(",
"Interceptors",
"me",
")",
"{",
"// add excetion interceptor",
"me",
".",
"add",
"(",
"new",
"ExceptionInterceptor",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"getHttpPostMethod",
"(",
")",
")",
"{",
"me",
".",
... | Config interceptor applied to all actions. | [
"Config",
"interceptor",
"applied",
"to",
"all",
"actions",
"."
] | 8ffcbd150fd50c72852bb778bd427b5eb19254dc | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/config/JFinalConfigExt.java#L211-L219 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java | ExprSupport.doStartTag | @Override
public int doStartTag() throws JspException {
try {
XPathContext context = XalanUtil.getContext(this, pageContext);
String result = select.execute(context, context.getCurrentNode(), null).str();
EscapeXML.emit(result, escapeXml, pageContext.getOut());
return SKIP_BODY;
} catch (IOException ex) {
throw new JspTagException(ex.toString(), ex);
} catch (TransformerException e) {
throw new JspTagException(e);
}
} | java | @Override
public int doStartTag() throws JspException {
try {
XPathContext context = XalanUtil.getContext(this, pageContext);
String result = select.execute(context, context.getCurrentNode(), null).str();
EscapeXML.emit(result, escapeXml, pageContext.getOut());
return SKIP_BODY;
} catch (IOException ex) {
throw new JspTagException(ex.toString(), ex);
} catch (TransformerException e) {
throw new JspTagException(e);
}
} | [
"@",
"Override",
"public",
"int",
"doStartTag",
"(",
")",
"throws",
"JspException",
"{",
"try",
"{",
"XPathContext",
"context",
"=",
"XalanUtil",
".",
"getContext",
"(",
"this",
",",
"pageContext",
")",
";",
"String",
"result",
"=",
"select",
".",
"execute",... | applies XPath expression from 'select' and prints the result | [
"applies",
"XPath",
"expression",
"from",
"select",
"and",
"prints",
"the",
"result"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java#L52-L64 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.getImplicitObjects | public static ImplicitObjects getImplicitObjects(PageContext pContext)
{
ImplicitObjects objs =
(ImplicitObjects)
pContext.getAttribute(sAttributeName,
PageContext.PAGE_SCOPE);
if (objs == null) {
objs = new ImplicitObjects(pContext);
pContext.setAttribute(sAttributeName,
objs,
PageContext.PAGE_SCOPE);
}
return objs;
} | java | public static ImplicitObjects getImplicitObjects(PageContext pContext)
{
ImplicitObjects objs =
(ImplicitObjects)
pContext.getAttribute(sAttributeName,
PageContext.PAGE_SCOPE);
if (objs == null) {
objs = new ImplicitObjects(pContext);
pContext.setAttribute(sAttributeName,
objs,
PageContext.PAGE_SCOPE);
}
return objs;
} | [
"public",
"static",
"ImplicitObjects",
"getImplicitObjects",
"(",
"PageContext",
"pContext",
")",
"{",
"ImplicitObjects",
"objs",
"=",
"(",
"ImplicitObjects",
")",
"pContext",
".",
"getAttribute",
"(",
"sAttributeName",
",",
"PageContext",
".",
"PAGE_SCOPE",
")",
";... | Finds the ImplicitObjects associated with the PageContext,
creating it if it doesn't yet exist. | [
"Finds",
"the",
"ImplicitObjects",
"associated",
"with",
"the",
"PageContext",
"creating",
"it",
"if",
"it",
"doesn",
"t",
"yet",
"exist",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L92-L105 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.createSessionScopeMap | public static Map createSessionScopeMap(PageContext pContext)
{
final PageContext context = pContext;
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return context.getAttributeNamesInScope
(PageContext.SESSION_SCOPE);
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return context.getAttribute
((String) pKey,
PageContext.SESSION_SCOPE);
} else {
return null;
}
}
public boolean isMutable()
{
return true;
}
};
} | java | public static Map createSessionScopeMap(PageContext pContext)
{
final PageContext context = pContext;
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return context.getAttributeNamesInScope
(PageContext.SESSION_SCOPE);
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return context.getAttribute
((String) pKey,
PageContext.SESSION_SCOPE);
} else {
return null;
}
}
public boolean isMutable()
{
return true;
}
};
} | [
"public",
"static",
"Map",
"createSessionScopeMap",
"(",
"PageContext",
"pContext",
")",
"{",
"final",
"PageContext",
"context",
"=",
"pContext",
";",
"return",
"new",
"EnumeratedMap",
"(",
")",
"{",
"public",
"Enumeration",
"enumerateKeys",
"(",
")",
"{",
"retu... | Creates the Map that "wraps" session-scoped attributes | [
"Creates",
"the",
"Map",
"that",
"wraps",
"session",
"-",
"scoped",
"attributes"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L319-L347 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.createParamMap | public static Map createParamMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getParameterNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return request.getParameter((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | java | public static Map createParamMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getParameterNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return request.getParameter((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | [
"public",
"static",
"Map",
"createParamMap",
"(",
"PageContext",
"pContext",
")",
"{",
"final",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pContext",
".",
"getRequest",
"(",
")",
";",
"return",
"new",
"EnumeratedMap",
"(",
")",
"{",
... | Creates the Map that maps parameter name to single parameter
value. | [
"Creates",
"the",
"Map",
"that",
"maps",
"parameter",
"name",
"to",
"single",
"parameter",
"value",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L390-L415 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.createHeaderMap | public static Map createHeaderMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getHeaderNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return request.getHeader((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | java | public static Map createHeaderMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getHeaderNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return request.getHeader((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | [
"public",
"static",
"Map",
"createHeaderMap",
"(",
"PageContext",
"pContext",
")",
"{",
"final",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pContext",
".",
"getRequest",
"(",
")",
";",
"return",
"new",
"EnumeratedMap",
"(",
")",
"{",
... | Creates the Map that maps header name to single header
value. | [
"Creates",
"the",
"Map",
"that",
"maps",
"header",
"name",
"to",
"single",
"header",
"value",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L457-L483 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.createHeadersMap | public static Map createHeadersMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getHeaderNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
// Drain the header enumeration
List l = new ArrayList();
Enumeration enum_ = request.getHeaders((String) pKey);
if (enum_ != null) {
while (enum_.hasMoreElements()) {
l.add(enum_.nextElement());
}
}
String[] ret = (String[]) l.toArray(new String[l.size()]);
return ret;
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | java | public static Map createHeadersMap(PageContext pContext)
{
final HttpServletRequest request =
(HttpServletRequest) pContext.getRequest();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return request.getHeaderNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
// Drain the header enumeration
List l = new ArrayList();
Enumeration enum_ = request.getHeaders((String) pKey);
if (enum_ != null) {
while (enum_.hasMoreElements()) {
l.add(enum_.nextElement());
}
}
String[] ret = (String[]) l.toArray(new String[l.size()]);
return ret;
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | [
"public",
"static",
"Map",
"createHeadersMap",
"(",
"PageContext",
"pContext",
")",
"{",
"final",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pContext",
".",
"getRequest",
"(",
")",
";",
"return",
"new",
"EnumeratedMap",
"(",
")",
"{",... | Creates the Map that maps header name to an array of header
values. | [
"Creates",
"the",
"Map",
"that",
"maps",
"header",
"name",
"to",
"an",
"array",
"of",
"header",
"values",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L491-L526 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java | ImplicitObjects.createInitParamMap | public static Map createInitParamMap(PageContext pContext)
{
final ServletContext context = pContext.getServletContext();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return context.getInitParameterNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return context.getInitParameter((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | java | public static Map createInitParamMap(PageContext pContext)
{
final ServletContext context = pContext.getServletContext();
return new EnumeratedMap()
{
public Enumeration enumerateKeys()
{
return context.getInitParameterNames();
}
public Object getValue(Object pKey)
{
if (pKey instanceof String) {
return context.getInitParameter((String) pKey);
} else {
return null;
}
}
public boolean isMutable()
{
return false;
}
};
} | [
"public",
"static",
"Map",
"createInitParamMap",
"(",
"PageContext",
"pContext",
")",
"{",
"final",
"ServletContext",
"context",
"=",
"pContext",
".",
"getServletContext",
"(",
")",
";",
"return",
"new",
"EnumeratedMap",
"(",
")",
"{",
"public",
"Enumeration",
"... | Creates the Map that maps init parameter name to single init
parameter value. | [
"Creates",
"the",
"Map",
"that",
"maps",
"init",
"parameter",
"name",
"to",
"single",
"init",
"parameter",
"value",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java#L534-L559 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java | SPathTag.doStartTag | public int doStartTag() throws JspException {
try {
SPathFilter s = new SPathFilter(new SPathParser(select).expression());
pageContext.setAttribute(var, s);
return SKIP_BODY;
} catch (ParseException ex) {
throw new JspTagException(ex.toString(), ex);
}
} | java | public int doStartTag() throws JspException {
try {
SPathFilter s = new SPathFilter(new SPathParser(select).expression());
pageContext.setAttribute(var, s);
return SKIP_BODY;
} catch (ParseException ex) {
throw new JspTagException(ex.toString(), ex);
}
} | [
"public",
"int",
"doStartTag",
"(",
")",
"throws",
"JspException",
"{",
"try",
"{",
"SPathFilter",
"s",
"=",
"new",
"SPathFilter",
"(",
"new",
"SPathParser",
"(",
"select",
")",
".",
"expression",
"(",
")",
")",
";",
"pageContext",
".",
"setAttribute",
"("... | applies XPath expression from 'select' and exposes a filter as 'var' | [
"applies",
"XPath",
"expression",
"from",
"select",
"and",
"exposes",
"a",
"filter",
"as",
"var"
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java#L102-L110 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/Step.java | Step.isMatchingName | public boolean isMatchingName(String uri, String localPart) {
// check and normalize arguments
if (localPart == null)
throw new IllegalArgumentException("need non-null localPart");
if (uri != null && uri.equals(""))
uri = null;
// split name into uri/localPart if we haven't done so already
if (this.localPart == null && this.uri == null)
parseStepName();
// generic wildcard
if (this.uri == null && this.localPart.equals("*"))
return true;
// match will null namespace
if (uri == null && this.uri == null
&& localPart.equals(this.localPart))
return true;
if (uri != null && this.uri != null && uri.equals(this.uri)) {
// exact match
if (localPart.equals(this.localPart))
return true;
// namespace-specific wildcard
if (this.localPart.equals("*"))
return true;
}
// no match
return false;
} | java | public boolean isMatchingName(String uri, String localPart) {
// check and normalize arguments
if (localPart == null)
throw new IllegalArgumentException("need non-null localPart");
if (uri != null && uri.equals(""))
uri = null;
// split name into uri/localPart if we haven't done so already
if (this.localPart == null && this.uri == null)
parseStepName();
// generic wildcard
if (this.uri == null && this.localPart.equals("*"))
return true;
// match will null namespace
if (uri == null && this.uri == null
&& localPart.equals(this.localPart))
return true;
if (uri != null && this.uri != null && uri.equals(this.uri)) {
// exact match
if (localPart.equals(this.localPart))
return true;
// namespace-specific wildcard
if (this.localPart.equals("*"))
return true;
}
// no match
return false;
} | [
"public",
"boolean",
"isMatchingName",
"(",
"String",
"uri",
",",
"String",
"localPart",
")",
"{",
"// check and normalize arguments",
"if",
"(",
"localPart",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"need non-null localPart\"",
")",
";",
... | Returns true if the given name matches the Step object's
name, taking into account the Step object's wildcards; returns
false otherwise. | [
"Returns",
"true",
"if",
"the",
"given",
"name",
"matches",
"the",
"Step",
"object",
"s",
"name",
"taking",
"into",
"account",
"the",
"Step",
"object",
"s",
"wildcards",
";",
"returns",
"false",
"otherwise",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java#L98-L130 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/extra/spath/Step.java | Step.parseStepName | private void parseStepName() {
String prefix;
int colonIndex = name.indexOf(":");
if (colonIndex == -1) {
// no colon, so localpart is simply name (even if it's "*")
prefix = null;
localPart = name;
} else {
prefix = name.substring(0, colonIndex);
localPart = name.substring(colonIndex + 1);
}
uri = mapPrefix(prefix);
} | java | private void parseStepName() {
String prefix;
int colonIndex = name.indexOf(":");
if (colonIndex == -1) {
// no colon, so localpart is simply name (even if it's "*")
prefix = null;
localPart = name;
} else {
prefix = name.substring(0, colonIndex);
localPart = name.substring(colonIndex + 1);
}
uri = mapPrefix(prefix);
} | [
"private",
"void",
"parseStepName",
"(",
")",
"{",
"String",
"prefix",
";",
"int",
"colonIndex",
"=",
"name",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"if",
"(",
"colonIndex",
"==",
"-",
"1",
")",
"{",
"// no colon, so localpart is simply name (even if it's \"*\"... | Lazily computes some information about our name. | [
"Lazily",
"computes",
"some",
"information",
"about",
"our",
"name",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java#L148-L162 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/XalanUtil.java | XalanUtil.getContext | public static XPathContext getContext(Tag child, PageContext pageContext) {
// if within a forEach tag, use its context
ForEachTag forEachTag = (ForEachTag) TagSupport.findAncestorWithClass(child, ForEachTag.class);
if (forEachTag != null) {
return forEachTag.getContext();
}
// otherwise, create a new context referring to an empty document
XPathContext context = new XPathContext(false);
VariableStack variableStack = new JSTLVariableStack(pageContext);
context.setVarStack(variableStack);
int dtm = context.getDTMHandleFromNode(XmlUtil.newEmptyDocument());
context.pushCurrentNodeAndExpression(dtm, dtm);
return context;
} | java | public static XPathContext getContext(Tag child, PageContext pageContext) {
// if within a forEach tag, use its context
ForEachTag forEachTag = (ForEachTag) TagSupport.findAncestorWithClass(child, ForEachTag.class);
if (forEachTag != null) {
return forEachTag.getContext();
}
// otherwise, create a new context referring to an empty document
XPathContext context = new XPathContext(false);
VariableStack variableStack = new JSTLVariableStack(pageContext);
context.setVarStack(variableStack);
int dtm = context.getDTMHandleFromNode(XmlUtil.newEmptyDocument());
context.pushCurrentNodeAndExpression(dtm, dtm);
return context;
} | [
"public",
"static",
"XPathContext",
"getContext",
"(",
"Tag",
"child",
",",
"PageContext",
"pageContext",
")",
"{",
"// if within a forEach tag, use its context",
"ForEachTag",
"forEachTag",
"=",
"(",
"ForEachTag",
")",
"TagSupport",
".",
"findAncestorWithClass",
"(",
"... | Return the XPathContext to be used for evaluating expressions.
If the child is nested withing a forEach tag its iteration context is used.
Otherwise, a new context is created based on an empty Document.
@param child the tag whose context should be returned
@param pageContext the current page context
@return the XPath evaluation context | [
"Return",
"the",
"XPathContext",
"to",
"be",
"used",
"for",
"evaluating",
"expressions",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/XalanUtil.java#L47-L61 | train |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/XalanUtil.java | XalanUtil.coerceToJava | static Object coerceToJava(XObject xo) throws TransformerException {
if (xo instanceof XBoolean) {
return xo.bool();
} else if (xo instanceof XNumber) {
return xo.num();
} else if (xo instanceof XString) {
return xo.str();
} else if (xo instanceof XNodeSet) {
NodeList nodes = xo.nodelist();
// if there is only one node in the nodeset return it rather than the list
if (nodes.getLength() == 1) {
return nodes.item(0);
} else {
return nodes;
}
} else {
// unexpected result type
throw new AssertionError();
}
} | java | static Object coerceToJava(XObject xo) throws TransformerException {
if (xo instanceof XBoolean) {
return xo.bool();
} else if (xo instanceof XNumber) {
return xo.num();
} else if (xo instanceof XString) {
return xo.str();
} else if (xo instanceof XNodeSet) {
NodeList nodes = xo.nodelist();
// if there is only one node in the nodeset return it rather than the list
if (nodes.getLength() == 1) {
return nodes.item(0);
} else {
return nodes;
}
} else {
// unexpected result type
throw new AssertionError();
}
} | [
"static",
"Object",
"coerceToJava",
"(",
"XObject",
"xo",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"xo",
"instanceof",
"XBoolean",
")",
"{",
"return",
"xo",
".",
"bool",
"(",
")",
";",
"}",
"else",
"if",
"(",
"xo",
"instanceof",
"XNumber",
... | Return the Java value corresponding to an XPath result.
@param xo the XPath type
@return the corresponding Java value per the JSTL mapping rules
@throws TransformerException if there was a problem converting the type | [
"Return",
"the",
"Java",
"value",
"corresponding",
"to",
"an",
"XPath",
"result",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/XalanUtil.java#L70-L89 | train |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/core/LoopTagSupport.java | LoopTagSupport.doStartTag | @Override
public int doStartTag() throws JspException {
if (end != -1 && begin > end) {
// JSTL 1.1. We simply do not execute the loop.
return SKIP_BODY;
}
// we're beginning a new iteration, so reset our counts (etc.)
index = 0;
count = 1;
last = false;
// let the subclass conduct any necessary preparation
prepare();
// throw away the first 'begin' items (if they exist)
discardIgnoreSubset(begin);
// get the item we're interested in
if (hasNext())
// index is 0-based, so we don't update it for the first item
{
item = next();
} else {
return SKIP_BODY;
}
/*
* now discard anything we have to "step" over.
* (we do this in advance to support LoopTagStatus.isLast())
*/
discard(step - 1);
// prepare to include our body...
exposeVariables();
calibrateLast();
return EVAL_BODY_INCLUDE;
} | java | @Override
public int doStartTag() throws JspException {
if (end != -1 && begin > end) {
// JSTL 1.1. We simply do not execute the loop.
return SKIP_BODY;
}
// we're beginning a new iteration, so reset our counts (etc.)
index = 0;
count = 1;
last = false;
// let the subclass conduct any necessary preparation
prepare();
// throw away the first 'begin' items (if they exist)
discardIgnoreSubset(begin);
// get the item we're interested in
if (hasNext())
// index is 0-based, so we don't update it for the first item
{
item = next();
} else {
return SKIP_BODY;
}
/*
* now discard anything we have to "step" over.
* (we do this in advance to support LoopTagStatus.isLast())
*/
discard(step - 1);
// prepare to include our body...
exposeVariables();
calibrateLast();
return EVAL_BODY_INCLUDE;
} | [
"@",
"Override",
"public",
"int",
"doStartTag",
"(",
")",
"throws",
"JspException",
"{",
"if",
"(",
"end",
"!=",
"-",
"1",
"&&",
"begin",
">",
"end",
")",
"{",
"// JSTL 1.1. We simply do not execute the loop.",
"return",
"SKIP_BODY",
";",
"}",
"// we're beginnin... | Begins iterating by processing the first item. | [
"Begins",
"iterating",
"by",
"processing",
"the",
"first",
"item",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/core/LoopTagSupport.java#L228-L265 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.