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

com.bugvm.apple.foundation.NSFileAttributes Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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 com.bugvm.apple.foundation;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.uikit.*;
import com.bugvm.apple.coretext.*;
import com.bugvm.apple.coreanimation.*;
import com.bugvm.apple.coredata.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.security.*;
import com.bugvm.apple.dispatch.*;
/**/

/**/
/**/
/**/@Library("Foundation")/**/
@Marshaler(/**/NSFileAttributes/**/.Marshaler.class)
/**/public/**/ class /**/NSFileAttributes/**/ 
    extends /**/NSDictionaryWrapper/**/
    /**//**/ {

    /**/
    public static class Marshaler {
        @MarshalsPointer
        public static NSFileAttributes toObject(Class cls, long handle, long flags) {
            NSDictionary o = (NSDictionary) NSObject.Marshaler.toObject(NSDictionary.class, handle, flags);
            if (o == null) {
                return null;
            }
            return new NSFileAttributes(o);
        }
        @MarshalsPointer
        public static long toNative(NSFileAttributes o, long flags) {
            if (o == null) {
                return 0L;
            }
            return NSObject.Marshaler.toNative(o.data, flags);
        }
    }
    public static class AsListMarshaler {
        @MarshalsPointer
        public static List toObject(Class cls, long handle, long flags) {
            NSArray o = (NSArray) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
            if (o == null) {
                return null;
            }
            List list = new ArrayList<>();
            for (int i = 0; i < o.size(); i++) {
                list.add(new NSFileAttributes(o.get(i)));
            }
            return list;
        }
        @MarshalsPointer
        public static long toNative(List l, long flags) {
            if (l == null) {
                return 0L;
            }
            NSArray array = new NSMutableArray<>();
            for (NSFileAttributes i : l) {
                array.add(i.getDictionary());
            }
            return NSObject.Marshaler.toNative(array, flags);
        }
    }
    /**/

    /**/
    NSFileAttributes(NSDictionary data) {
        super(data);
    }
    public NSFileAttributes() {}
    /**/

    /**/
    public boolean has(NSFileAttribute key) {
        return data.containsKey(key.value());
    }
    public NSObject get(NSFileAttribute key) {
        if (has(key)) {
            return data.get(key.value());
        }
        return null;
    }
    public NSFileAttributes set(NSFileAttribute key, NSObject value) {
        data.put(key.value(), value);
        return this;
    }
    

    public NSFileType getType() {
        if (has(NSFileAttribute.Type)) {
            NSString val = (NSString) get(NSFileAttribute.Type);
            return NSFileType.valueOf(val);
        }
        return null;
    }
    public NSFileAttributes setType(NSFileType type) {
        set(NSFileAttribute.Type, type.value());
        return this;
    }
    public long getSize() {
        if (has(NSFileAttribute.Size)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.Size);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setSize(long size) {
        set(NSFileAttribute.Size, NSNumber.valueOf(size));
        return this;
    }
    public NSDate getModificationDate() {
        if (has(NSFileAttribute.ModificationDate)) {
            NSDate val = (NSDate) get(NSFileAttribute.ModificationDate);
            return val;
        }
        return null;
    }
    public NSFileAttributes setModificationDate(NSDate modificationDate) {
        set(NSFileAttribute.ModificationDate, modificationDate);
        return this;
    }
    public long getReferenceCount() {
        if (has(NSFileAttribute.ReferenceCount)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.ReferenceCount);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setReferenceCount(long referenceCount) {
        set(NSFileAttribute.ReferenceCount, NSNumber.valueOf(referenceCount));
        return this;
    }
    public long getDeviceIdentifier() {
        if (has(NSFileAttribute.DeviceIdentifier)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.DeviceIdentifier);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setDeviceIdentifier(long deviceIdentifier) {
        set(NSFileAttribute.DeviceIdentifier, NSNumber.valueOf(deviceIdentifier));
        return this;
    }
    public String getOwnerAccountName() {
        if (has(NSFileAttribute.OwnerAccountName)) {
            NSString val = (NSString) get(NSFileAttribute.OwnerAccountName);
            return val.toString();
        }
        return null;
    }
    public NSFileAttributes setOwnerAccountName(String ownerAccountName) {
        set(NSFileAttribute.OwnerAccountName, new NSString(ownerAccountName));
        return this;
    }
    public String getGroupOwnerAccountName() {
        if (has(NSFileAttribute.GroupOwnerAccountName)) {
            NSString val = (NSString) get(NSFileAttribute.GroupOwnerAccountName);
            return val.toString();
        }
        return null;
    }
    public NSFileAttributes setGroupOwnerAccountName(String groupOwnerAccountName) {
        set(NSFileAttribute.GroupOwnerAccountName, new NSString(groupOwnerAccountName));
        return this;
    }
    public short getPosixPermissions() {
        if (has(NSFileAttribute.PosixPermissions)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.PosixPermissions);
            return val.shortValue();
        }
        return 0;
    }
    public NSFileAttributes setPosixPermissions(short posixPermissions) {
        set(NSFileAttribute.PosixPermissions, NSNumber.valueOf(posixPermissions));
        return this;
    }
    public long getSystemFileNumber() {
        if (has(NSFileAttribute.SystemFileNumber)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.SystemFileNumber);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setSystemFileNumber(long systemFileNumber) {
        set(NSFileAttribute.SystemFileNumber, NSNumber.valueOf(systemFileNumber));
        return this;
    }
    public boolean isExtensionHidden() {
        if (has(NSFileAttribute.ExtensionHidden)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.ExtensionHidden);
            return val.booleanValue();
        }
        return false;
    }
    public NSFileAttributes setExtensionHidden(boolean extensionHidden) {
        set(NSFileAttribute.ExtensionHidden, NSNumber.valueOf(extensionHidden));
        return this;
    }
    public long getHFSCreatorCode() {
        if (has(NSFileAttribute.HFSCreatorCode)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.HFSCreatorCode);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setHFSCreatorCode(long hFSCreatorCode) {
        set(NSFileAttribute.HFSCreatorCode, NSNumber.valueOf(hFSCreatorCode));
        return this;
    }
    public long getHFSTypeCode() {
        if (has(NSFileAttribute.HFSTypeCode)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.HFSTypeCode);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setHFSTypeCode(long hFSTypeCode) {
        set(NSFileAttribute.HFSTypeCode, NSNumber.valueOf(hFSTypeCode));
        return this;
    }
    public boolean isImmutable() {
        if (has(NSFileAttribute.Immutable)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.Immutable);
            return val.booleanValue();
        }
        return false;
    }
    public NSFileAttributes setImmutable(boolean immutable) {
        set(NSFileAttribute.Immutable, NSNumber.valueOf(immutable));
        return this;
    }
    public boolean appendsOnly() {
        if (has(NSFileAttribute.AppendOnly)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.AppendOnly);
            return val.booleanValue();
        }
        return false;
    }
    public NSFileAttributes setAppendsOnly(boolean appendsOnly) {
        set(NSFileAttribute.AppendOnly, NSNumber.valueOf(appendsOnly));
        return this;
    }
    public NSDate getCreationDate() {
        if (has(NSFileAttribute.CreationDate)) {
            NSDate val = (NSDate) get(NSFileAttribute.CreationDate);
            return val;
        }
        return null;
    }
    public NSFileAttributes setCreationDate(NSDate creationDate) {
        set(NSFileAttribute.CreationDate, creationDate);
        return this;
    }
    public long getOwnerAccountID() {
        if (has(NSFileAttribute.OwnerAccountID)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.OwnerAccountID);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setOwnerAccountID(long ownerAccountID) {
        set(NSFileAttribute.OwnerAccountID, NSNumber.valueOf(ownerAccountID));
        return this;
    }
    public long getGroupOwnerAccountID() {
        if (has(NSFileAttribute.GroupOwnerAccountID)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.GroupOwnerAccountID);
            return val.longValue();
        }
        return 0;
    }
    public NSFileAttributes setGroupOwnerAccountID(long groupOwnerAccountID) {
        set(NSFileAttribute.GroupOwnerAccountID, NSNumber.valueOf(groupOwnerAccountID));
        return this;
    }
    public boolean isBusy() {
        if (has(NSFileAttribute.Busy)) {
            NSNumber val = (NSNumber) get(NSFileAttribute.Busy);
            return val.booleanValue();
        }
        return false;
    }
    public NSFileAttributes setBusy(boolean busy) {
        set(NSFileAttribute.Busy, NSNumber.valueOf(busy));
        return this;
    }
    /**
     * @since Available in iOS 4.0 and later.
     */
    public NSFileProtection getProtection() {
        if (has(NSFileAttribute.ProtectionKey)) {
            NSString val = (NSString) get(NSFileAttribute.ProtectionKey);
            return NSFileProtection.valueOf(val);
        }
        return null;
    }
    /**
     * @since Available in iOS 4.0 and later.
     */
    public NSFileAttributes setProtection(NSFileProtection protection) {
        set(NSFileAttribute.ProtectionKey, protection.value());
        return this;
    }
    /**/
    
    /**/
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy