本文整理了Java中org.jooq.Record.field
方法的一些代码示例,展示了Record.field
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.field
方法的具体详情如下:
包路径:org.jooq.Record
类名称:Record
方法名:field
[英]Get a specific field from this Record.
[中]从该记录中获取特定字段。
代码示例来源:origin: org.jooq/jooq
@Override
public final Field<T> field(Record record) {
return record.field(this);
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
@SuppressWarnings("unchecked")
private <E> E getOrNull(Record r, String fieldName) {
Field<?> field = r.field(fieldName);
if (field == null) {
return null;
}
return (E) r.get(field);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* This method was implemented with [#799]. It may be useful to make it
* public for broader use...?
*/
protected final void from(Record source) {
for (Field<?> field : fields.fields.fields) {
Field<?> sourceField = source.field(field);
if (sourceField != null) {
Utils.setValue(this, field, source, sourceField);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Turn a {@link Record} into a {@link Map}
*/
static final Map<Field<?>, Object> map(Record record) {
Map<Field<?>, Object> result = new LinkedHashMap<Field<?>, Object>();
int size = record.size();
for (int i = 0; i < size; i++) {
result.put(record.field(i), record.getValue(i));
}
return result;
}
代码示例来源:origin: org.jooq/jooq
/**
* This method was implemented with [#799]. It may be useful to make it
* public for broader use...?
*/
protected final void from(Record source) {
for (Field<?> field : fields.fields.fields) {
Field<?> sourceField = source.field(field);
if (sourceField != null && source.changed(sourceField))
Tools.setValue(this, field, source, sourceField);
}
}
代码示例来源:origin: org.jooq/jooq
/**
* Turn a {@link Record} into a {@link Map}
*/
static final Map<Field<?>, Object> mapOfChangedValues(Record record) {
Map<Field<?>, Object> result = new LinkedHashMap<Field<?>, Object>();
int size = record.size();
for (int i = 0; i < size; i++)
if (record.changed(i))
result.put(record.field(i), record.get(i));
return result;
}
代码示例来源:origin: org.jooq/jooq
/**
* Create a PostgreSQL string representation of a record.
*/
public static String toPGString(Record r) {
StringBuilder sb = new StringBuilder();
sb.append("(");
String separator = "";
for (int i = 0; i < r.size(); i++) {
@SuppressWarnings({ "unchecked", "rawtypes" })
Object a = ((Converter) r.field(i).getConverter()).to(r.get(i));
sb.append(separator);
// [#753] null must not be set as a literal
if (a != null) {
if (a instanceof byte[])
sb.append(toPGString((byte[]) a));
else
sb.append("\"")
.append(StringUtils.replace(StringUtils.replace(toPGString(a), "\\", "\\\\"), "\"", "\\\""))
.append("\"");
}
separator = ",";
}
sb.append(")");
return sb.toString();
}
代码示例来源:origin: org.jooq/jooq
static final void formatJSONMap0(Record record, Fields<?> fields, JSONFormat format, int recordLevel, Writer writer) throws java.io.IOException {
String separator = "";
if (format.format())
writer.append(format.indentString(recordLevel)).append('{');
else
writer.append('{');
for (int index = 0; index < fields.fields.length; index++) {
writer.append(separator);
if (format.format())
writer.append(format.newline()).append(format.indentString(recordLevel + 1));
JSONValue.writeJSONString(record.field(index).getName(), writer);
writer.append(':');
if (format.format())
writer.append(' ');
formatJSON0(record.get(index), writer);
separator = ",";
}
if (format.format())
writer.append(format.newline()).append(format.indentString(recordLevel));
writer.append('}');
}
代码示例来源:origin: org.jooq/jooq
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final void setRecord(R record) {
for (int i = 0; i < record.size(); i++)
if (record.changed(i))
addValue((Field) record.field(i), record.get(i));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final void setRecord(R record) {
for (int i = 0; i < record.size(); i++) {
if (record.changed(i)) {
addValue((Field) record.field(i), record.getValue(i));
}
}
}
代码示例来源:origin: org.jooq/jooq
/**
* [#2700] [#3582] If a POJO attribute is NULL, but the column is NOT NULL
* then we should let the database apply DEFAULT values
*/
static final void resetChangedOnNotNull(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null)
if (!record.field(i).getDataType().nullable())
record.changed(i, false);
}
代码示例来源:origin: StubbornJava/StubbornJava
/**
* [#2700] [#3582] If a POJO attribute is NULL, but the column is NOT NULL
* then we should let the database apply DEFAULT values
*/
private static final void resetChangedOnNotNull(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null)
if (!record.field(i).getDataType().nullable())
record.changed(i, false);
}
}
代码示例来源:origin: org.jooq/jooq
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void accept(Context<?> ctx) {
ConditionProviderImpl condition = new ConditionProviderImpl();
int size = record.size();
for (int i = 0; i < size; i++) {
Object value = record.get(i);
if (value != null) {
Field f1 = record.field(i);
Field f2 = DSL.val(value, f1.getDataType());
condition.addConditions(f1.eq(f2));
}
}
ctx.visit(condition);
}
}
代码示例来源:origin: io.github.jklingsporn/vertx-jooq-shared
/**
* Defaults fields that have a default value and are nullable.
* @param record the record
* @return the record
*/
private Record setDefault(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null) {
@SuppressWarnings("unchecked")
Field<Object> field = (Field<Object>) record.field(i);
if (!field.getDataType().nullable() && !field.getDataType().identity())
record.set(field, DSL.defaultValue());
}
return record;
}
代码示例来源:origin: jklingsporn/vertx-jooq
/**
* Defaults fields that have a default value and are nullable.
* @param record the record
* @return the record
*/
private Record setDefault(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null) {
@SuppressWarnings("unchecked")
Field<Object> field = (Field<Object>) record.field(i);
if (!field.getDataType().nullable() && !field.getDataType().identity())
record.set(field, DSL.defaultValue());
}
return record;
}
内容来源于网络,如有侵权,请联系作者删除!