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

net.cassite.daf4j.resource.Resource Maven / Gradle / Ivy

The newest version!
package net.cassite.daf4j.resource;

import net.cassite.daf4j.Data;
import net.cassite.daf4j.DataUtils;
import net.cassite.daf4j.Id;
import net.cassite.daf4j.types.*;

import java.util.Date;
import java.util.List;

/**
 * entity of resource
 */
public class Resource {
        static final String LOCATION = "location";
        static final String LENGTH = "length";
        static final String CREATINGTIME = "creatingTime";
        static final String LASTMODIFIEDTIME = "lastModifiedTime";
        static final String SUBLOCATIONS = "subLocations";
        static final String BUFFER = "buffer";
        /**
         * location of the resource
         */
        public final XString location = new XString(this);
        /**
         * resource length in byte
         */
        public final XLong length = new XLong(this);
        /**
         * creating time
         */
        public final XDate creatingTime = new XDate(this);
        /**
         * last modified time
         */
        public final XDate lastModifiedTime = new XDate(this);
        /**
         * child locations
         */
        public final XList subLocations = new XList(null, this);
        /**
         * buffer of input stream
         */
        public final Data buffer = new Data(this);

        @Id
        public String getLocation() {
                return location.get();
        }

        public Resource setLocation(String location) {
                DataUtils.set(this.location, location);
                return this;
        }

        public Long getLength() {
                return length.get();
        }

        public Resource setLength(Long length) {
                DataUtils.set(this.length, length);
                return this;
        }

        public Date getCreatingTime() {
                return creatingTime.get();
        }

        public Resource setCreatingTime(Date creatingTime) {
                DataUtils.set(this.creatingTime, creatingTime);
                return this;
        }

        public Date getLastModifiedTime() {
                return lastModifiedTime.get();
        }

        public Resource setLastModifiedTime(Date lastModifiedTime) {
                DataUtils.set(this.lastModifiedTime, lastModifiedTime);
                return this;
        }

        public List getSubLocations() {
                return subLocations.get();
        }

        public Resource setSubLocations(List subLocations) {
                DataUtils.set(this.subLocations, subLocations);
                return this;
        }

        /**
         * get buffer from the resource
         *
         * @return buffer from the resource
         */
        public Buffer getBuffer() {
                return buffer.get();
        }

        /**
         * set buffer for the resource
         *
         * @param buffer buffer to set
         * @return resource itself
         */
        public Resource setBuffer(Buffer buffer) {
                DataUtils.set(this.buffer, buffer);
                return this;
        }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy