Tabnine Logo
org.codehaus.groovy.reflection
Code IndexAdd Tabnine to your IDE (free)

How to use org.codehaus.groovy.reflection

Best Java code snippets using org.codehaus.groovy.reflection (Showing top 20 results out of 315)

origin: org.codehaus.groovy/groovy

@Override
public void finalizeReference() {
  setStrongMetaClass(null);
  cachedClassRef.clear();
  artifactClassLoader.clear();
}
origin: org.codehaus.groovy/groovy

public static void onAllClassInfo(ClassInfoAction action) {
  for (ClassInfo classInfo : getAllGlobalClassInfo()) {
    action.onClassInfo(classInfo);
  }
}
origin: org.codehaus.groovy/groovy

static boolean noCoerce(ParameterTypes metaMethod, Object[] args) {
  final CachedClass[] paramClasses = metaMethod.getParameterTypes();
  if (paramClasses.length != args.length)
    return false;
  for (int i = 0; i < paramClasses.length; i++) {
    CachedClass paramClass = paramClasses[i];
    if (args[i] != null && !paramClass.isDirectlyAssignable(args[i]))
      return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

private synchronized void getNativeParameterTypes0() {
  if (nativeParamTypes != null)
    return;
  Class[] npt;
  if (parameterTypes != null) {
    npt = new Class[parameterTypes.length];
    for (int i = 0; i != parameterTypes.length; ++i) {
      npt[i] = parameterTypes[i].getTheClass();
    }
  } else
    npt = getPT();
  nativeParamTypes = npt;
}
origin: org.codehaus.groovy/groovy

public boolean isAssignableFrom(Class argument) {
  return argument == null || ReflectionCache.isAssignableFrom(getTheClass(), argument);
}
origin: org.codehaus.groovy/groovy

public ClosureMetaMethod(String name, Class declaringClass, Closure c, CachedMethod doCall) {
  super (doCall.getNativeParameterTypes());
  this.name = name;
  callable = c;
  this.doCall = doCall;
  this.declaringClass = ReflectionCache.getCachedClass(declaringClass);
}
origin: org.codehaus.groovy/groovy

public boolean isValidExactMethod(Class[] args) {
  // lets check the parameter types match
  getParametersTypes0();
  int size = args.length;
  if (size != parameterTypes.length)
    return false;
  for (int i = 0; i < size; i++) {
    if (args[i] != null && !parameterTypes[i].isAssignableFrom(args[i])) {
      return false;
    }
  }
  return true;
}
origin: org.codehaus.groovy/groovy

@Override
public Class getReturnType() { return cc.getCachedClass().getTheClass(); }
@Override
origin: org.codehaus.groovy/groovy

public final Object[] coerceArgumentsToClasses(Object[] argumentArray) {
  // Uncomment if at some point this method can be called before parameterTypes initialized
  // getParameterTypes();
  argumentArray = correctArguments(argumentArray);
  final CachedClass[] pt = parameterTypes;
  final int len = argumentArray.length;
  for (int i = 0; i < len; i++) {
    final Object argument = argumentArray[i];
    if (argument != null) {
      argumentArray[i] = pt[i].coerceArgument(argument);
    }
  }
  return argumentArray;
}
origin: org.codehaus.groovy/groovy

/**
 * Get the called that is matchLevel stack frames before the call,
 * ignoring MOP frames.
 *
 * @param matchLevel how may call stacks down to look.
 *                   If it is less than 1 it is treated as though it was 1.
 * @return The Class of the matched caller, or null if there aren't
 *         enough stackframes to satisfy matchLevel
 */
public static Class getCallingClass(int matchLevel) {
  return getCallingClass(matchLevel, Collections.EMPTY_SET);
}
origin: org.codehaus.groovy/groovy

private static boolean isValidExactMethod(Class[] arguments, CachedClass[] pt) {
  // lets check the parameter types match
  int size = pt.length;
  for (int i = 0; i < size; i++) {
    if (!pt[i].isAssignableFrom(arguments[i])) {
      return false;
    }
  }
  return true;
}
origin: org.codehaus.groovy/groovy

  @Override
  public ClassInfo computeValue(Class<?> type) {
    ClassInfo ret = new ClassInfo(type);
    globalClassSet.add(ret);
    return ret;
  }
});
origin: org.codehaus.groovy/groovy

public Class[] getNativeParameterTypes() {
  if (nativeParamTypes == null) {
    getNativeParameterTypes0();
  }
  return nativeParamTypes;
}
origin: org.codehaus.groovy/groovy

public CachedClass[] getParameterTypes() {
  if (parameterTypes == null) {
    getParametersTypes0();
  }
  return parameterTypes;
}
origin: org.codehaus.groovy/groovy

private MetaMethod[] getNewMetaMethods(CachedClass c) {
  if (theCachedClass != c)
   return c.getNewMetaMethods();
  return myNewMetaMethods;
}
origin: org.codehaus.groovy/groovy

/**
 * Extend object with category methods.
 * All methods for given class and all super classes will be added to the object.
 *
 * @param self          any Class
 * @param categoryClasses a category classes to use
 * @since 1.6.0
 */
public static void mixin(MetaClass self, List<Class> categoryClasses) {
  MixinInMetaClass.mixinClassesToMetaClass(self, categoryClasses);
}
origin: org.codehaus.groovy/groovy

/**
 * Increments version of the contained Class
 */
public void incVersion() {
  theCachedClass.classInfo.incVersion();
}
origin: org.codehaus.groovy/groovy

public MetaClass getMetaClassForClass() {
  // safe value here to avoid multiple reads with possibly
  // differing values due to concurrency
  MetaClass strongMc = strongMetaClass;
  if (strongMc!=null) return strongMc;
  MetaClass weakMc = getWeakMetaClass();
  if (isValidWeakMetaClass(weakMc)) {
    return weakMc;
  }
  return null;
}
origin: org.codehaus.groovy/groovy

@Override
public T get(Class<?> type) {
  // the value isn't use in the getOrPut call - see the EntryWithValue constructor above
  T value = ((EntryWithValue)map.getOrPut(type, null)).getValue();
  //all entries are guaranteed to be EntryWithValue. Value can only be null if computeValue returns null
  return value;
}
origin: groovy/groovy-core

  public Class instanceCaller() {
    return ReflectionUtils.getCallingClass();
  }
}
org.codehaus.groovy.reflection

Most used classes

  • CachedClass
  • CachedMethod
  • CachedField
  • ClassInfo
    Handle for all information we want to keep about the class
  • ReflectionCache
  • CachedConstructor,
  • ParameterTypes,
  • ArrayCachedClass,
  • BigDecimalCachedClass,
  • BigIntegerCachedClass,
  • BooleanCachedClass,
  • ByteCachedClass,
  • CachedClosureClass,
  • CharacterCachedClass,
  • DoubleCachedClass,
  • FloatCachedClass,
  • IntegerCachedClass,
  • LongCachedClass,
  • NumberCachedClass
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