Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.eclipse.store.storage.restadapter.types;
/*-
* #%L
* EclipseStore Storage REST Adapter
* %%
* Copyright (C) 2023 MicroStream Software
* %%
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
* #L%
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Create a ViewerObjectDescription from the complex ObjectDescription type.
*
*/
public class ViewerObjectDescriptionCreator
{
private final ObjectDescription description;
private final int fixedOffset;
private final int fixedLength;
private final int variableOffset;
private final int variableLength;
private final int valueLength;
private ViewerObjectDescription objDesc;
///////////////////////////////////////////////////////////////////////////
// constructors //
/////////////////
public ViewerObjectDescriptionCreator(
final ObjectDescription description,
final long fixedOffset,
final long fixedLength,
final long variableOffset,
final long variableLength,
final long valueLength)
{
super();
this.description = description;
this.fixedOffset = (int)Math.min(Integer.MAX_VALUE, fixedOffset);
this.fixedLength = (int)Math.min(Integer.MAX_VALUE, fixedLength);
this.variableOffset = (int)Math.min(Integer.MAX_VALUE, variableOffset);
this.variableLength = (int)Math.min(Integer.MAX_VALUE, variableLength);
this.valueLength = (int)Math.min(Integer.MAX_VALUE, valueLength);
}
///////////////////////////////////////////////////////////////////////////
// methods //
////////////
/**
* Create a ViewerObjectDescription Object
*
* @return ViewerObjectDescription
*/
public ViewerObjectDescription create()
{
this.objDesc = new ViewerObjectDescription();
this.setObjectHeader();
this.gatherMemberValues();
this.setReferences();
return this.objDesc;
}
/**
*
* Collect all MemberValues and add them to the new ViewerObjectDescription.
*
*/
private void gatherMemberValues()
{
if(this.description.hasPrimitiveObjectInstance())
{
setPrimitiveValue(this.description, this.objDesc, this.valueLength);
}
else
{
final Object[] members = this.description.getValues();
final List