Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to jclouds, Inc. (jclouds) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. jclouds licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.jclouds.elb.domain;
 import static;
This data type is used to describe values that are acceptable for the policy attribute.

Adrian Cole
See also:
 public class AttributeMetadata<V> {
The cardinality of the attribute.
    public static enum Cardinality {
ONE(1) : Single value required
ZERO_OR_ONE(0..1) : Up to one value can be supplied
ZERO_OR_MORE(0..*) : Optional. Multiple values are allowed
ONE_OR_MORE(1..*0) : Required. Multiple values are allowed *
    public static <V> Builder<V> builder() {
       return new Builder<V>();
    public Builder<V> toBuilder() {
       return new Builder<V>().fromAttributeMetadata(this);
    public static class Builder<V> {
       protected String name;
       protected Class<V> type;
       protected String rawType;
       protected Cardinality cardinality;
       protected Optional<V> defaultValue = Optional.absent();
       protected Optional<Stringdescription = Optional.absent();

       public Builder<V> name(String name) {
          this. = name;
          return this;

       public Builder<V> type(Class<V> type) {
          this. = type;
          return this;

       public Builder<V> rawType(String rawType) {
          this. = rawType;
          return this;

      public Builder<V> cardinality(Cardinality cardinality) {
         this. = cardinality;
         return this;

      public Builder<V> defaultValue(V defaultValue) {
         this. = Optional.fromNullable(defaultValue);
         return this;

      public Builder<V> description(String description) {
         this. = Optional.fromNullable(description);
         return this;
      public AttributeMetadata<V> build() {
         return new AttributeMetadata<V>();
      public Builder<V> fromAttributeMetadata(AttributeMetadata<V> in) {
   protected final String name;
   protected final Class<V> type;
   protected final String rawType;
   protected final Cardinality cardinality;
   protected final Optional<V> defaultValue;
   protected final Optional<Stringdescription;
   protected AttributeMetadata(String nameClass<V> typeString rawTypeCardinality cardinality,
            Optional<V> defaultValueOptional<Stringdescription) {
      this. = checkNotNull(name"name");
      this. = checkNotNull(type"type");
      this. = checkNotNull(rawType"rawType");
      this. = checkNotNull(cardinality"cardinality");
      this. = checkNotNull(defaultValue"defaultValue");
      this. = checkNotNull(description"description");

The name of the attribute associated with the policy type.
   public String getName() {
      return ;

The type of attribute. For example, Boolean, Long, String, etc.
   public Class<V> getType() {
      return ;

Literal type of the value, noting that if it doesn't correspond to a primitive or String, will return String.class
   public String getRawType() {
      return ;

The cardinality of the attribute.
   public Cardinality getCardinality() {
      return ;

The default value of the attribute, if applicable.
   public Optional<V> getDefaultValue() {
      return ;

A human-readable description of the attribute.
   public Optional<StringgetDescription() {
      return ;

   public int hashCode() {
      return Objects.hashCode();

   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (obj == null)
         return false;
      if (getClass() != obj.getClass())
         return false;
      AttributeMetadata<?> other = AttributeMetadata.class.cast(obj);
      return Objects.equal( && Objects.equal(this.other.type)
               && Objects.equal(this.other.rawType) && Objects.equal(this.other.cardinality)
               && Objects.equal(this.other.defaultValue)
               && Objects.equal(this.other.description);

   public String toString() {
      return string().toString();
   protected ToStringHelper string() {
      return Objects.toStringHelper(this).omitNullValues().add("name").add("type").add("rawType")
New to GrepCode? Check out our FAQ X