Package com.hannesdorfmann.fragmentargs.processor

Source Code of com.hannesdorfmann.fragmentargs.processor.ArgumentAnnotatedField

package com.hannesdorfmann.fragmentargs.processor;

import com.hannesdorfmann.fragmentargs.annotation.Arg;
import javax.lang.model.element.Element;

public class ArgumentAnnotatedField extends AnnotatedField {

  public ArgumentAnnotatedField(Element element) {
    super(element, isRequired(element), getKey(element));
  }

  private static String getKey(Element element) {
    Arg annotation = element.getAnnotation(Arg.class);
    String field = element.getSimpleName().toString();
    if (!"".equals(annotation.key())) {
      return annotation.key();
    }
    return getVariableName(field);
  }

  private static boolean isRequired(Element element) {
    Arg annotation = element.getAnnotation(Arg.class);
    return annotation.required();
  }
}
TOP

Related Classes of com.hannesdorfmann.fragmentargs.processor.ArgumentAnnotatedField

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.