Returns the schema for the annotation on this document class whose {@link Class} matches the
provided class. This method returns null if no annotation class matches.
778077
public AnnSchema getSchema(final Class<? extends Ann> klass) {
    for (AnnSchema ann : annSchemas)
      if (ann.getKlass().equals(klass))
        return ann;
    return null;
  }
947542
public static Class<? extends Schema> getSchema(String name) {
    Class<? extends Schema> clz = schemas.get(name);
    if (clz == null)
      throw new H2ONotFoundArgumentException("Failed to find schema for schema_name: " + name,
          "Failed to find schema for schema_name: " + name + "\n" +
          "Did you forget to add an entry into META-INF/services/water.api.Schema?");
    return clz;
  }
538241
public static <T> Schema<T> getSchema(Class<T> typeClass,
            IdStrategy strategy)
    {
        return strategy.getSchemaWrapper(typeClass, true).getSchema();
    }
136609
@Nullable
	private FieldAnnotation getFieldAnnotation(final String fieldName) {
		JavaClass cls = getClassContext().getJavaClass();
		Field[] fields = cls.getFields();
		for (Field f : fields) {
			if (f.getName().equals(fieldName)) {
				return new FieldAnnotation(cls.getClassName(), fieldName, f.getSignature(), f.isStatic());
			}
		}
		return null; // shouldn't happen
	}
291199
private static Map<String, Object> getAnnoAsMap(Object targetClass, String annoFullName) {
		Annotation[] anno = getAnnotations(targetClass);
		for (Annotation a : anno) {
			Class<? extends Annotation> type = a.annotationType();
			if (annoFullName.equals(type.getName()))
				return changeAnnotationValuesToMap(a);
		}
		return null;
	}
792408
private Class<? extends Object> getClassForClassDoc(final ClassDoc doc) {
        try {
            return DocletUtils.getClassForDoc(doc);
        } catch (ClassNotFoundException e) {
            // we got a classdoc for a class we can't find.  Maybe in a library or something
            return null;
        } catch (NoClassDefFoundError e) {
            return null;
        } catch (UnsatisfiedLinkError e) {
            return null; // naughty BWA bindings
        }
    }
103810
@Override
   public Object getAnnotation()
   {
      try
      {
         if (isOnField())
         {
            Class<?> clazz = cl.loadClass(className);
            while (!clazz.equals(Object.class))
            {
               try
               {
                  Field field = SecurityActions.getDeclaredField(clazz, memberName);
                  return field.getAnnotation(annotationClass);
               }
               catch (Throwable t)
               {
                  clazz = clazz.getSuperclass();
               }
            }
         }
         else if (isOnMethod())
         {
            Class<?> clazz = cl.loadClass(className);
            Class<?>[] params = new Class<?>[parameterTypes.size()];
            int i = 0;
            for (String paramClazz : parameterTypes)
            {
               params[i] = cl.loadClass(paramClazz);
               i++;
            }
            while (!clazz.equals(Object.class))
            {
               try
               {
                  Method method = SecurityActions.getDeclaredMethod(clazz, memberName, params);
                  return method.getAnnotation(annotationClass);
               }
               catch (Throwable t)
               {
                  clazz = clazz.getSuperclass();
               }
            }
         }
         else
         { // onclass
            Class<?> clazz = cl.loadClass(className);
            return clazz.getAnnotation(annotationClass);
         }
      }
      catch (Exception e)
      {
         log.error(e.getMessage(), e);
      }

      return null;
   }
1187424
@SuppressWarnings("unused") // called through reflection by RequestServer
  public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
    if ("void".equals(docs.schemaname)) {
      docs.schemas = new SchemaMetadataV3[0];
      return docs;
    }

    docs.schemas = new SchemaMetadataV3[1];
    // NOTE: this will throw an exception if the classname isn't found:
    Schema schema = Schema.newInstance(docs.schemaname);
    // get defaults
    try {
      Iced impl = (Iced) schema.getImplClass().newInstance();
      schema.fillFromImpl(impl);
    }
    catch (Exception e) {
      // ignore if create fails; this can happen for abstract classes
    }
    SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
    docs.schemas[0] = meta;
    return docs;
  }
1037016
@DefinedBy(Api.LANGUAGE_MODEL)
    public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
467971
@SuppressWarnings("unchecked")
	public <A extends Annotation> A getAnnotation(Class<A> type) {
		for (Annotation annotation : this.annotations) {
			if (type.isInstance(annotation)) {
				return (A) annotation;
			}
		}
		return null;
	}
830993
private DocumentedFeature getDocumentedFeatureForClass(final Class<?> clazz) {
        if (clazz != null && clazz.isAnnotationPresent(DocumentedFeature.class)) {
            return clazz.getAnnotation(DocumentedFeature.class);
        }
        else {
            return null;
        }
    }
463646
public static List<FieldMetadata> getFieldMetadata(Schema schema) {
    List<Field> superclassFields = Arrays.asList(Weaver.getWovenFields(schema.getClass().getSuperclass()));

    List<FieldMetadata> fields = new ArrayList<>();
    // Fields up to but not including Schema
    for (Field field : Weaver.getWovenFields(schema.getClass())) {
      FieldMetadata fmd = FieldMetadata.createIfApiAnnotation(schema, field, superclassFields);
      if (null != fmd) // skip transient or other non-annotated fields
        fields.add(fmd);  // NOTE: we include non-JSON fields here; remove them later if we don't want them
    }
    return fields;
  }
1142187
@Override
    public String getScheme() {
        // if it hasn't been set yet, then check whether the SC is secure
        // or not and set the value accordingly
        if (null == this.myScheme) {
            initScheme();
        }
        if (null == this.myScheme) { // if the request has been already destroyed then it will be still null
            return null;
        }
        return this.myScheme.getName();
    }
1319719
static Optional<AnnotationTree> findAnnotation(String annotationName, ClassTree classTree) {
    for (AnnotationTree annotationTree : classTree.getModifiers().getAnnotations()) {
      ClassSymbol annotationClass = (ClassSymbol) getSymbol(annotationTree.getAnnotationType());
      if (annotationClass.fullname.contentEquals(annotationName)) {
        return Optional.of(annotationTree);
      }
    }
    return Optional.absent();
  }
1121438
@Deprecated
  @SuppressWarnings("unused") // called through reflection by RequestServer
  public MetadataV3 fetchSchemaMetadataByClass(int version, MetadataV3 docs) {
    docs.schemas = new SchemaMetadataV3[1];
    // NOTE: this will throw an exception if the classname isn't found:
    SchemaMetadataV3 meta = new SchemaMetadataV3(SchemaMetadata.createSchemaMetadata(docs.classname));
    docs.schemas[0] = meta;
    return docs;
  }
487900
public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType) {
		if (clazz == null) throw new IllegalArgumentException("Clazz parameter can't be null");
		
		A annotation = clazz.getAnnotation(annotationType);
		if (annotation != null) return annotation;
		
		for (Class<?> ifc : clazz.getInterfaces()) {
			annotation = findAnnotation(ifc, annotationType);
			if (annotation != null) return annotation;
		}
		
		if (!Annotation.class.isAssignableFrom(clazz))
			for (Annotation ann : clazz.getAnnotations()) {
				annotation = findAnnotation(ann.annotationType(), annotationType);
				if (annotation != null) return annotation;
			}
		
		Class<?> superClass = clazz.getSuperclass();
		if (superClass == null || superClass == Object.class) return null;
		return findAnnotation(superClass, annotationType);
	}
737501
@Override
  public void schema(Class<?> type)
  {
    Objects.requireNonNull(type);
    
    _context.schema(type);
  }