Examples of RawObject


Examples of com.sleepycat.persist.raw.RawObject

    @Override
    public Object newInstance(EntityInput input, boolean rawAccess) {
        int len = input.readArrayLength();
        if (rawAccess) {
            return new RawObject(this, new Object[len]);
        } else {
            return useComponentFormat.newArray(len);
        }
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

    public Object newInstance(EntityInput input, boolean rawAccess)
        throws RefreshException {

        int len = input.readArrayLength();
        if (rawAccess) {
            return new RawObject(this, new Object[len]);
        } else {
            return componentFormat.newPrimitiveArray(len, input);
        }
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

        if (addr != null) {
            Object oldVal = rawAccessor.getField
                (entity, addr.fieldNum, addr.superLevel, addr.isSecField);
            if (oldVal != null) {
                if (keyElement != null) {
                    RawObject container = (RawObject) oldVal;
                    Object[] a1 = container.getElements();
                    boolean isArray = (a1 != null);
                    if (!isArray) {
                        a1 = CollectionProxy.getElements(container);
                    }
                    if (a1 != null) {
                        for (int i = 0; i < a1.length; i += 1) {
                            if (keyElement.equals(a1[i])) {
                                int len = a1.length - 1;
                                Object[] a2 = new Object[len];
                                System.arraycopy(a1, 0, a2, 0, i);
                                System.arraycopy(a1, i + 1, a2, i, len - i);
                                if (isArray) {
                                    rawAccessor.setField
                                        (entity, addr.fieldNum,
                                         addr.superLevel, addr.isSecField,
                                         new RawObject
                                            (container.getType(), a2));
                                } else {
                                    CollectionProxy.setElements(container, a2);
                                }
                                return true;
                            }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

        secKeyFields = Collections.emptyList();
        isCompositeKey = true;
    }

    public Object newInstance() {
        RawObject superObject;
        if (superAccessor != null) {
            superObject = ((RawObject) superAccessor.newInstance());
        } else {
            superObject = null;
        }
        return new RawObject
            (parentFormat, new HashMap<String, Object>(), superObject);
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

    @Override
    public Object newInstance(EntityInput input, boolean rawAccess) {
        int index = input.readEnumConstant(names);
        if (rawAccess) {
            return new RawObject(this, names[index]);
        } else {
            return values[index];
        }
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

    @Override
    Object readNext()
        throws RefreshException {

        RawObject raw = objects[index];
        FieldInfo field = fields[index];
        index += 1;
        Format format = field.getType();
        Object o = raw.getValues().get(field.getName());
        return checkAndConvert(o, format);
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

                                              DatabaseEntry data,
                                              DatabaseEntry secKey)
        throws RefreshException {

        /* Deserialize the entity and get its current class format. */
        RawObject entity = (RawObject) PersistEntityBinding.readEntity
            (catalog, key, null, data, true /*rawAccess*/);
        Format entityFormat = (Format) entity.getType();

        /*
         * Set the key to null.  For a TO_MANY key, pass the key object to be
         * removed from the array/collection.
         */
 
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

        if (value == null || !(value instanceof RawObject)) {
            throw new IllegalStateException
                ("Collection proxy for a secondary key field must " +
                 "contain a field named 'elements'");
        }
        RawObject rawObj = (RawObject) value;
        Format format = (Format) rawObj.getType();
        if (!format.isArray() ||
            format.getComponentType().getId() != Format.ID_OBJECT) {
            throw new IllegalStateException
                ("Collection proxy 'elements' field must be an Object array");
        }
        return rawObj.getElements();
    }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

        }
        return rawObj.getElements();
    }

    static void setElements(RawObject collection, Object[] elements) {
        RawObject value = null;
        while (value == null && collection != null) {
            Map<String, Object> values = collection.getValues();
            if (values != null) {
                value = (RawObject) values.get("elements");
                if (value != null) {
                    values.put("elements",
                               new RawObject(value.getType(), elements));
                } else {
                    collection = collection.getSuper();
                }
            }
        }
View Full Code Here

Examples of com.sleepycat.persist.raw.RawObject

        /*
         * This could be optimized by traversing the byte format of the
         * collection's elements array.
         */
        RawObject collection = (RawObject) format.newInstance(input, true);
        collection = (RawObject) format.readObject(collection, input, true);
        Object[] elements = getElements(collection);
        if (elements != null) {
            for (Object elem : elements) {
                RecordOutput output =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.