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 http://www.apache.org/licenses/LICENSE-2.0 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.xml;
import static org.jclouds.util.SaxUtils.currentOrNull;
import static org.jclouds.util.SaxUtils.equalsOrSuffix;

Author(s):
Adrian Cole
See also:
xml
   private StringBuilder currentText = new StringBuilder();
   @SuppressWarnings("rawtypes")
   private AttributeMetadata.Builder builder = AttributeMetadata.builder();
   @SuppressWarnings("rawtypes")
   private Class currentType = String.class;

   
   @Override
   public AttributeMetadata<?> getResult() {
      try {
         return .build();
      } finally {
          = AttributeMetadata.builder();
      }
   }

   
   @SuppressWarnings("unchecked")
   @Override
   public void endElement(String uriString nameString qNamethrows SAXException {
      if (equalsOrSuffix(qName"AttributeName")) {
      } else if (equalsOrSuffix(qName"AttributeType")) {
         String rawType = currentOrNull();
         if ("Long".equals(rawType)) {
             = Long.class;
         } else if ("Boolean".equals(rawType)) {
             = Boolean.class;
         } else {
             = String.class;
         }
         .type();
         .rawType(rawType);
      } else if (equalsOrSuffix(qName"Cardinality")) {
         .cardinality(Cardinality.valueOf(currentOrNull()));
      } else if (equalsOrSuffix(qName"DefaultValue")) {
         Object value = currentOrNull();
         if ( == Long.class)
            value = Long.valueOf(currentOrNull());
         else if ( == Boolean.class)
            value = Boolean.valueOf(currentOrNull());
         .defaultValue(value);
      } else if (equalsOrSuffix(qName"UnhealthyThreshold")) {
      }
       = new StringBuilder();
   }

   
   @Override
   public void characters(char ch[], int startint length) {
      .append(chstartlength);
   }
New to GrepCode? Check out our FAQ X