
com.bugvm.apple.addressbook.ABSource Maven / Gradle / Ivy
/*
* 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.addressbook;
/**/
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.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.corefoundation.*;
/* */
/**/
/* */
/**/@Library("AddressBook")/* */
/**/public/* */ class /**/ABSource/* */
extends /**/ABRecord/* */
/**//* */ {
public static class AsListMarshaler {
@MarshalsPointer
public static List toObject(Class extends CFType> cls, long handle, long flags) {
CFArray o = (CFArray) CFType.Marshaler.toObject(CFArray.class, handle, flags);
if (o == null) {
return null;
}
List list = new ArrayList<>();
for (long i = 0, n = o.size(); i < n; i++) {
ABRecord record = o.get(i, ABRecord.class);
list.add((ABSource)NativeObject.Marshaler.toObject(ABSource.class, record.getHandle(), flags));
}
return list;
}
@MarshalsPointer
public static long toNative(List l, long flags) {
if (l == null) {
return 0L;
}
CFArray array = CFMutableArray.create();
for (ABSource i : l) {
array.add(i);
}
return CFType.Marshaler.toNative(array, flags);
}
}
/**/
/* */
/**/static { Bro.bind(ABGroup.class); }/* */
/**//* */
/**//* */
/**//* */
/**//* */
public String getName() {
CFString val = getValue(ABSourceProperty.Name, CFString.class);
if (val != null) return val.toString();
return null;
}
public ABSource setName(String name) throws NSErrorException {
if (name == null) {
setValue(ABSourceProperty.Name, null);
} else {
setValue(ABSourceProperty.Name, new CFString(name));
}
return this;
}
public ABSourceType getType() {
CFNumber val = getValue(ABSourceProperty.Type, CFNumber.class);
if (val != null) return new ABSourceType(val.intValue());
return null;
}
public ABSource setType(ABSourceType type) throws NSErrorException {
if (type == null) {
setValue(ABSourceProperty.Type, null);
} else {
setValue(ABSourceProperty.Type, CFNumber.valueOf((int)type.value()));
}
return this;
}
/**/
/* */
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy