/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
/** * Factory to create the identity predicate. * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate getInstance(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } return new InstanceofPredicate(type); }
@Override @SuppressWarnings("unchecked") public <T> Collection<T> lookupObjects(Class<T> returntype) { return (Collection<T>) registryMap.select(new InstanceofPredicate(returntype)); }
@SuppressWarnings("unchecked") public <T> Collection<T> lookupObjects(Class<T> returntype) { return (Collection<T>) registryMap.select(new InstanceofPredicate(returntype)); }
/** * Internal helper to generate correctly generic typed {@link Iterator}s for * filtered {@link Span} types * @param interfaze the Span interface e.g. {@link Token} * @param clazz the actual Span implementation e.g. {@link TokenImpl} * @return the {@link Iterator} of type {interface} iterating over * {implementation} instances (e.g. * <code>{@link Iterator}<{@link Token}></code> returning * <code>{@link TokenImpl}</code> instances on calls to {@link Iterator#next()} */ @SuppressWarnings("unchecked") protected <T extends Span> Iterator<T> filter( final Class<T> clazz){ return IteratorUtils.filteredIterator( getIterator(), new InstanceofPredicate(clazz)); }
/** * Internal helper to generate correctly generic typed {@link Iterator}s for * filtered {@link Span} types * @param interfaze the Span interface e.g. {@link Token} * @param clazz the actual Span implementation e.g. {@link TokenImpl} * @return the {@link Iterator} of type {interface} iterating over * {implementation} instances (e.g. * <code>{@link Iterator}<{@link Token}></code> returning * <code>{@link TokenImpl}</code> instances on calls to {@link Iterator#next()} */ @SuppressWarnings("unchecked") protected <T extends Span> Iterator<T> filter( final Class<T> clazz){ return IteratorUtils.filteredIterator( getIterator(), new InstanceofPredicate(clazz)); }
Document document = resolveDocument(request); StyleContainer styleContainer = (StyleContainer)CollectionUtils.find(document.getHead().getChildren(), new InstanceofPredicate(StyleContainer.class)); if(styleContainer==null){ styleContainer = new StyleContainer();