Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2015 Sierra Wireless and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v1.0 which accompany this distribution. The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.html. Contributors: Sierra Wireless - initial API and implementation /
 
 package org.eclipse.leshan.server.client;
 
 import java.util.Date;
 
A container object for updating a LW-M2M client's registration properties on the server.
 
 public class ClientUpdate {
 
     private final String registrationId;
 
     private final InetAddress address;
     private final Integer port;
 
     private final Long lifeTimeInSec;
     private final String smsNumber;
     private final BindingMode bindingMode;
     private final LinkObject[] objectLinks;
 
     public ClientUpdate(String registrationIdInetAddress addressInteger portLong lifeTimeInSecString smsNumber,
             BindingMode bindingModeLinkObject[] objectLinks) {
         Validate.notNull(registrationId);
         this. = registrationId;
         this. = address;
         this. = port;
         this. = lifeTimeInSec;
         this. = smsNumber;
         this. = bindingMode;
         this. = objectLinks;
     }

    
Returns an updated version of the client.

Parameters:
client the registered client
Returns:
the updated client
 
     public Client updateClient(Client client) {
         InetAddress address = this. != null ? this. : client.getAddress();
         int port = this. != null ? this. : client.getPort();
         LinkObject[] linkObject = this. != null ? this. : client.getObjectLinks();
         long lifeTimeInSec = this. != null ? this. : client.getLifeTimeInSec();
         BindingMode bindingMode = this. != null ? this. : client.getBindingMode();
         String smsNumber = this. != null ? this. : client.getSmsNumber();
 
         // this needs to be done in any case, even if no properties have changed, in order
         // to extend the client registration's time-to-live period ...
         Date lastUpdate = new Date();
 
         return new Client(client.getRegistrationId(), client.getEndpoint(), addressportclient.getLwM2mVersion(),
                 lifeTimeInSecsmsNumberbindingModelinkObjectclient.getRegistrationEndpointAddress(),
                 client.getRegistrationDate(), lastUpdate);
     }
 
     public String getRegistrationId() {
         return ;
     }
 
     public InetAddress getAddress() {
         return ;
     }
 
     public Integer getPort() {
         return ;
     }
 
     public Long getLifeTimeInSec() {
         return ;
     }
 
     public String getSmsNumber() {
         return ;
     }
 
     public BindingMode getBindingMode() {
         return ;
     }
 
     public LinkObject[] getObjectLinks() {
        return ;
    }
New to GrepCode? Check out our FAQ X