This commit is contained in:
Redkale
2017-02-23 15:29:04 +08:00
parent bf355cce28
commit 3bd880b061
7 changed files with 15 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ package org.redkale.convert.bson;
import java.nio.*;
import java.util.function.*;
import org.redkale.util.Utility;
/**
*
@@ -77,21 +78,14 @@ public class BsonByteBufferWriter extends BsonWriter {
ByteBuffer buffer = this.buffers[index];
if (!buffer.hasRemaining()) {
buffer.flip();
buffer = supplier.get();
ByteBuffer[] bufs = new ByteBuffer[this.buffers.length + 1];
System.arraycopy(this.buffers, 0, bufs, 0, this.buffers.length);
bufs[this.buffers.length] = buffer;
this.buffers = bufs;
buffer = supplier.get();
this.buffers = Utility.append(this.buffers, buffer);
this.index++;
}
int len = buffer.remaining();
int size = 0;
while (len < byteLength) {
buffer = supplier.get();
ByteBuffer[] bufs = new ByteBuffer[this.buffers.length + 1];
System.arraycopy(this.buffers, 0, bufs, 0, this.buffers.length);
bufs[this.buffers.length] = buffer;
this.buffers = bufs;
this.buffers = Utility.append(this.buffers, buffer);
len += buffer.remaining();
size++;
}

View File

@@ -84,20 +84,14 @@ public class JsonByteBufferWriter extends JsonWriter {
if (!buffer.hasRemaining()) {
buffer.flip();
buffer = supplier.get();
ByteBuffer[] bufs = new ByteBuffer[this.buffers.length + 1];
System.arraycopy(this.buffers, 0, bufs, 0, this.buffers.length);
bufs[this.buffers.length] = buffer;
this.buffers = bufs;
this.buffers = Utility.append(this.buffers, buffer);
this.index++;
}
int len = buffer.remaining();
int size = 0;
while (len < byteLength) {
buffer = supplier.get();
ByteBuffer[] bufs = new ByteBuffer[this.buffers.length + 1];
System.arraycopy(this.buffers, 0, bufs, 0, this.buffers.length);
bufs[this.buffers.length] = buffer;
this.buffers = bufs;
this.buffers = Utility.append(this.buffers, buffer);
len += buffer.remaining();
size++;
}

View File

@@ -10,7 +10,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.*;
import static org.redkale.source.FilterExpress.EQUAL;
import org.redkale.util.Attribute;
import org.redkale.util.*;
/**
*
@@ -94,10 +94,7 @@ public class FilterJoinNode extends FilterNode {
return this;
}
if (or == signor || this.column == null) {
FilterNode[] newsiblings = new FilterNode[nodes.length + 1];
System.arraycopy(nodes, 0, newsiblings, 0, nodes.length);
newsiblings[nodes.length] = node;
this.nodes = newsiblings;
this.nodes = Utility.append(this.nodes, node);
if (this.column == null) this.or = signor;
return this;
}

View File

@@ -10,7 +10,7 @@ import java.lang.reflect.Array;
import java.util.*;
import java.util.function.*;
import static org.redkale.source.FilterExpress.*;
import org.redkale.util.Attribute;
import org.redkale.util.*;
/**
* 注意: <br>
@@ -150,10 +150,7 @@ public class FilterNode { //FilterNode 不能实现Serializable接口 否则
return this;
}
if (or == signor) {
FilterNode[] newsiblings = new FilterNode[nodes.length + 1];
System.arraycopy(nodes, 0, newsiblings, 0, nodes.length);
newsiblings[nodes.length] = node;
this.nodes = newsiblings;
this.nodes = Utility.append(this.nodes, node);
return this;
}
FilterNode newnode = new FilterNode(this.column, this.express, this.itemand, this.value);

View File

@@ -11,7 +11,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import javax.persistence.Transient;
import static org.redkale.source.FilterExpress.*;
import org.redkale.util.Attribute;
import org.redkale.util.*;
/**
*
@@ -117,10 +117,7 @@ public final class FilterNodeBean<T extends FilterBean> implements Comparable<Fi
return this;
}
if (or == signor) {
FilterNodeBean[] newsiblings = new FilterNodeBean[nodeBeans.length + 1];
System.arraycopy(nodeBeans, 0, newsiblings, 0, nodeBeans.length);
newsiblings[nodeBeans.length] = node;
this.nodeBeans = newsiblings;
this.nodeBeans = Utility.append(this.nodeBeans, node);
return this;
}
this.nodeBeans = new FilterNodeBean[]{new FilterNodeBean(this), node};

View File

@@ -264,22 +264,13 @@ public abstract class AnyValue {
}
public DefaultAnyValue addValue(String name, String value) {
if (name == null) return this;
int len = this.stringValues.length;
Entry[] news = new Entry[len + 1];
System.arraycopy(this.stringValues, 0, news, 0, len);
news[len] = new Entry(name, value);
this.stringValues = news;
this.stringValues = Utility.append(this.stringValues, new Entry(name, value));
return this;
}
public DefaultAnyValue addValue(String name, AnyValue value) {
if (name == null || value == null) return this;
int len = this.entityValues.length;
Entry[] news = new Entry[len + 1];
System.arraycopy(this.entityValues, 0, news, 0, len);
news[len] = new Entry(name, value);
this.entityValues = news;
this.entityValues = Utility.append(this.entityValues, new Entry(name, value));
return this;
}

View File

@@ -20,7 +20,7 @@ import org.redkale.util.Sheet;
*
*/
@RestService(name = "hello", moduleid = 0, repair = true, ignore = false, comment = "Hello服务模块")
public class HelloService2 implements Service {
public class HelloService2 implements Service {
@Resource
private DataSource source;