Make constants final classes instead of interfaces

This commit prohibits implementation of the empty interface and
instantiation of the class.  Refer to _Effective Java_ item 19 for
more background.
This commit is contained in:
Andrew Gaul 2014-05-16 09:25:41 -07:00
parent 94459ba6e3
commit 70cf3e1f7c
27 changed files with 121 additions and 34 deletions

View File

@ -20,11 +20,14 @@ package org.jclouds.cloudsigma.reference;
*
* @author Adrian Cole
*/
public class CloudSigmaConstants {
public final class CloudSigmaConstants {
/**
* default VNC password used on new machines
*/
public static final String PROPERTY_VNC_PASSWORD = "jclouds.cloudsigma.vnc-password";
private CloudSigmaConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface AutoScalingConstants {
public final class AutoScalingConstants {
public static class Dimension {
@ -43,4 +43,7 @@ public interface AutoScalingConstants {
}
private AutoScalingConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface DynamoDBConstants {
public final class DynamoDBConstants {
public static class Dimension {
@ -44,4 +44,7 @@ public interface DynamoDBConstants {
}
private DynamoDBConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface EBSConstants {
public final class EBSConstants {
public static class Dimension {
@ -44,4 +44,7 @@ public interface EBSConstants {
}
private EBSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface EC2Constants {
public final class EC2Constants {
public static class Dimension {
@ -46,4 +46,7 @@ public interface EC2Constants {
}
private EC2Constants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface ELBConstants {
public final class ELBConstants {
public static class Dimension {
@ -47,4 +47,7 @@ public interface ELBConstants {
}
private ELBConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface EMRConstants {
public final class EMRConstants {
public static class Dimension {
@ -60,4 +60,7 @@ public interface EMRConstants {
}
private EMRConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface RDSConstants {
public final class RDSConstants {
public static class Dimension {
@ -51,4 +51,7 @@ public interface RDSConstants {
}
private RDSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface SNSConstants {
public final class SNSConstants {
public static class Dimension {
@ -40,4 +40,7 @@ public interface SNSConstants {
}
private SNSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface SQSConstants {
public final class SQSConstants {
public static class Dimension {
@ -44,4 +44,7 @@ public interface SQSConstants {
}
private SQSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ package org.jclouds.cloudwatch.domain;
*
* @author Jeremy Whitlock
*/
public interface StorageGatewayConstants {
public final class StorageGatewayConstants {
public static class Dimension {
@ -52,4 +52,7 @@ public interface StorageGatewayConstants {
}
private StorageGatewayConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -22,7 +22,7 @@ package org.jclouds.ec2.reference;
*
* @author Adrian Cole
*/
public interface EC2Constants {
public class EC2Constants {
/**
* Listing the universe of amis is extremely expensive. set this to a comma separated value of
* the ami owners you wish to use in {@link ComputeService}
@ -46,4 +46,7 @@ public interface EC2Constants {
*/
public static final String PROPERTY_EC2_GENERATE_INSTANCE_NAMES = "jclouds.ec2.generate-instance-names";
protected EC2Constants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,11 +21,14 @@ package org.jclouds.elasticstack.reference;
*
* @author Adrian Cole
*/
public class ElasticStackConstants {
public final class ElasticStackConstants {
/**
* default VNC password used on new machines
*/
public static final String PROPERTY_VNC_PASSWORD = "jclouds.elasticstack.vnc-password";
private ElasticStackConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,9 +21,12 @@ package org.jclouds.filesystem.reference;
*
* @author Alfredo "Rainbowbreeze" Morresi
*/
public class FilesystemConstants {
public final class FilesystemConstants {
/** Specify the base directory where provider starts its file operations - must exists */
public static final String PROPERTY_BASEDIR = "jclouds.filesystem.basedir";
private FilesystemConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.s3.reference;
*
* @author Adrian Cole
*/
public interface S3Constants {
public final class S3Constants {
/**
* S3 service's XML Namespace, as used in XML request and response documents.
@ -34,4 +34,7 @@ public interface S3Constants {
public static final String PROPERTY_S3_SERVICE_PATH = "jclouds.s3.service-path";
public static final String PROPERTY_S3_VIRTUAL_HOST_BUCKETS = "jclouds.s3.virtual-host-buckets";
private S3Constants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,8 +21,12 @@ package org.jclouds.aws.reference;
*
* @author Adrian Cole
*/
public interface AWSConstants {
public final class AWSConstants {
public static final String PROPERTY_ZONECLIENT_ENDPOINT = "jclouds.aws.zoneclient-endpoint";
public static final String PROPERTY_AUTH_TAG = "jclouds.aws.auth.tag";
public static final String PROPERTY_HEADER_TAG = "jclouds.aws.header.tag";
private AWSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -22,23 +22,26 @@ package org.jclouds.openstack.swift.reference;
*
* @author Adrian Cole
*/
public interface SwiftConstants {
public final class SwiftConstants {
/**
* For an integer value N, limits the number of results to at most N values.
*/
String LIMIT = "limit";
public static final String LIMIT = "limit";
/**
* Given a string value X, return Object names greater in value than the specified marker.
*/
String MARKER = "marker";
public static final String MARKER = "marker";
/**
* For a string value X, causes the results to be limited to Object names beginning with the
* substring X.
*/
String PREFIX = "prefix";
public static final String PREFIX = "prefix";
/**
* For a string value X, return the Object names nested in the pseudo path.
*/
String PATH = "path";
public static final String PATH = "path";
private SwiftConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.vcloud.reference;
*
* @author Adrian Cole
*/
public interface VCloudConstants {
public final class VCloudConstants {
public static final String PROPERTY_VCLOUD_VERSION_SCHEMA = "jclouds.vcloud.version.schema";
/**
* name of the default org that your vApp will join, if an org isn't
@ -48,4 +48,7 @@ public interface VCloudConstants {
public static final String PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud.timeout.task-complete";
private VCloudConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableList;
*
* @author Adrian Cole
*/
public interface BlobStoreConstants {
public final class BlobStoreConstants {
/**
* <p/>
* To interoperate with other S3 tools, we also accept the following:
@ -57,4 +57,7 @@ public interface BlobStoreConstants {
public static final String BLOBSTORE_LOGGER = "jclouds.blobstore";
private BlobStoreConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -43,7 +43,7 @@ import com.google.inject.Inject;
*
* @author Adrian Cole
*/
public interface ComputeServiceConstants {
public final class ComputeServiceConstants {
public static final String COMPUTE_LOGGER = "jclouds.compute";
public static final String LOCAL_PARTITION_GB_PATTERN = "disk_drive/%s/gb";
@ -131,4 +131,8 @@ public interface ComputeServiceConstants {
@Named(TIMEOUT_IMAGE_AVAILABLE)
public long imageAvailable = TimeUnit.MINUTES.toMillis(45);
}
private ComputeServiceConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -24,7 +24,7 @@ import org.jclouds.location.reference.LocationConstants;
*
* @author Adrian Cole
*/
public interface Constants {
public final class Constants {
/**
* Integer property. default (0)
* <p/>
@ -304,4 +304,8 @@ public interface Constants {
* The maximum number of blob deletes happening in parallel at any point in time.
*/
public static final String PROPERTY_MAX_PARALLEL_DELETES = "jclouds.max-parallel-deletes";
private Constants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -20,11 +20,15 @@ package org.jclouds.location.reference;
*
* @author Adrian Cole
*/
public interface LocationConstants {
public final class LocationConstants {
public static final String ENDPOINT = "endpoint";
public static final String ISO3166_CODES = "iso3166-codes";
public static final String PROPERTY_REGIONS = "jclouds.regions";
public static final String PROPERTY_REGION = "jclouds.region";
public static final String PROPERTY_ZONES = "jclouds.zones";
public static final String PROPERTY_ZONE = "jclouds.zone";
private LocationConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -20,8 +20,11 @@ package org.jclouds.loadbalancer.reference;
*
* @author Adrian Cole
*/
public interface LoadBalancerConstants {
public final class LoadBalancerConstants {
public static final String LOADBALANCER_LOGGER = "jclouds.loadbalancer";
private LoadBalancerConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -23,7 +23,7 @@ import org.jclouds.ec2.reference.EC2Constants;
*
* @author Adrian Cole
*/
public interface AWSEC2Constants extends EC2Constants {
public final class AWSEC2Constants extends EC2Constants {
/**
* expression to find amis that work on the cluster instance type <br/>
* ex. {@code
@ -36,4 +36,7 @@ public interface AWSEC2Constants extends EC2Constants {
public static final String PROPERTY_EC2_CC_REGIONS = "jclouds.ec2.cc-regions";
public static final String PROPERTY_EC2_AMI_QUERY = "jclouds.ec2.ami-query";
private AWSEC2Constants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -28,7 +28,7 @@ import org.jclouds.compute.domain.ComputeMetadata;
*
* @author Adam Lowe
*/
public class GleSYSConstants {
public final class GleSYSConstants {
public static final Pattern JCLOUDS_ID_TO_PLATFORM = Pattern.compile("([a-zA-Z]+) .*");
@ -40,4 +40,8 @@ public class GleSYSConstants {
}
return matcher.group(1);
}
private GleSYSConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -22,9 +22,13 @@ package org.jclouds.hpcloud.objectstorage.reference;
*
* @author Jeremy Daggett
*/
public interface HPCloudObjectStorageConstants {
public final class HPCloudObjectStorageConstants {
/**
* The CDN Endpoint property
*/
public static final String PROPERTY_CDN_ENDPOINT = "jclouds.hpcloud-objectstorage.cdn.endpoint";
private HPCloudObjectStorageConstants() {
throw new AssertionError("intentionally unimplemented");
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.softlayer.reference;
*
* @author Adrian Cole
*/
public interface SoftLayerConstants {
public final class SoftLayerConstants {
/**
* Name of the product package corresponding to cloud servers
@ -53,4 +53,7 @@ public interface SoftLayerConstants {
*/
public static final String PROPERTY_SOFTLAYER_VIRTUALGUEST_PRICES = "jclouds.softlayer.virtualguest.prices";
private SoftLayerConstants() {
throw new AssertionError("intentionally unimplemented");
}
}