All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nstream.reflect.MetaStore Maven / Gradle / Ivy

The newest version!
// Copyright 2015-2024 Nstream, inc.
//
// Licensed under the Redis Source Available License 2.0 (RSALv2) Agreement;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://redis.com/legal/rsalv2-agreement/
//
// 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 nstream.reflect;

import nstream.reflect.agent.MetaCellAgent;
import swim.store.ListDataBinding;
import swim.store.MapDataBinding;
import swim.store.SpatialDataBinding;
import swim.store.StoreBinding;
import swim.store.StoreProxy;
import swim.store.ValueDataBinding;

public class MetaStore extends StoreProxy {
  final MetaCell parent;

  public MetaStore(MetaCell parent, StoreBinding storeBinding) {
    super(storeBinding);
    this.parent = parent;
  }

  public final MetaCell metaParent() {
    return this.parent;
  }

  public final MetaCellAgent metaAgent() {
    return this.parent.metaAgent();
  }

  @Override
  public ListDataBinding injectListData(ListDataBinding dataBinding) {
    if (dataBinding.unwrapData(MetaListData.class) == null) {
      dataBinding = new MetaListData(this, dataBinding);
    }
    return super.injectListData(dataBinding);
  }

  @Override
  public MapDataBinding injectMapData(MapDataBinding dataBinding) {
    if (dataBinding.unwrapData(MetaMapData.class) == null) {
      dataBinding = new MetaMapData(this, dataBinding);
    }
    return super.injectMapData(dataBinding);
  }

  @Override
  public  SpatialDataBinding injectSpatialData(SpatialDataBinding dataBinding) {
    if (dataBinding.unwrapData(MetaSpatialData.class) == null) {
      dataBinding = new MetaSpatialData(this, dataBinding);
    }
    return super.injectSpatialData(dataBinding);
  }

  @Override
  public ValueDataBinding injectValueData(ValueDataBinding dataBinding) {
    if (dataBinding.unwrapData(MetaValueData.class) == null) {
      dataBinding = new MetaValueData(this, dataBinding);
    }
    return super.injectValueData(dataBinding);
  }
}