Tabnine Logo
Reflection.toFirstUpper
Code IndexAdd Tabnine to your IDE (free)

How to use
toFirstUpper
method
in
sirius.kernel.commons.Reflection

Best Java code snippets using sirius.kernel.commons.Reflection.toFirstUpper (Showing top 4 results out of 315)

origin: com.scireum/sirius-search

private boolean hasSetter(Field field) {
  try {
    field.getDeclaringClass().getMethod("set" + Reflection.toFirstUpper(field.getName()), field.getType());
    return true;
  } catch (NoSuchMethodException e) {
    Exceptions.ignore(e);
    return false;
  }
}
origin: com.scireum/sirius-kernel

private static Method getterAsIs(@Nonnull Class<?> clazz, @Nonnull String property) throws NoSuchMethodException {
  try {
    return clazz.getMethod("is" + toFirstUpper(property));
  } catch (NoSuchMethodException ex) {
    Exceptions.ignore(ex);
    return clazz.getMethod(property);
  }
}
origin: com.scireum/sirius-kernel

/**
 * Returns the setter method according to the java beans specification for a
 * given property.
 *
 * @param clazz     the class in which the method should be searched
 * @param property  the name of the property for which the setter is requested
 * @param fieldType determines the type of the field (which is accepted as parameter of the setter)
 * @return the <tt>Method</tt> which is used to get the value
 * @throws IllegalArgumentException if the setter cannot be obtained
 */
public static Method setter(Class<?> clazz, String property, Class<?> fieldType) {
  try {
    return clazz.getMethod("set" + toFirstUpper(property), fieldType);
  } catch (Exception e) {
    throw new IllegalArgumentException(Strings.apply("set-Method for Field %s not found: %s",
                             property,
                             e.getMessage()), e);
  }
}
origin: com.scireum/sirius-kernel

/**
 * Returns the getter method according to the java beans specification for a
 * given property.
 *
 * @param clazz    the class in which the method should be searched
 * @param property the name of the property for which the getter is requested
 * @return the <tt>Method</tt> which is used to get the value
 * @throws IllegalArgumentException if the getter cannot be obtained
 */
@Nonnull
@SuppressWarnings("squid:S1141")
@Explain("A nested catch block seems to be the most readable solution here")
public static Method getter(@Nonnull Class<?> clazz, @Nonnull String property) {
  try {
    try {
      return clazz.getMethod("get" + toFirstUpper(property));
    } catch (NoSuchMethodException e) {
      Exceptions.ignore(e);
      return getterAsIs(clazz, property);
    }
  } catch (Exception e) {
    throw new IllegalArgumentException(Strings.apply("get-Method for Field %s not found: %s",
                             property,
                             e.getMessage()), e);
  }
}
sirius.kernel.commonsReflectiontoFirstUpper

Javadoc

Converts the first character of a given string to upper case.

Comes in handy when translating properties to getter/setter names.

Popular methods of Reflection

  • evalAccessPath
    Evaluates the given access path (dot separated getters) and returns the result. An access path can
  • getter
    Returns the getter method according to the java beans specification for a given property.
  • getterAsIs
  • walkHierarchy
    Calls the given handler for each superclass of the given one. Calls the handler for the given class

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • JComboBox (javax.swing)
  • JList (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • From CI to AI: The AI layer in your organization
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