List of usage examples for java.util.function Predicate getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:uk.gov.gchq.gaffer.schemabuilder.service.SchemaBuilderService.java
@SuppressFBWarnings("REC_CATCH_EXCEPTION") @POST// w w w . j a va 2s .c o m @Path("/functions") public FunctionsResponse getFunctions(final TypeNameClass type) { if (StringUtils.isNotEmpty(type.getTypeClass())) { final Class<?> clazz; try { clazz = Class.forName(type.getTypeClass()); } catch (final Exception e) { return new FunctionsResponse( type.getTypeName() + ": type class " + type.getTypeClass() + " was not recognised."); } final List<Class> serialiserClasses = new ArrayList<>(); for (final Serialiser serialise : SERIALISERS) { if (serialise.canHandle(clazz)) { serialiserClasses.add(serialise.getClass()); } } final List<Class> validateClasses = new ArrayList<>(); for (final Predicate function : VALIDATION_FUNCTIONS) { try { final Signature signature = Signature.getInputSignature(function); if (signature.assignable(clazz).isValid()) { validateClasses.add(function.getClass()); } } catch (final Exception e) { // just add the function. validateClasses.add(function.getClass()); } } final List<Class> aggregateClasses = new ArrayList<>(); for (final BinaryOperator function : AGGREGATE_FUNCTIONS) { final Signature signature = Signature.getInputSignature(function); if (signature.assignable(clazz).isValid()) { aggregateClasses.add(function.getClass()); } } return new FunctionsResponse(serialiserClasses, validateClasses, aggregateClasses); } return new FunctionsResponse(type.getTypeName() + ": type class is required."); }