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

com.backendless.core.responder.policy.UniversalAdaptingPolicy Maven / Gradle / Ivy

The newest version!
package com.backendless.core.responder.policy;

import weborb.client.IResponder;
import weborb.exceptions.AdaptingException;
import weborb.reader.ArrayType;
import weborb.types.IAdaptingType;

/**********************************************************************************************************************
 * BACKENDLESS.COM CONFIDENTIAL
 * 

* ********************************************************************************************************************* *

* Copyright 2012 BACKENDLESS.COM. All Rights Reserved. *

* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers, * if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its * suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret * or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from Backendless.com. *

* CREATED ON: 8/15/17 * AT: 4:39 PM **********************************************************************************************************************/ public class UniversalAdaptingPolicy implements IAdaptingPolicy { private final IAdaptingPolicy collectionAdaptingPolicy; private final IAdaptingPolicy pojoAdaptingPolicy; public UniversalAdaptingPolicy() { collectionAdaptingPolicy = new CollectionAdaptingPolicy<>(); pojoAdaptingPolicy = new PoJoAdaptingPolicy<>(); } @Override public Object adapt( Class clazz, IAdaptingType entity, IResponder nextResponder ) throws AdaptingException { if( entity instanceof ArrayType ) return collectionAdaptingPolicy.adapt( clazz, entity, nextResponder ); else return pojoAdaptingPolicy.adapt( clazz, entity, nextResponder ); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy