Tabnine Logo
ReflectionUtils.getDeclaredFields
Code IndexAdd Tabnine to your IDE (free)

How to use
getDeclaredFields
method
in
io.swagger.v3.core.util.ReflectionUtils

Best Java code snippets using io.swagger.v3.core.util.ReflectionUtils.getDeclaredFields (Showing top 5 results out of 315)

origin: swagger-api/swagger-core

/**
 * Collects field-level parameters from class.
 *
 * @param cls        is a class for collecting
 * @param components
 * @return the collection of supported parameters
 */
public static List<Parameter> collectFieldParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes, JsonView jsonViewAnnotation) {
  final List<Parameter> parameters = new ArrayList<Parameter>();
  for (Field field : ReflectionUtils.getDeclaredFields(cls)) {
    final List<Annotation> annotations = Arrays.asList(field.getAnnotations());
    final Type genericType = field.getGenericType();
    parameters.addAll(collectParameters(genericType, annotations, components, classConsumes, jsonViewAnnotation));
  }
  return parameters;
}
origin: swagger-api/swagger-core

/**
 * Returns the list of declared fields from the class <code>cls</code> and its superclasses
 * excluding <code>Object</code> class. If the field from child class hides the field from superclass,
 * the field from superclass won't be added to the result list.
 *
 * @param cls is the processing class
 * @return list of Fields
 */
public static List<Field> getDeclaredFields(Class<?> cls) {
  if (cls == null || Object.class.equals(cls)) {
    return Collections.emptyList();
  }
  final List<Field> fields = new ArrayList<Field>();
  final Set<String> fieldNames = new HashSet<String>();
  for (Field field : cls.getDeclaredFields()) {
    fields.add(field);
    fieldNames.add(field.getName());
  }
  for (Field field : getDeclaredFields(cls.getSuperclass())) {
    if (!fieldNames.contains(field.getName())) {
      fields.add(field);
    }
  }
  return fields;
}
origin: swagger-api/swagger-core

@Test
public void getDeclaredFieldsFromInterfaceTest() throws NoSuchMethodException {
  final Class cls = IParent.class;
  Assert.assertEquals(Collections.emptyList(), ReflectionUtils.getDeclaredFields(cls));
}
origin: io.swagger.core.v3/swagger-jaxrs2

/**
 * Collects field-level parameters from class.
 *
 * @param cls        is a class for collecting
 * @param components
 * @return the collection of supported parameters
 */
public static List<Parameter> collectFieldParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes, JsonView jsonViewAnnotation) {
  final List<Parameter> parameters = new ArrayList<Parameter>();
  for (Field field : ReflectionUtils.getDeclaredFields(cls)) {
    final List<Annotation> annotations = Arrays.asList(field.getAnnotations());
    final Type genericType = field.getGenericType();
    parameters.addAll(collectParameters(genericType, annotations, components, classConsumes, jsonViewAnnotation));
  }
  return parameters;
}
origin: io.swagger.core.v3/swagger-core

/**
 * Returns the list of declared fields from the class <code>cls</code> and its superclasses
 * excluding <code>Object</code> class. If the field from child class hides the field from superclass,
 * the field from superclass won't be added to the result list.
 *
 * @param cls is the processing class
 * @return list of Fields
 */
public static List<Field> getDeclaredFields(Class<?> cls) {
  if (cls == null || Object.class.equals(cls)) {
    return Collections.emptyList();
  }
  final List<Field> fields = new ArrayList<Field>();
  final Set<String> fieldNames = new HashSet<String>();
  for (Field field : cls.getDeclaredFields()) {
    fields.add(field);
    fieldNames.add(field.getName());
  }
  for (Field field : getDeclaredFields(cls.getSuperclass())) {
    if (!fieldNames.contains(field.getName())) {
      fields.add(field);
    }
  }
  return fields;
}
io.swagger.v3.core.utilReflectionUtilsgetDeclaredFields

Javadoc

Returns the list of declared fields from the class cls and its superclasses excluding Object class. If the field from child class hides the field from superclass, the field from superclass won't be added to the result list.

Popular methods of ReflectionUtils

  • getAnnotation
    Returns an annotation by type from a method.
  • getOverriddenMethod
    Returns overridden method from superclass if it exists. If method was not found returns null.
  • getRepeatableAnnotationsArray
  • isOverriddenMethod
    Checks if the method methodToFind is the overridden method from the superclass or superinterface.
  • getRepeatableAnnotations
    Returns a List of repeatable annotations by type from a method.
  • findMethod
    Searches the method methodToFind in given class cls. If the method is found returns it, else return
  • getParameterAnnotations
  • isConstructorCompatible
  • isInject
  • hasIdenticalParameters
  • isSystemType
  • isVoid
    Checks if the type is void.
  • isSystemType,
  • isVoid,
  • loadClassByName,
  • typeFromString

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JButton (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now