Alachisoft.NCache.Common.DataReader.RecordColumn Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-common Show documentation
Show all versions of nc-common Show documentation
Internal package of Alachisoft.
package Alachisoft.NCache.Common.DataReader;
import Alachisoft.NCache.Common.Common;
import Alachisoft.NCache.Common.DataStructures.ColumnDataType;
import Alachisoft.NCache.Common.DataStructures.ColumnType;
import Alachisoft.NCache.Common.Enum.AggregateFunctionType;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;
import java.io.IOException;
// Copyright (c) 2020 Alachisoft
//
// 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
public class RecordColumn implements InternalCompactSerializable {
/**
* Gets or sets a flag for indicating that this column is projected by the user.
*/
private boolean isUserSpecifiedColumn;
private String _columnName;
private ColumnType _columnType;
private ColumnDataType _dataType;
private AggregateFunctionType _aggregateFunctionType;
private boolean _isFilled;
private boolean _isHidden;
/**
* Initializes a new RecordColumn with specified column name.
*
* @param name Name of column
*/
public RecordColumn(String name) {
_columnName = name;
_isFilled = true;
}
public boolean isUserSpecifiedColumn() {
return isUserSpecifiedColumn;
}
public void setUserSpecifiedColumn(boolean userSpecifiedColumn) {
isUserSpecifiedColumn = userSpecifiedColumn;
}
/**
* Gets or sets name of column.
*/
public final String getColumnName() {
return _columnName;
}
public final void setColumnName(String value) {
_columnName = value;
}
/**
* Gets or sets flag indicating whether or no current column is a hidden column.
*/
public final boolean getIsHidden() {
return _isHidden;
}
public final void setIsHidden(boolean value) {
_isHidden = value;
}
/**
* Gets or sets of column.
*/
public final ColumnType getColumnType() {
return _columnType;
}
public final void setColumnType(ColumnType value) {
_columnType = value;
}
/**
* Gets or sets of column.
*/
public final ColumnDataType getDataType() {
return _dataType;
}
public final void setDataType(ColumnDataType value) {
_dataType = value;
}
/**
* Gets or sets of column.
*/
public final AggregateFunctionType getAggregateFunctionType() {
return _aggregateFunctionType;
}
public final void setAggregateFunctionType(AggregateFunctionType value) {
_aggregateFunctionType = value;
}
/**
* Gets or sets flag indicating whether or not this column is filled with data.
*/
public final boolean getIsFilled() {
return _isFilled;
}
public final void setIsFilled(boolean value) {
_isFilled = value;
}
@Override
public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
_columnName = Common.as(reader.ReadObject(), String.class);
_columnType = Common.as(reader.ReadInt32(), ColumnType.class);
_dataType = Common.as(reader.ReadInt32(), ColumnDataType.class);
_aggregateFunctionType = Common.as(reader.ReadInt32(), AggregateFunctionType.class);
_isFilled = reader.ReadBoolean();
_isHidden = reader.ReadBoolean();
isUserSpecifiedColumn = reader.ReadBoolean();
}
@Override
public void Serialize(CompactWriter writer) throws IOException {
writer.WriteObject(_columnName);
writer.Write(_columnType.getValue());
writer.Write(_dataType.getValue());
writer.Write(_aggregateFunctionType.getValue());
writer.Write(_isFilled);
writer.Write(_isHidden);
writer.Write(isUserSpecifiedColumn);
}
}