Search in sources :

Example 1 with StringType

use of weborb.reader.StringType in project Android-SDK by Backendless.

the class BackendlessFileFactory method createObject.

public Object createObject(IAdaptingType argument) {
    if (argument instanceof NamedObject)
        argument = ((NamedObject) argument).getTypedObject();
    if (argument.getClass().getName().equals("weborb.reader.NullType"))
        return null;
    ReferenceCache refCache = ReferenceCache.getInstance();
    if (refCache.hasObject(argument, BackendlessFile.class)) {
        return refCache.getObject(argument, BackendlessFile.class);
    } else {
        if (argument instanceof StringType) {
            StringType stringType = (StringType) argument;
            BackendlessFile file;
            if (Backendless.isAndroid())
                file = new BackendlessFileAndroid(stringType.getValue());
            else
                file = new BackendlessFile(stringType.getValue());
            refCache.addObject(argument, BackendlessFile.class, file);
            return file;
        } else
            throw new RuntimeException("unknown type");
    }
}
Also used : ReferenceCache(weborb.reader.ReferenceCache) StringType(weborb.reader.StringType) NamedObject(weborb.reader.NamedObject)

Example 2 with StringType

use of weborb.reader.StringType in project Android-SDK by Backendless.

the class AdaptingResponder method adaptFault.

public static BackendlessFault adaptFault(AnonymousObject bodyHolder) {
    final StringType faultMessage = (StringType) bodyHolder.getProperties().get("faultString");
    final StringType faultDetail = (StringType) bodyHolder.getProperties().get("faultDetail");
    final StringType faultCode = (StringType) bodyHolder.getProperties().get("faultCode");
    final AnonymousObject extendedData = (AnonymousObject) bodyHolder.getProperties().get("extendedData");
    return new BackendlessFault(new Fault((String) faultMessage.defaultAdapt(), (String) faultDetail.defaultAdapt(), (String) faultCode.defaultAdapt()), (Map<String, Object>) extendedData.defaultAdapt());
}
Also used : AnonymousObject(weborb.reader.AnonymousObject) StringType(weborb.reader.StringType) BackendlessFault(com.backendless.exceptions.BackendlessFault) Fault(weborb.client.Fault) NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Aggregations

NamedObject (weborb.reader.NamedObject)2 StringType (weborb.reader.StringType)2 BackendlessFault (com.backendless.exceptions.BackendlessFault)1 Fault (weborb.client.Fault)1 AnonymousObject (weborb.reader.AnonymousObject)1 ReferenceCache (weborb.reader.ReferenceCache)1