Пример #1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof ASTType)) {
      return false;
    }

    ASTType that = (ASTType) o;

    return new EqualsBuilder().append(getName(), that.getName()).isEquals();
  }
Пример #2
0
 public ReadWriteGenerator getGenerator(ASTType type) {
   for (Map.Entry<Matcher<ASTType>, ReadWriteGenerator> generatorEntry : generators.entrySet()) {
     if (generatorEntry.getKey().matches(type)) {
       return generatorEntry.getValue();
     }
   }
   throw new ParcelerRuntimeException(
       "Unable to find appropriate Parcel method to write " + type.getName());
 }
  @Override
  public void analyzeType(InjectionNode injectionNode, ASTType astType, AnalysisContext context) {

    for (ASTAnnotation annotation : astType.getAnnotations()) {
      validateAnnotation(annotation, astType, astType.getAnnotations());
    }

    for (ASTConstructor astConstructor : astType.getConstructors()) {
      for (ASTAnnotation annotation : astConstructor.getAnnotations()) {
        validateAnnotation(
            annotation, astConstructor, astConstructor.getAnnotations(), astType.getAnnotations());

        for (ASTParameter astParameter : astConstructor.getParameters()) {
          validateParameter(astParameter, astConstructor, astType);
        }
      }
    }
  }
 private void validateParameter(
     ASTParameter parameter, ASTBase containingAST, ASTType containingType) {
   for (ASTAnnotation paramAnnotation : parameter.getAnnotations()) {
     validateAnnotation(
         paramAnnotation,
         parameter,
         parameter.getAnnotations(),
         containingAST.getAnnotations(),
         containingType.getAnnotations());
   }
 }
 @Override
 public void analyzeField(
     InjectionNode injectionNode,
     ASTType concreteType,
     ASTField astField,
     AnalysisContext context) {
   for (ASTAnnotation annotation : astField.getAnnotations()) {
     validateAnnotation(
         annotation, astField, astField.getAnnotations(), concreteType.getAnnotations());
   }
 }
  @Override
  public void analyzeMethod(
      InjectionNode injectionNode,
      ASTType concreteType,
      ASTMethod astMethod,
      AnalysisContext context) {
    for (ASTAnnotation annotation : astMethod.getAnnotations()) {
      validateAnnotation(
          annotation, astMethod, astMethod.getAnnotations(), concreteType.getAnnotations());

      for (ASTParameter astParameter : astMethod.getParameters()) {
        validateParameter(astParameter, astMethod, concreteType);
      }
    }
  }