Tabnine Logo
TypeInfo.getOpcode
Code IndexAdd Tabnine to your IDE (free)

How to use
getOpcode
method
in
jodd.proxetta.TypeInfo

Best Java code snippets using jodd.proxetta.TypeInfo.getOpcode (Showing top 20 results out of 315)

origin: oblac/jodd

/**
 * Returns <code>true</code> if method has a return type.
 */
default boolean hasReturnValue() {
  return getReturnType().getOpcode() != AsmUtil.TYPE_VOID;
}
origin: oblac/jodd

/**
 * Returns <code>true</code> if method's return type is <code>void</code>.
 */
default boolean hasNoReturnValue() {
  return getReturnType().getOpcode() == AsmUtil.TYPE_VOID;
}
origin: oblac/jodd

public static void loadMethodArgumentClass(final MethodVisitor mv, final MethodInfo methodInfo, final int index) {
  TypeInfo argument = methodInfo.getArgument(index);
  loadClass(mv, argument.getOpcode(), argument.getRawName());
}
origin: oblac/jodd

public static void storeMethodArgumentFromObject(final MethodVisitor mv, final MethodInfo methodInfo, final int index) {
  int type = methodInfo.getArgument(index).getOpcode();
  int offset = methodInfo.getArgumentOffset(index);
  storeValue(mv, offset, type);
}
origin: oblac/jodd

/**
 * Visits replacement code for {@link ProxyTarget#returnType()}.
 */
public static void returnType(final MethodVisitor mv, final MethodInfo methodInfo) {
  ProxettaAsmUtil.loadClass(mv, methodInfo.getReturnType().getOpcode(), methodInfo.getReturnType().getName());
}
origin: oblac/jodd

/**
 * Returns {@link WrapperProxetta} used for building loggable prepared statements.
 * Initializes proxetta when called for the first time.
 */
protected BaseLoggableFactory(final Class<T> targetClass) {
  this.targetClass = targetClass;
  this.proxetta = Proxetta.wrapperProxetta().withAspect(ProxyAspect.of(LoggableAdvice.class, methodInfo -> {
    int argumentsCount = methodInfo.getArgumentsCount();
    char argumentType = 0;
    if (argumentsCount >= 1) {
      argumentType = methodInfo.getArgument(1).getOpcode();
    }
    return
      methodInfo.getReturnType().getOpcode() == 'V' &&			// void-returning method
        argumentType == 'I' &&									// first argument type
        methodInfo.isPublicMethod() &&
        methodInfo.getMethodName().startsWith("set") &&			// set*
        (argumentsCount == 2 || argumentsCount == 3);			// number of arguments
  }));
}
origin: oblac/jodd

/**
 * Stores one argument. Index is 1-based. No conversion occurs.
 */
public static void storeMethodArgument(final MethodVisitor mv, final MethodInfo methodInfo, final int index) {
  int offset = methodInfo.getArgumentOffset(index);
  int type = methodInfo.getArgument(index).getOpcode();
  switch (type) {
    case 'V':
      break;
    case 'B':
    case 'C':
    case 'S':
    case 'I':
    case 'Z':
      mv.visitVarInsn(ISTORE, offset); break;
    case 'J':
      mv.visitVarInsn(LSTORE, offset); break;
    case 'F':
      mv.visitVarInsn(FSTORE, offset); break;
    case 'D':
      mv.visitVarInsn(DSTORE, offset); break;
    default:
      mv.visitVarInsn(ASTORE, offset);
  }
}
origin: oblac/jodd

/**
 * Loads one argument. Index is 1-based. No conversion occurs.
 */
public static void loadMethodArgument(final MethodVisitor mv, final MethodInfo methodInfo, final int index) {
  int offset = methodInfo.getArgumentOffset(index);
  int type = methodInfo.getArgument(index).getOpcode();
  switch (type) {
    case 'V':
      break;
    case 'B':
    case 'C':
    case 'S':
    case 'I':
    case 'Z':
      mv.visitVarInsn(ILOAD, offset);
      break;
    case 'J':
      mv.visitVarInsn(LLOAD, offset);
      break;
    case 'F':
      mv.visitVarInsn(FLOAD, offset);
      break;
    case 'D':
      mv.visitVarInsn(DLOAD, offset);
      break;
    default:
      mv.visitVarInsn(ALOAD, offset);
  }
}
origin: oblac/jodd

