Tabnine Logo
Class.getEnclosingConstructor
Code IndexAdd Tabnine to your IDE (free)

How to use
getEnclosingConstructor
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getEnclosingConstructor (Showing top 20 results out of 531)

origin: spring-projects/spring-loaded

public static Constructor callGetEnclosingConstructor(Class thiz)
{
  return thiz.getEnclosingConstructor();
}
origin: google/guava

 private boolean mayNeedHiddenThis() {
  Class<?> declaringClass = constructor.getDeclaringClass();
  if (declaringClass.getEnclosingConstructor() != null) {
   // Enclosed in a constructor, needs hidden this
   return true;
  }
  Method enclosingMethod = declaringClass.getEnclosingMethod();
  if (enclosingMethod != null) {
   // Enclosed in a method, if it's not static, must need hidden this.
   return !Modifier.isStatic(enclosingMethod.getModifiers());
  } else {
   // Strictly, this doesn't necessarily indicate a hidden 'this' in the case of
   // static initializer. But there seems no way to tell in that case. :(
   // This may cause issues when an anonymous class is created inside a static initializer,
   // and the class's constructor's first parameter happens to be the enclosing class.
   // In such case, we may mistakenly think that the class is within a non-static context
   // and the first parameter is the hidden 'this'.
   return declaringClass.getEnclosingClass() != null
     && !Modifier.isStatic(declaringClass.getModifiers());
  }
 }
}
origin: prestodb/presto

 private boolean mayNeedHiddenThis() {
  Class<?> declaringClass = constructor.getDeclaringClass();
  if (declaringClass.getEnclosingConstructor() != null) {
   // Enclosed in a constructor, needs hidden this
   return true;
  }
  Method enclosingMethod = declaringClass.getEnclosingMethod();
  if (enclosingMethod != null) {
   // Enclosed in a method, if it's not static, must need hidden this.
   return !Modifier.isStatic(enclosingMethod.getModifiers());
  } else {
   // Strictly, this doesn't necessarily indicate a hidden 'this' in the case of
   // static initializer. But there seems no way to tell in that case. :(
   // This may cause issues when an anonymous class is created inside a static initializer,
   // and the class's constructor's first parameter happens to be the enclosing class.
   // In such case, we may mistakenly think that the class is within a non-static context
   // and the first parameter is the hidden 'this'.
   return declaringClass.getEnclosingClass() != null
     && !Modifier.isStatic(declaringClass.getModifiers());
  }
 }
}
origin: robovm/robovm

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: wildfly/wildfly

 private boolean mayNeedHiddenThis() {
  Class<?> declaringClass = constructor.getDeclaringClass();
  if (declaringClass.getEnclosingConstructor() != null) {
   // Enclosed in a constructor, needs hidden this
   return true;
  }
  Method enclosingMethod = declaringClass.getEnclosingMethod();
  if (enclosingMethod != null) {
   // Enclosed in a method, if it's not static, must need hidden this.
   return !Modifier.isStatic(enclosingMethod.getModifiers());
  } else {
   // Strictly, this doesn't necessarily indicate a hidden 'this' in the case of
   // static initializer. But there seems no way to tell in that case. :(
   // This may cause issues when an anonymous class is created inside a static initializer,
   // and the class's constructor's first parameter happens to be the enclosing class.
   // In such case, we may mistakenly think that the class is within a non-static context
   // and the first parameter is the hidden 'this'.
   return declaringClass.getEnclosingClass() != null
     && !Modifier.isStatic(declaringClass.getModifiers());
  }
 }
}
origin: robovm/robovm

private static GenericDeclaration nextLayer(GenericDeclaration decl) {
  if (decl instanceof Class) {
    // FIXME: Is the following hierarchy correct?:
    Class cl = (Class)decl;
    // RoboVM note: Start of change. Do what the old 4.1.1 code did instead
    // of AnnotationAccess.getEnclosingMethodOrConstructor(cl) in 4.4.3.
    decl = cl.getEnclosingMethod();
    if (decl != null) {
      return decl;
    }
    decl = cl.getEnclosingConstructor();
    if (decl != null) {
      return decl;
    }
    // RoboVM note: End of change,
    return cl.getEnclosingClass();
  } else if (decl instanceof Method) {
    return ((Method)decl).getDeclaringClass();
  } else if (decl instanceof Constructor) {
    return ((Constructor)decl).getDeclaringClass();
  } else {
    throw new AssertionError();
  }
}
origin: google/j2objc

 private boolean mayNeedHiddenThis() {
  Class<?> declaringClass = constructor.getDeclaringClass();
  if (declaringClass.getEnclosingConstructor() != null) {
   // Enclosed in a constructor, needs hidden this
   return true;
  }
  Method enclosingMethod = declaringClass.getEnclosingMethod();
  if (enclosingMethod != null) {
   // Enclosed in a method, if it's not static, must need hidden this.
   return !Modifier.isStatic(enclosingMethod.getModifiers());
  } else {
   // Strictly, this doesn't necessarily indicate a hidden 'this' in the case of
   // static initializer. But there seems no way to tell in that case. :(
   // This may cause issues when an anonymous class is created inside a static initializer,
   // and the class's constructor's first parameter happens to be the enclosing class.
   // In such case, we may mistakenly think that the class is within a non-static context
   // and the first parameter is the hidden 'this'.
   return declaringClass.getEnclosingClass() != null
     && !Modifier.isStatic(declaringClass.getModifiers());
  }
 }
}
origin: redisson/redisson

