List of usage examples for org.springframework.util Assert isInstanceOf
public static void isInstanceOf(Class<?> type, @Nullable Object obj)
From source file:org.openregistry.core.domain.jpa.sor.JpaSorEmailAddressImpl.java
public void setAddressType(final Type type) { Assert.isInstanceOf(JpaTypeImpl.class, type); this.addressType = (JpaTypeImpl) type; }
From source file:com.apporiented.spring.override.MapMergeProcessor.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { BeanDefinition bd = beanFactory.getBeanDefinition(ref); if (property == null) { Assert.state(MapFactoryBean.class.getName().equals(bd.getBeanClassName()), "Bean [" + ref + "] must be a MapFactoryBean"); property = "sourceMap"; }//from w w w .j a va 2s . co m if (log.isInfoEnabled()) { String keys = StringUtils.collectionToCommaDelimitedString(entries.keySet()); log.debug("Adding [" + keys + "] to " + ref + "." + property); } PropertyValue pv = bd.getPropertyValues().getPropertyValue(property); if (pv == null) { // No map set on the target bean, create a new one ... ManagedMap map = new ManagedMap(); map.putAll(entries); bd.getPropertyValues().addPropertyValue(property, map); } else { Object value = pv.getValue(); if (value instanceof RuntimeBeanReference) { RuntimeBeanReference ref = (RuntimeBeanReference) value; value = beanFactory.getBean(ref.getBeanName()); } Assert.isInstanceOf(Map.class, value); Map map = (Map) value; map.putAll(entries); } }
From source file:org.openregistry.core.domain.jpa.JpaDisclosureSettingsForUrlImpl.java
/** * Initializing constructor/*from w ww .j a v a 2s. c o m*/ * @param role */ public JpaDisclosureSettingsForUrlImpl(JpaDisclosureSettingsImpl disclosure, Type type, Type affType) { Assert.notNull(disclosure); Assert.isInstanceOf(JpaTypeImpl.class, type); Assert.isInstanceOf(JpaTypeImpl.class, affType); this.disclosureRecord = disclosure; this.type = (JpaTypeImpl) type; this.affiliationType = (JpaTypeImpl) affType; }
From source file:org.openregistry.core.domain.jpa.JpaDisclosureSettingsForEmailImpl.java
/** * Initializing constructor/* www .j a v a 2 s . co m*/ */ public JpaDisclosureSettingsForEmailImpl(JpaDisclosureSettingsImpl disclosure, Type type, Type affType) { Assert.notNull(disclosure); Assert.isInstanceOf(JpaTypeImpl.class, type); Assert.isInstanceOf(JpaTypeImpl.class, affType); this.disclosureRecord = disclosure; this.type = (JpaTypeImpl) type; this.affiliationType = (JpaTypeImpl) affType; }
From source file:com.apporiented.spring.override.ListMergeProcessor.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { BeanDefinition bd = beanFactory.getBeanDefinition(ref); if (property == null) { //Assert.state(ListFactoryBean.class.getName().equals(bd.getBeanClassName()), // "Bean [" + ref + "] must be a ListFactoryBean"); property = "sourceList"; }/*from w w w .j a v a 2s . c o m*/ log.debug("Adding " + values.size() + " items to " + ref + "." + property + ": " + values); PropertyValue pv = bd.getPropertyValues().getPropertyValue(property); if (pv == null) { // No list set on the target bean, create a new one ... ManagedList list = new ManagedList(); list.addAll(values); bd.getPropertyValues().addPropertyValue(property, list); } else { Object value = pv.getValue(); if (value instanceof RuntimeBeanReference) { RuntimeBeanReference ref = (RuntimeBeanReference) value; value = beanFactory.getBean(ref.getBeanName()); } else if (value instanceof TypedStringValue) { TypedStringValue tsv = (TypedStringValue) value; ManagedList list = new ManagedList(); list.addAll(values); list.add(tsv.getValue()); bd.getPropertyValues().addPropertyValue(property, list); return; } Assert.isInstanceOf(List.class, value); List list = (List) value; if (append) { list.addAll(values); } else { for (int i = values.size() - 1; i >= 0; i--) { list.add(0, values.get(i)); } } } }
From source file:io.jmnarloch.spring.cloud.stream.binder.hermes.HermesClientBinder.java
@Override protected Binding<MessageChannel> doBindProducer(String name, MessageChannel channel, ExtendedProducerProperties<HermesProducerProperties> properties) { Assert.isInstanceOf(SubscribableChannel.class, channel); logger.debug("Binding Hermes client to topic " + name); final MessageHandler handler = new HermesSendingHandler(name); final EventDrivenConsumer consumer = createConsumer(name, (SubscribableChannel) channel, handler); consumer.start();/*from ww w. j av a 2 s. c om*/ return toBinding(name, channel, consumer); }
From source file:io.twipple.springframework.data.clusterpoint.convert.ClusterpointDocumentPropertyAccessor.java
/** * Read the value from the property.//from w w w . ja va 2 s . c o m * * @param context the evaluation context. * @param target the target object. * @param name the name of the property. * @return the typed value of the content to be read. */ @Override public TypedValue read(@NotNull EvaluationContext context, @NotNull Object target, @NotNull String name) { Assert.notNull(context); Assert.notNull(target); Assert.isInstanceOf(ClusterpointDocument.class, target); Assert.hasText(name); ClusterpointDocument source = (ClusterpointDocument) target; Object value = source.read(context, name); return value == null ? TypedValue.NULL : new TypedValue(value); }
From source file:com.sinosoft.one.data.jpa.repository.support.OneTransactionalRepositoryFactoryBeanSupport.java
public void setBeanFactory(BeanFactory beanFactory) { Assert.isInstanceOf(ListableBeanFactory.class, beanFactory); this.txPostProcessor = new OneTransactionalRepositoryProxyPostProcessor((ListableBeanFactory) beanFactory, transactionManagerName, sqlQueries); }
From source file:org.openregistry.core.domain.jpa.JpaDisclosureSettingsForPhoneImpl.java
/** * Initializing constructor//from w w w . j a v a2 s .c o m * @param role */ public JpaDisclosureSettingsForPhoneImpl(JpaDisclosureSettingsImpl disclosure, Type addressType, Type phoneType, Type affType) { Assert.notNull(disclosure); Assert.isInstanceOf(JpaTypeImpl.class, addressType); Assert.isInstanceOf(JpaTypeImpl.class, phoneType); Assert.isInstanceOf(JpaTypeImpl.class, affType); this.disclosureRecord = disclosure; this.addressType = (JpaTypeImpl) addressType; this.phoneType = (JpaTypeImpl) phoneType; this.affiliationType = (JpaTypeImpl) affType; }
From source file:org.apache.cxf.fediz.spring.preauth.PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
@Override public UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException { Assert.notNull(token.getDetails());//from w ww . ja v a2 s.co m Assert.isInstanceOf(PreAuthenticatedAuthenticationToken.class, token); Assert.isInstanceOf(GrantedAuthoritiesContainer.class, token.getDetails()); Assert.isInstanceOf(FedizPrincipal.class, token.getPrincipal()); GrantedAuthority[] authorities = ((GrantedAuthoritiesContainer) token.getDetails()).getGrantedAuthorities(); return createuserDetails(token, authorities, ((FedizPrincipal) token.getPrincipal()).getClaims()); }