com.bugvm.apple.addressbook.ABGroup 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.annotation.*;
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 /**/ABGroup/* */
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((ABGroup)NativeObject.Marshaler.toObject(ABGroup.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 (ABGroup i : l) {
array.add(i);
}
return CFType.Marshaler.toNative(array, flags);
}
}
/**/
/* */
/**/static { Bro.bind(ABGroup.class); }/* */
/**//* */
/**//* */
/**//* */
/**//* */
public String getName() {
CFString val = getValue(ABGroupProperty.Name, CFString.class);
if (val != null) return val.toString();
return null;
}
public ABGroup setName(String name) throws NSErrorException {
if (name == null) {
setValue(ABGroupProperty.Name, null);
} else {
setValue(ABGroupProperty.Name, new CFString(name));
}
return this;
}
/**/
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupCreate", optional=true)
public static native @com.bugvm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABGroup create();
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupCreateInSource", optional=true)
public static native @com.bugvm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABGroup create(ABSource source);
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupCopySource", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABSource getSource();
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupCopyArrayOfAllMembers", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(ABPerson.AsListMarshaler.class) List getAllMembers();
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupCopyArrayOfAllMembersWithSortOrdering", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(ABPerson.AsListMarshaler.class) List getAllMembers(ABPersonSortOrdering sortOrdering);
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
public boolean addMember(ABPerson person) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = addMember(person, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupAddMember", optional=true)
private native boolean addMember(ABPerson person, NSError.NSErrorPtr error);
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
public boolean removeMember(ABPerson member) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = removeMember(member, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**
* @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 9.0.
*/
@Deprecated
@Bridge(symbol="ABGroupRemoveMember", optional=true)
private native boolean removeMember(ABPerson member, NSError.NSErrorPtr error);
/* */
}