Class MetaUtils

java.lang.Object
com.cedarsoftware.io.MetaUtils

public class MetaUtils extends Object
This utility class has the methods mostly related to reflection related code.
Author:
John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Method Details

    • getLogMessage

      public static String getLogMessage(String methodName, Object[] args)
      Format a nice looking method signature for logging output
    • getLogMessage

      public static String getLogMessage(String methodName, Object[] args, int argCharLen)
    • getValueWithDefaultForNull

      public static <K, V> V getValueWithDefaultForNull(Map map, K key, V defaultValue)
    • getValueWithDefaultForMissing

      public static <K, V> V getValueWithDefaultForMissing(Map map, K key, V defaultValue)
    • setFieldValue

      @Deprecated public static void setFieldValue(Field field, Object instance, Object value)
      Deprecated.
    • isLogicalPrimitive

      @Deprecated public static boolean isLogicalPrimitive(Class<?> c)
      Deprecated.
      Legacy API that many applications consumed.
    • loadMapDefinition

      public static Map<String,String> loadMapDefinition(String resName)
      Load in a Map-style properties file. Expects key and value to be separated by a = (whitespace ignored). Ignores lines beginning with a # and it also ignores blank lines.
      Parameters:
      resName - String name of the resource file.
    • loadSetDefinition

      public static Set<String> loadSetDefinition(String resName)
      Load in a Set-style simple file of values. Expects values to be one per line. Ignores lines beginning with a # and it also ignores blank lines.
      Parameters:
      resName - String name of the resource file.
      Returns:
      the set of strings
    • loadResourceAsString

      @Deprecated public static String loadResourceAsString(String resourceName)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.loadResourceAsString(String) directly instead.
    • loadResourceAsBytes

      @Deprecated public static byte[] loadResourceAsBytes(String resourceName)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.loadResourceAsBytes(String) directly instead.
    • removeLeadingAndTrailingQuotes

      @Deprecated public static String removeLeadingAndTrailingQuotes(String input)
      Deprecated.
      This method is deprecated and will be removed in a future version. This method has been moved to StringUtilities.removeLeadingAndTrailingQuotes(String).
    • findClosest

      @Deprecated public static <T> T findClosest(Class<?> clazz, Map<Class<?>,T> workerClasses, T defaultClass)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.findClosest(Class, Map, Object) directly instead.
    • setUseUnsafe

      @Deprecated public static void setUseUnsafe(boolean state)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.setUseUnsafe(boolean) going forward.
    • newInstance

      @Deprecated public static Object newInstance(com.cedarsoftware.util.convert.Converter converter, Class<?> c, Collection<?> argumentValues)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.newInstance(Converter, Class, Collection) going forward.
    • safelyIgnoreException

      @Deprecated public static <T> T safelyIgnoreException(Callable<T> callable, T defaultValue)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ExceptionUtilities.safelyIgnoreException(Callable, T)
    • safelyIgnoreException

      @Deprecated public static void safelyIgnoreException(Runnable runnable)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ExceptionUtilities.safelyIgnoreException(Runnable)
    • length

      @Deprecated public static int length(String s)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use StringUtilities.length(String) to safely determine the length of a string without risking a NullPointerException.
    • trimLength

      @Deprecated public static int trimLength(String s)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use StringUtilities.trimLength(String) directly instead.
    • getClassIfEnum

      @Deprecated public static Class<?> getClassIfEnum(Class<?> c)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.getClassIfEnum(Class) directly instead.
    • isPrimitive

      @Deprecated public static boolean isPrimitive(Class<?> c)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ClassUtilities.isPrimitive(Class) directly instead.
    • trySetAccessible

      @Deprecated public static void trySetAccessible(AccessibleObject object)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use ExceptionUtilities.safelyIgnoreException(Runnable) directly instead.