001/*
002 * Copyright 2013 Box, Inc. All rights reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.nuxeo.box.api.marshalling.dao;
017
018import com.fasterxml.jackson.annotation.JsonProperty;
019
020import java.util.ArrayList;
021import java.util.Map;
022
023public class BoxCollectionBase extends BoxObject {
024
025    public static final String FIELD_ENTRIES = "entries";
026
027    public BoxCollectionBase() {
028    }
029
030    /**
031     * Copy constructor, this does deep copy for all the fields.
032     *
033     * @param obj
034     */
035    public BoxCollectionBase(BoxCollectionBase obj) {
036        super(obj);
037    }
038
039    /**
040     * Instantiate the object from a map. Each entry in the map reflects to a field.
041     *
042     * @param map
043     */
044    public BoxCollectionBase(Map<String, Object> map) {
045        super(map);
046    }
047
048    /**
049     * @return the entries
050     */
051    @SuppressWarnings("unchecked")
052    @JsonProperty("entries")
053    public ArrayList<BoxTypedObject> getEntries() {
054        return (ArrayList<BoxTypedObject>) super.getValue(FIELD_ENTRIES);
055    }
056
057    /**
058     * @param entries the entries to set
059     */
060    @JsonProperty("entries")
061    private void setEntries(ArrayList<BoxTypedObject> entries) {
062        put(FIELD_ENTRIES, entries);
063    }
064
065}