org.jsimpledb.parse.expr.JSimpleFieldValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-parse Show documentation
Show all versions of jsimpledb-parse Show documentation
JSimpleDB classes for parsing Java expressions.
The newest version!
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.parse.expr;
import org.jsimpledb.JObject;
import org.jsimpledb.JSimpleField;
import org.jsimpledb.parse.ParseSession;
/**
* {@link Value} that reflects a {@link JSimpleField} in some {@link JObject}.
*/
public class JSimpleFieldValue extends JFieldValue implements LValue {
/**
* Constructor.
*
* @param jobj database object
* @param jfield database field
* @throws IllegalArgumentException if {@code jobj} is null
* @throws IllegalArgumentException if {@code jfield} is null
*/
public JSimpleFieldValue(JObject jobj, JSimpleField jfield) {
super(jobj, jfield);
}
@Override
public void set(ParseSession session, Value value) {
final Object obj = value.get(session);
try {
((JSimpleField)this.jfield).setValue(MethodUtil.refresh(this.jobj), obj);
} catch (IllegalArgumentException e) {
throw new EvalException("invalid " + AbstractValue.describeType(obj) + " for field `" + this.jfield.getName() + "'"
+ (e.getMessage() != null ? ": " + e.getMessage() : ""), e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy