本文整理汇总了Java中com.jfinal.plugin.activerecord.Record.set方法的典型用法代码示例。如果您正苦于以下问题:Java Record.set方法的具体用法?Java Record.set怎么用?Java Record.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.plugin.activerecord.Record
的用法示例。
在下文中一共展示了Record.set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: format
import com.jfinal.plugin.activerecord.Record; //导入方法依赖的package包/类
public static void format(List<Record> sheet, Object... params)
{
if (params.length % 2 != 0) throw new RuntimeException("参数个数有误");
for (int x = 0; x < sheet.size(); x++)
{
try
{
Record t = sheet.get(x);
for (int i = 0; i < params.length; i += 2)
{
String field = (String)params[i];
Formattable fmt = (Formattable)params[i + 1];
t.set("fmt_" + field, fmt.format(t.get(field)));
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
示例2: join
import com.jfinal.plugin.activerecord.Record; //导入方法依赖的package包/类
public static void join(List<Record> list, Object... params)
{
if (params.length % 3 != 0) throw new RuntimeException("参数个数有误");
for (int x = 0; x < list.size(); x++)
{
Record t = list.get(x);
try
{
for (int i = 0; i < params.length; i += 3)
{
String refField = (String)params[i];
String newName = (String)params[i + 1];
Formattable fmt = (Formattable)params[i + 2];
t.set(newName, fmt.format(t.get(refField)));
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
示例3: combine
import com.jfinal.plugin.activerecord.Record; //导入方法依赖的package包/类
public static void combine(List<Record> list, Object... fields)
{
if (fields.length < 3) throw new RuntimeException("combine方法至少需要4个参数");
if (!(fields[fields.length - 1] instanceof Formattable)) throw new RuntimeException("最后一个参数必须是Formattable实例");
Formattable fmt = (Formattable)fields[fields.length - 1];
for (int i = 0; i < list.size(); i++)
{
Record rc = list.get(i);
HashMap<String, Object> pairs = new HashMap<String, Object>();
for (int k = 0, s = 0, l = fields.length - 2; k < l; k++)
{
pairs.put((String)fields[k], rc.get((String)fields[k]));
}
Object val = fmt.combine(pairs);
rc.set((String)fields[fields.length - 2], val);
}
}
示例4: toRecord
import com.jfinal.plugin.activerecord.Record; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Record toRecord(Model model) {
Record record = new Record();
Set<Entry<String, Object>> attrs = model._getAttrsEntrySet();
for (Entry<String, Object> entry : attrs) {
record.set(entry.getKey(), entry.getValue());
}
return record;
}
示例5: set
import com.jfinal.plugin.activerecord.Record; //导入方法依赖的package包/类
@Override
public void set(Record bean, Object property, Object value) {
bean.set(property.toString(), value);
}