Skip to content

Commit

Permalink
incorporated review comments [it's -> its, don't hide workaround null…
Browse files Browse the repository at this point in the history
…able primtives when server is expected to return non-nullables]
  • Loading branch information
anuchandy committed Jun 20, 2016
1 parent 90865da commit 41f0437
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.List;

/**
* The implementation for {@link AvailabilitySet} and it's create and update interfaces.
* The implementation for {@link AvailabilitySet} and its create and update interfaces.
*/
class AvailabilitySetImpl
extends
Expand All @@ -43,12 +43,12 @@ class AvailabilitySetImpl

@Override
public int updateDomainCount() {
return Utils.toPrimitiveInt(this.inner().platformUpdateDomainCount());
return this.inner().platformUpdateDomainCount();
}

@Override
public int faultDomainCount() {
return Utils.toPrimitiveInt(this.inner().platformFaultDomainCount());
return this.inner().platformFaultDomainCount();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
import com.microsoft.azure.management.compute.implementation.api.DiskCreateOptionTypes;
import com.microsoft.azure.management.compute.implementation.api.VirtualHardDisk;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ChildResourceImpl;
import com.microsoft.azure.management.resources.fluentcore.utils.Utils;
import com.microsoft.azure.management.storage.StorageAccount;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
* The implementation for {@link DataDisk} and it's create and update interfaces.
* The implementation for {@link DataDisk} and its create and update interfaces.
*/
class DataDiskImpl
extends ChildResourceImpl<com.microsoft.azure.management.compute.implementation.api.DataDisk, VirtualMachine>
Expand Down Expand Up @@ -67,7 +66,7 @@ public String name() {

@Override
public int size() {
return Utils.toPrimitiveInt(this.inner().diskSizeGB());
return this.inner().diskSizeGB();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.io.IOException;

/**
* The implementation for {@link VirtualMachineImagePublishers}.
* The implementation for {@link Offers}.
*/
class OffersImpl
extends ReadableWrappersImpl<Offer, OfferImpl, VirtualMachineImageResourceInner>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import java.util.UUID;

/**
* The implementation for {@link VirtualMachine} and it's create and update interfaces.
* The implementation for {@link VirtualMachine} and its create and update interfaces.
*/
class VirtualMachineImpl
extends GroupableResourceImpl<VirtualMachine, VirtualMachineInner, VirtualMachineImpl>
Expand Down Expand Up @@ -732,7 +732,12 @@ public CachingTypes osDiskCachingType() {

@Override
public int osDiskSize() {
return Utils.toPrimitiveInt(inner().storageProfile().osDisk().diskSizeGB());
if (inner().storageProfile().osDisk().diskSizeGB() == null) {
// Server returns OS disk size as 0 for auto-created disks for which
// size was not explicitly set by the user.
return 0;
}
return inner().storageProfile().osDisk().diskSizeGB();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.microsoft.azure.management.compute.VirtualMachineSize;
import com.microsoft.azure.management.compute.implementation.api.VirtualMachineSizeInner;
import com.microsoft.azure.management.resources.fluentcore.utils.Utils;

/**
* The implementation for {@link VirtualMachineSize}.
Expand All @@ -26,26 +25,26 @@ public String name() {

@Override
public int numberOfCores() {
return Utils.toPrimitiveInt(innerModel.numberOfCores());
return innerModel.numberOfCores();
}

@Override
public int osDiskSizeInMB() {
return Utils.toPrimitiveInt(innerModel.osDiskSizeInMB());
return innerModel.osDiskSizeInMB();
}

@Override
public int resourceDiskSizeInMB() {
return Utils.toPrimitiveInt(innerModel.resourceDiskSizeInMB());
return innerModel.resourceDiskSizeInMB();
}

@Override
public int memoryInMB() {
return Utils.toPrimitiveInt(innerModel.memoryInMB());
return innerModel.memoryInMB();
}

@Override
public int maxDataDiskCount() {
return Utils.toPrimitiveInt(innerModel.maxDataDiskCount());
return innerModel.maxDataDiskCount();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Map.Entry;

/**
* Implementation for {@link Network} and it's create and update interfaces.
* Implementation for {@link Network} and its create and update interfaces.
*/
class NetworkImpl
extends GroupableResourceImpl<Network, VirtualNetworkInner, NetworkImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.List;

/**
* Implementation for {@link NetworkInterface} and it's create and update interfaces.
* Implementation for {@link NetworkInterface} and its create and update interfaces.
*/
class NetworkInterfaceImpl
extends GroupableResourceImpl<NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.List;

/**
* Implementation for {@link NetworkSecurityGroup} and it's create and update interfaces.
* Implementation for {@link NetworkSecurityGroup} and its create and update interfaces.
*/
class NetworkSecurityGroupImpl
extends GroupableResourceImpl<NetworkSecurityGroup, NetworkSecurityGroupInner, NetworkSecurityGroupImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.microsoft.azure.management.resources.fluentcore.utils.Utils;

/**
* Implementation for {@link NetworkSecurityRule} and it's create and update interfaces.
* Implementation for {@link NetworkSecurityRule} and its create and update interfaces.
*/
class NetworkSecurityRuleImpl
extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl>
Expand Down Expand Up @@ -68,7 +68,7 @@ public String destinationPortRange() {

@Override
public int priority() {
return Utils.toPrimitiveInt(this.inner().priority());
return this.inner().priority();
}

// Fluent setters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.List;

/**
* Implementation for {@link NicIpConfiguration} and it's create and update interfaces.
* Implementation for {@link NicIpConfiguration} and its create and update interfaces.
*/
class NicIpConfigurationImpl
extends ChildResourceImpl<NetworkInterfaceIPConfiguration, NetworkInterfaceImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.microsoft.rest.ServiceResponse;

/**
* Implementation for {@link PublicIpAddress} and it's create and update interfaces.
* Implementation for {@link PublicIpAddress} and its create and update interfaces.
*/
class PublicIpAddressImpl
extends GroupableResourceImpl<PublicIpAddress, PublicIPAddressInner, PublicIpAddressImpl>
Expand Down Expand Up @@ -105,7 +105,7 @@ public PublicIpAddressImpl withoutReverseFqdn() {

@Override
public int idleTimeoutInMinutes() {
return Utils.toPrimitiveInt(this.inner().idleTimeoutInMinutes());
return this.inner().idleTimeoutInMinutes();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ChildResourceImpl;

/**
* Implementation for {@link Subnet} and it's create and update interfaces.
* Implementation for {@link Subnet} and its create and update interfaces.
*/
class SubnetImpl
extends ChildResourceImpl<SubnetInner, NetworkImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ public static boolean toPrimitiveBoolean(Boolean value) {
return value;
}

/**
* Converts an object integer to a primitive int.
*
* @param value the <tt>Integer</tt> value
* @return 0 if the given Integer value is null else the primitive value
*/
public static int toPrimitiveInt(Integer value) {
if (value == null) {
return 0;
}
return value;
}

/**
* Creates a void callback from a callback that returns another type of
* instance. This is useful for internal async handoffs where returned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.List;

/**
* The implementation of {@link Deployment} and it's nested interfaces.
* The implementation of {@link Deployment} and its nested interfaces.
*/
final class DeploymentImpl extends
CreatableUpdatableImpl<Deployment, DeploymentExtendedInner, DeploymentImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.microsoft.rest.ServiceCallback;

/**
* The implementation for {@link GenericResource} and it's nested interfaces.
* The implementation for {@link GenericResource} and its nested interfaces.
*/
final class GenericResourceImpl
extends GroupableResourceImpl<GenericResource, GenericResourceInner, GenericResourceImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.Map;

/**
* The implementation for {@link ResourceGroup} and it's create and update interfaces.
* The implementation for {@link ResourceGroup} and its create and update interfaces.
*/
class ResourceGroupImpl extends
CreatableUpdatableImpl<ResourceGroup, ResourceGroupInner, ResourceGroupImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;

/**
* The implementation for {@link ResourceGroups} and it's parent interfaces.
* The implementation for {@link ResourceGroups} and its parent interfaces.
*/
final class ResourceGroupsImpl
extends CreatableWrappersImpl<ResourceGroup, ResourceGroupImpl, ResourceGroupInner>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.microsoft.azure.management.storage.implementation;

import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl;
import com.microsoft.azure.management.resources.fluentcore.utils.Utils;
import com.microsoft.azure.management.storage.Usage;
import com.microsoft.azure.management.storage.implementation.api.UsageName;
import com.microsoft.azure.management.storage.implementation.api.UsageUnit;
Expand All @@ -21,12 +20,12 @@ public UsageUnit unit() {

@Override
public int currentValue() {
return Utils.toPrimitiveInt(inner().currentValue());
return inner().currentValue();
}

@Override
public int limit() {
return Utils.toPrimitiveInt(inner().limit());
return inner().limit();
}

@Override
Expand Down

0 comments on commit 41f0437

Please sign in to comment.