提交 84f36725 编写于 作者: S Serge Rider

#6949 DB collection enhancement (extend standard List to allow serialization)

上级 a56fb9d1
...@@ -20,13 +20,15 @@ package org.jkiss.dbeaver.model.data; ...@@ -20,13 +20,15 @@ package org.jkiss.dbeaver.model.data;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.struct.DBSDataType; import org.jkiss.dbeaver.model.struct.DBSDataType;
import java.util.List;
/** /**
* Collection of items. * Collection of items.
* Item index is zero-based. * Item index is zero-based.
* *
* @author Serge Rider * @author Serge Rider
*/ */
public interface DBDCollection extends DBDComplexValue { public interface DBDCollection extends DBDComplexValue, List {
@NotNull @NotNull
DBSDataType getComponentType(); DBSDataType getComponentType();
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.model.impl.data;
import org.jkiss.dbeaver.model.data.DBDCollection;
import java.util.AbstractList;
/**
* AbstractDatabaseList
*
* @author Serge Rider
*/
public abstract class AbstractDatabaseList extends AbstractList implements DBDCollection {
@Override
public Object get(int index) {
return getItem(index);
}
@Override
public int size() {
return getItemCount();
}
}
...@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.model.DBUtils; ...@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.data.*; import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.exec.*; import org.jkiss.dbeaver.model.exec.*;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession; import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.data.AbstractDatabaseList;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCArrayImpl; import org.jkiss.dbeaver.model.impl.jdbc.JDBCArrayImpl;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource; import org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource;
import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCColumnMetaData; import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCColumnMetaData;
...@@ -48,7 +49,7 @@ import java.util.StringTokenizer; ...@@ -48,7 +49,7 @@ import java.util.StringTokenizer;
/** /**
* Array holder * Array holder
*/ */
public class JDBCCollection implements DBDCollection, DBDValueCloneable { public class JDBCCollection extends AbstractDatabaseList implements DBDValueCloneable {
private static final Log log = Log.getLog(JDBCCollection.class); private static final Log log = Log.getLog(JDBCCollection.class);
...@@ -433,4 +434,17 @@ public class JDBCCollection implements DBDCollection, DBDValueCloneable { ...@@ -433,4 +434,17 @@ public class JDBCCollection implements DBDCollection, DBDValueCloneable {
return new JDBCCollectionString(dataType, valueHandler, value); return new JDBCCollectionString(dataType, valueHandler, value);
} }
//////////////////////////////////////////
// List implementation
@Override
public int size() {
return getItemCount();
}
@Override
public Object get(int index) {
return getItem(index);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册