Easy test your endpoints within the Ide : there is a world icon on the rest controller click on it
Here you can add your sample request and run easily
If you need to mock some requests Mockoon is a very handy tool for it
Easy test your endpoints within the Ide : there is a world icon on the rest controller click on it
If you need to mock some requests Mockoon is a very handy tool for it
package com.company; | |
import java.math.BigInteger; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class TripletFounder { | |
public static void main(String[] args) { | |
Integer[] array = {3, 1, 4, 6, 5}; | |
double pow = (int) Math.pow(2, array.length); | |
for (int i = 0; i < pow; i++) { | |
List<Integer> subsSeqWithSize3 = new ArrayList<>(); | |
for (int j = 0; j < array.length; j++) { | |
if (BigInteger.valueOf(i).testBit(j)) { | |
System.out.print(array[j] + " "); | |
subsSeqWithSize3.add(array[j]); | |
} | |
} | |
if (subsSeqWithSize3.size() == 3) { | |
Collections.sort(subsSeqWithSize3); | |
if (Math.pow(subsSeqWithSize3.get(0), 2) + Math.pow(subsSeqWithSize3.get(1), 2) == Math.pow(subsSeqWithSize3.get(2), 2)) { | |
System.out.println("Found triplet = " + subsSeqWithSize3.toString()); | |
System.exit(0); | |
} | |
} | |
System.out.println(""); | |
} | |
} | |
} |
Wanna produce and consume from Kafka topics with SpringBoot ?
Wanna watch your Kafka Topics via Conductor ?
Wanna send some rest request to produce data to send your Kafka topic ?
Don't wanna write code ?
Just checkout and sit back :)
package com.example.customannotation; | |
import java.lang.annotation.*; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.List; | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.METHOD) | |
public @interface MyCustomAnnotation { | |
String name(); | |
String surname(); | |
} | |
class SomeClass { | |
@MyCustomAnnotation(name = "serkan", surname = "sunel") | |
public void someMethod(String someParameter) { | |
System.out.println("Hello annotation world !!" + someParameter); | |
} | |
} | |
class AnnotationProcessorWithReflection { | |
public static void main(String[] args) { | |
SomeClass someClass = new SomeClass(); | |
List<Method> methodsAnnotatedWith = getMethodsAnnotatedWith(someClass.getClass(), MyCustomAnnotation.class); | |
methodsAnnotatedWith.stream().forEach(m -> System.out.println(" Method name " + m.getName())); | |
} | |
private static List<Method> getMethodsAnnotatedWith(final Class<?> type, final Class<? extends Annotation> annotation) { | |
final List<Method> methods = new ArrayList<>(); | |
Class<?> klass = type; | |
while (klass != Object.class) { | |
for (final Method method : klass.getDeclaredMethods()) { | |
if (method.isAnnotationPresent(annotation)) { | |
Annotation annotInstance = method.getAnnotation(annotation); | |
System.out.println("annotInstance = " + annotInstance + " found on the class: " + type); | |
methods.add(method); | |
} | |
} | |
klass = klass.getSuperclass(); | |
} | |
return methods; | |
} | |
} |