public static void castToReturnType(final MethodVisitor mv, final MethodInfo methodInfo) {
  final String returnType;
  char returnOpcodeType = methodInfo.getReturnType().getOpcode();
origin: oblac/jodd

switch (methodInfo.getReturnType().getOpcode()) {
  case 'V':
    mv.visitInsn(ACONST_NULL);
origin: oblac/jodd

@Test
void testMethodSignature4() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M4.class);
  assertEquals(2, msv.getArgumentsCount());
  assertEquals("java.lang.Long[]", msv.getArgument(1).getType());
  assertEquals("[L" + SIGNATURE_JAVA_LANG_LONG + ";", msv.getArgument(1).getName());
  assertEquals("[L" + SIGNATURE_JAVA_LANG_LONG + ";", msv.getArgument(1).getRawName());
  assertEquals('[', msv.getArgument(1).getOpcode());
  assertEquals("double[]", msv.getArgument(2).getType());
  assertEquals("[D", msv.getArgument(2).getName());
  assertEquals("[D", msv.getArgument(2).getRawName());
  assertEquals('[', msv.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M4", msv.getClassname());
  assertEquals("macka#([L" + SIGNATURE_JAVA_LANG_LONG + ";[D)[" + L_CLASS_SIGNATURE + "$M4;", msv.getCleanSignature());
  assertEquals("(java.lang.Long[], double[])jodd.proxetta.MethodSignatureVisitorTest$M4[]", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M4", msv.getDeclaredClassName());
  assertEquals("([Ljava/lang/Long;[D)[Ljodd/proxetta/MethodSignatureVisitorTest$M4;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('[', msv.getReturnType().getOpcode());
  assertEquals("jodd.proxetta.MethodSignatureVisitorTest$M4[]", msv.getReturnType().getType());
  assertEquals("[Ljodd/proxetta/MethodSignatureVisitorTest$M4;", msv.getReturnType().getName());
  assertEquals("[Ljodd/proxetta/MethodSignatureVisitorTest$M4;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature5() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M5.class);
  assertEquals(2, msv.getArgumentsCount());
  assertEquals("java.util.Set<Gen>", msv.getArgument(1).getType());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getName());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals("T[]", msv.getArgument(2).getType());
  assertEquals("[T", msv.getArgument(2).getName());
  assertEquals("[Ljava/lang/Object;", msv.getArgument(2).getRawName());
  assertEquals('[', msv.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M5", msv.getClassname());
  assertEquals("macka#(Ljava/util/Set;[Ljava/lang/Object;)Ljava/util/List;", msv.getCleanSignature());
  assertEquals("(java.util.Set<Gen>, T[])java.util.List<Gen>", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M5", msv.getDeclaredClassName());
  assertEquals("(Ljava/util/Set;[Ljava/lang/Object;)Ljava/util/List;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('L', msv.getReturnType().getOpcode());
  assertEquals("java.util.List<Gen>", msv.getReturnType().getType());
  assertEquals("Ljava/util/List;", msv.getReturnType().getName());
  assertEquals("Ljava/util/List;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature2() throws IOException {
  MethodInfo mi = getMethodSignatureForSingleMethod(M2.class);
  assertEquals(2, mi.getArgumentsCount());
  assertEquals("long", mi.getArgument(1).getType());
  assertEquals("J", mi.getArgument(1).getName());
  assertEquals("J", mi.getArgument(1).getRawName());
  assertEquals('J', mi.getArgument(1).getOpcode());
  assertEquals("double", mi.getArgument(2).getType());
  assertEquals("D", mi.getArgument(2).getName());
  assertEquals("D", mi.getArgument(2).getRawName());
  assertEquals('D', mi.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M2", mi.getClassname());
  assertEquals("macka#(JD)I", mi.getCleanSignature());
  assertEquals("(long, double)int", mi.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M2", mi.getDeclaredClassName());
  assertEquals("(JD)I", mi.getDescription());
  assertNull(mi.getExceptions());
  assertEquals("macka", mi.getMethodName());
  assertEquals('I', mi.getReturnType().getOpcode());
  assertEquals("int", mi.getReturnType().getType());
  assertEquals("I", mi.getReturnType().getName());
  assertEquals("I", mi.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature3() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M3.class);
  assertEquals(2, msv.getArgumentsCount());
  assertEquals("java.lang.Long", msv.getArgument(1).getType());
  assertEquals("L" + SIGNATURE_JAVA_LANG_LONG + ";", msv.getArgument(1).getName());
  assertEquals("L" + SIGNATURE_JAVA_LANG_LONG + ";", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals("java.lang.Double", msv.getArgument(2).getType());
  assertEquals("L" + SIGNATURE_JAVA_LANG_DOUBLE + ";", msv.getArgument(2).getName());
  assertEquals("L" + SIGNATURE_JAVA_LANG_DOUBLE + ";", msv.getArgument(2).getRawName());
  assertEquals('L', msv.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M3", msv.getClassname());
  assertEquals("macka#(L" + SIGNATURE_JAVA_LANG_LONG + ";L" + SIGNATURE_JAVA_LANG_DOUBLE + ";)L" + SIGNATURE_JAVA_LANG_INTEGER + ";", msv.getCleanSignature());
  assertEquals("(java.lang.Long, java.lang.Double)java.lang.Integer", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M3", msv.getDeclaredClassName());
  assertEquals("(Ljava/lang/Long;Ljava/lang/Double;)Ljava/lang/Integer;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('L', msv.getReturnType().getOpcode());
  assertEquals("java.lang.Integer", msv.getReturnType().getType());
  assertEquals("Ljava/lang/Integer;", msv.getReturnType().getName());
  assertEquals("Ljava/lang/Integer;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature6() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M6.class);
  assertEquals(2, msv.getArgumentsCount());
  assertEquals("java.util.Set<Gen>", msv.getArgument(1).getType());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getName());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals("Tuta[]", msv.getArgument(2).getType());
  assertEquals("[Tuta", msv.getArgument(2).getName());
  assertEquals("[Ljava/lang/Object;", msv.getArgument(2).getRawName());
  assertEquals('[', msv.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M6", msv.getClassname());
  assertEquals("macka#(Ljava/util/Set;[Ljava/lang/Object;)[Ljava/lang/Object;", msv.getCleanSignature());
  assertEquals("(java.util.Set<Gen>, Tuta[])Gen[]", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M6", msv.getDeclaredClassName());
  assertEquals("(Ljava/util/Set;[Ljava/lang/Object;)[Ljava/lang/Object;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('[', msv.getReturnType().getOpcode());
  assertEquals("Gen[]", msv.getReturnType().getType());
  assertEquals("[Gen", msv.getReturnType().getName());
  assertEquals("[Ljava/lang/Object;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature7() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M7.class);
  assertEquals(2, msv.getArgumentsCount());
  assertEquals("java.util.Set<Gen>", msv.getArgument(1).getType());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getName());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals("T[]", msv.getArgument(2).getType());
  assertEquals("[T", msv.getArgument(2).getName());
  assertEquals("[Ljava/lang/Object;", msv.getArgument(2).getRawName());
  assertEquals('[', msv.getArgument(2).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M7", msv.getClassname());
  assertEquals("macka#(Ljava/util/Set;[Ljava/lang/Object;)[Ljava/lang/Object;", msv.getCleanSignature());
  assertEquals("<T>(java.util.Set<Gen>, T[])T[]", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M7", msv.getDeclaredClassName());
  assertEquals("(Ljava/util/Set;[Ljava/lang/Object;)[Ljava/lang/Object;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('[', msv.getReturnType().getOpcode());
  assertEquals("T[]", msv.getReturnType().getType());
  assertEquals("[T", msv.getReturnType().getName());
  assertEquals("[Ljava/lang/Object;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature11() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M11.class);
  assertEquals(1, msv.getArgumentsCount());
  assertEquals("java.util.Set<java.util.List<java.util.Map<java.lang.String, java.lang.Object>>>", msv.getArgument(1).getType());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getName());
  assertEquals("Ljava/util/Set;", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M11", msv.getClassname());
  assertEquals("macka#(Ljava/util/Set;)Ljava/util/List;", msv.getCleanSignature());
  assertEquals("(java.util.Set<java.util.List<java.util.Map<java.lang.String, java.lang.Object>>>)java.util.List<java.util.Map<java.lang.String, java.lang.Object>>", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M11", msv.getDeclaredClassName());
  assertEquals("(Ljava/util/Set;)Ljava/util/List;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('L', msv.getReturnType().getOpcode());
  assertEquals("java.util.List<java.util.Map<java.lang.String, java.lang.Object>>", msv.getReturnType().getType());
  assertEquals("Ljava/util/List;", msv.getReturnType().getName());
  assertEquals("Ljava/util/List;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature12() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M12.class);
  assertEquals(1, msv.getArgumentsCount());
  assertEquals(CLASS_NAME + "$Tupel<java.util.List<java.lang.Integer>, java.lang.Integer>", msv.getArgument(1).getType());
  assertEquals(L_CLASS_SIGNATURE + "$Tupel;", msv.getArgument(1).getName());
  assertEquals(L_CLASS_SIGNATURE + "$Tupel;", msv.getArgument(1).getRawName());
  assertEquals('L', msv.getArgument(1).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M12", msv.getClassname());
  assertEquals("macka#(" + L_CLASS_SIGNATURE + "$Tupel;)Ljava/util/Map;", msv.getCleanSignature());
  assertEquals("(" + CLASS_NAME + "$Tupel<java.util.List<java.lang.Integer>, java.lang.Integer>)java.util.Map<java.util.Map<java.util.Set<java.lang.Integer>, java.lang.Long>, java.lang.Byte>", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M12", msv.getDeclaredClassName());
  assertEquals("(" + L_CLASS_SIGNATURE + "$Tupel;)Ljava/util/Map;", msv.getDescription());
  assertNull(msv.getExceptions());
  assertEquals("macka", msv.getMethodName());
  assertEquals('L', msv.getReturnType().getOpcode());
  assertEquals("java.util.Map<java.util.Map<java.util.Set<java.lang.Integer>, java.lang.Long>, java.lang.Byte>", msv.getReturnType().getType());
  assertEquals("Ljava/util/Map;", msv.getReturnType().getName());
  assertEquals("Ljava/util/Map;", msv.getReturnType().getRawName());
}
origin: oblac/jodd

@Test
void testMethodSignature9() throws IOException {
  MethodInfo msv = getMethodSignatureForSingleMethod(M9.class);
  assertEquals(1, msv.getArgumentsCount());
  assertEquals("java.lang.String[]", msv.getArgument(1).getType());
  assertEquals("[Ljava/lang/String;", msv.getArgument(1).getName());
  assertEquals("[Ljava/lang/String;", msv.getArgument(1).getRawName());
  assertEquals('[', msv.getArgument(1).getOpcode());
  assertEquals(CLASS_SIGNATURE + "$M9", msv.getClassname());
  assertEquals("main#([Ljava/lang/String;)V", msv.getCleanSignature());
  assertEquals("(java.lang.String[])void", msv.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M9", msv.getDeclaredClassName());
  assertEquals("([Ljava/lang/String;)V", msv.getDescription());
  assertEquals("main", msv.getMethodName());
}
origin: oblac/jodd

@Test
void testMethodSignature1() throws IOException {
  MethodInfo mi = getMethodSignatureForSingleMethod(M1.class);
  assertEquals(0, mi.getArgumentsCount());
  assertEquals(CLASS_SIGNATURE + "$M1", mi.getClassname());
  assertEquals("macka#()V", mi.getCleanSignature());
  assertEquals("()void", mi.getDeclaration());
  assertEquals(CLASS_SIGNATURE + "$M1", mi.getDeclaredClassName());
  assertEquals("()V", mi.getDescription());
  assertNull(mi.getExceptions());
  assertEquals("macka", mi.getMethodName());
  assertEquals('V', mi.getReturnType().getOpcode());
  assertEquals("void", mi.getReturnType().getType());
  assertEquals("V", mi.getReturnType().getName());
  assertEquals("V", mi.getReturnType().getRawName());
}
jodd.proxettaTypeInfogetOpcode

Javadoc

Returns bytecode opcode.

Popular methods of TypeInfo

  • getName
    Returns bytecode-like type name, e.g. "Ljava/lang/Integer;". Note that generics type names are not r
  • getRawName
    Returns bytecode-like type name, e.g. "Ljava/lang/Integer;".
  • getType
    Returns java-like, e.g. "java.lang.Integer".
  • getAnnotations
    Returns annotation info of type. SOme types (like for returning value) can't have annotation informa

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Path (java.nio.file)
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • 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