mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
Merge in v4 code changes
This commit is contained in:
commit
96e4b4640f
171 files changed
+2747
-3848
No files matched your search
@@ -284,7 +284,7 @@ public class TCsvReader<T> implements CsvReader<T> {
|
||||
}
|
||||
}
|
||||
|
||||
protected void convertAndSetColumn(int columnPos, String strValue, Object bean) {
|
||||
protected void convertAndSetColumn(int columnPos, String strValue, EntityBean bean) {
|
||||
|
||||
strValue = strValue.trim();
|
||||
|
||||
@@ -329,7 +329,7 @@ public class TCsvReader<T> implements CsvReader<T> {
|
||||
/**
|
||||
* Convert the string to the appropriate value and set it to the bean.
|
||||
*/
|
||||
public void convertAndSet(String strValue, Object bean) {
|
||||
public void convertAndSet(String strValue, EntityBean bean) {
|
||||
|
||||
if (!ignore) {
|
||||
Object value = parser.parse(strValue);
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonContext;
|
||||
import com.avaje.ebean.text.json.JsonElement;
|
||||
@@ -217,10 +218,11 @@ public class DJsonContext implements JsonContext {
|
||||
} else {
|
||||
BeanDescriptor<?> d = getDecriptor(o.getClass());
|
||||
WriteJsonContext ctx = new WriteJsonContext(buffer, pretty, dfltValueAdapter, options, requestCallback, server);
|
||||
d.jsonWrite(ctx, o);
|
||||
d.jsonWrite(ctx, (EntityBean)o);
|
||||
ctx.end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private <T> void toJsonFromCollection(Collection<T> c, WriteJsonBuffer buffer, boolean pretty, JsonWriteOptions options, String requestCallback){
|
||||
|
||||
@@ -236,11 +238,11 @@ public class DJsonContext implements JsonContext {
|
||||
BeanDescriptor<?> d = getDecriptor(o.getClass());
|
||||
|
||||
ctx.appendArrayBegin();
|
||||
d.jsonWrite(ctx, o);
|
||||
d.jsonWrite(ctx, (EntityBean)o);
|
||||
while (it.hasNext()) {
|
||||
ctx.appendComma();
|
||||
T t = it.next();
|
||||
d.jsonWrite(ctx, t);
|
||||
d.jsonWrite(ctx, (EntityBean)t);
|
||||
}
|
||||
ctx.appendArrayEnd();
|
||||
ctx.end();
|
||||
|
||||
@@ -358,45 +358,18 @@ public class WriteJsonContext implements JsonWriter {
|
||||
return beanState.isReferenceBean();
|
||||
}
|
||||
|
||||
public boolean includedProp(String name) {
|
||||
return beanState.includedProp(name);
|
||||
}
|
||||
|
||||
public Set<String> getLoadedProps() {
|
||||
return beanState.getLoadedProps();
|
||||
}
|
||||
|
||||
|
||||
public static class WriteBeanState {
|
||||
|
||||
private final EntityBeanIntercept ebi;
|
||||
private final Set<String> loadedProps;
|
||||
private final boolean referenceBean;
|
||||
private boolean firstKeyOut;
|
||||
|
||||
public WriteBeanState(Object bean) {
|
||||
if (bean instanceof EntityBean){
|
||||
this.ebi = ((EntityBean)bean)._ebean_getIntercept();
|
||||
this.loadedProps = ebi.getLoadedProps();
|
||||
this.referenceBean = ebi.isReference();
|
||||
} else {
|
||||
this.ebi = null;
|
||||
this.loadedProps = null;
|
||||
this.referenceBean = false;
|
||||
}
|
||||
}
|
||||
this.ebi = ((EntityBean)bean)._ebean_getIntercept();
|
||||
this.referenceBean = ebi.isReference();
|
||||
}
|
||||
|
||||
public Set<String> getLoadedProps() {
|
||||
return loadedProps;
|
||||
}
|
||||
|
||||
public boolean includedProp(String name) {
|
||||
if (loadedProps == null || loadedProps.contains(name)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isReferenceBean() {
|
||||
return referenceBean;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user