/**
 * {@inheritDoc}
 */
public MethodDescription.InDefinedShape getEnclosingMethod() {
  Method enclosingMethod = type.getEnclosingMethod();
  Constructor<?> enclosingConstructor = type.getEnclosingConstructor();
  if (enclosingMethod != null) {
    return new MethodDescription.ForLoadedMethod(enclosingMethod);
  } else if (enclosingConstructor != null) {
    return new MethodDescription.ForLoadedConstructor(enclosingConstructor);
  } else {
    return MethodDescription.UNDEFINED;
  }
}
origin: com.bugvm/bugvm-rt

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: MobiVM/robovm

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: org.ceylon-lang/com.redhat.ceylon.model

private boolean isStaticLocalContainer(Class<?> klass) {
  Constructor<?> enclosingConstructor = klass.getEnclosingConstructor();
  if(enclosingConstructor != null)
    return Modifier.isStatic(enclosingConstructor.getModifiers());
  Method enclosingMethod = klass.getEnclosingMethod();
  return Modifier.isStatic(enclosingMethod.getModifiers());
}
origin: ibinti/bugvm

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: com.gluonhq/robovm-rt

/**
 * Tests whether the class represented by this {@code Class} is defined
 * locally.
 */
public boolean isLocalClass() {
  boolean enclosed = (getEnclosingMethod() != null ||
           getEnclosingConstructor() != null);
  return enclosed && !isAnonymousClass();
}
origin: org.testifyproject.external/external-bytebuddy

@Override
public MethodDescription getEnclosingMethod() {
  Method enclosingMethod = type.getEnclosingMethod();
  Constructor<?> enclosingConstructor = type.getEnclosingConstructor();
  if (enclosingMethod != null) {
    return new MethodDescription.ForLoadedMethod(enclosingMethod);
  } else if (enclosingConstructor != null) {
    return new MethodDescription.ForLoadedConstructor(enclosingConstructor);
  } else {
    return MethodDescription.UNDEFINED;
  }
}
origin: javapathfinder/jpf-core

@Test
public void getEnclosingConstructor () throws SecurityException, NoSuchMethodException{
 if (verifyNoPropertyViolation()){
  Class cls = (new ClassTest.TestEnclosedClass()).foo.getClass();
  assertTrue(cls.getEnclosingConstructor().getDeclaringClass() == ClassTest.TestEnclosedClass.class);
  assertEquals(cls.getEnclosingConstructor().getName(), "<init>");
  assertNull(cls.getEnclosingMethod());
 }
}
origin: org.jruby/jruby-complete

@JRubyMethod
public IRubyObject enclosing_constructor() {
  Constructor<?> ctor = javaClass().getEnclosingConstructor();
  if (ctor != null) {
    return new JavaConstructor(getRuntime(), ctor);
  }
  return getRuntime().getNil();
}
origin: org.netbeans.api/org-jruby

@JRubyMethod
public IRubyObject enclosing_constructor() {
  Constructor<?> ctor = javaClass().getEnclosingConstructor();
  if (ctor != null) {
    return new JavaConstructor(getRuntime(), ctor);
  }
  return getRuntime().getNil();
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod
public IRubyObject enclosing_constructor() {
  Constructor<?> ctor = javaClass().getEnclosingConstructor();
  if (ctor != null) {
    return new JavaConstructor(getRuntime(), ctor);
  }
  return getRuntime().getNil();
}
origin: org.jruby/jruby-core

@JRubyMethod
public IRubyObject enclosing_constructor() {
  Constructor<?> ctor = javaClass().getEnclosingConstructor();
  if (ctor != null) {
    return new JavaConstructor(getRuntime(), ctor);
  }
  return getRuntime().getNil();
}
java.langClassgetEnclosingConstructor

Javadoc

Returns the enclosing Constructor of this Class, if it is an anonymous or local/automatic class; otherwise null.

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top Sublime Text 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