Example usage for org.springframework.util Assert isInstanceOf

List of usage examples for org.springframework.util Assert isInstanceOf

Introduction

In this page you can find the example usage for org.springframework.util Assert isInstanceOf.

Prototype

public static void isInstanceOf(Class<?> type, @Nullable Object obj) 

Source Link

Document

Assert that the provided object is an instance of the provided class.

Usage

From source file:com.wavemaker.commons.io.AbstractReadOnlyFile.java

@Override
@SuppressWarnings("unchecked")
public <R extends Resource, O extends ResourceOperation<R>> O performOperation(O operation) {
    Class<?> typeArgument = GenericTypeResolver.resolveTypeArgument(operation.getClass(),
            ResourceOperation.class);
    Assert.isInstanceOf(typeArgument, this);
    operation.perform((R) this);
    return operation;
}

From source file:io.twipple.springframework.data.clusterpoint.convert.ClusterpointDocumentPropertyAccessor.java

@Override
public boolean canWrite(@NotNull EvaluationContext context, @NotNull Object target, @NotNull String name)
        throws AccessException {

    Assert.notNull(context);/*from w w  w  .j a  v a2  s  .com*/
    Assert.notNull(target);
    Assert.isInstanceOf(ClusterpointDocument.class, target);
    Assert.hasText(name);

    ClusterpointDocument source = (ClusterpointDocument) target;

    return source.canWrite(context, name);
}

From source file:example.app.function.CustomerFunctions.java

@SuppressWarnings("unchecked")
protected List<Customer> executeQueryInFunctionContext(RegionFunctionContext functionContext) {
    try {//from ww w  . j  av a2s . c  om
        QueryService queryService = getQueryService(functionContext);
        Query query = queryService.newQuery(CUSTOMERS_WITH_CONTACTS_QUERY);
        Object results = query.execute(functionContext);

        Assert.isInstanceOf(SelectResults.class, results);

        return ((SelectResults<Customer>) results).asList();
    } catch (Exception e) {
        throw new DataRetrievalFailureException("Failed to find Customers with Contact information", e);
    }
}

From source file:opensnap.security.SecurityChannelInterceptor.java

private boolean browseMap(Map<String, Object> map, String destinationRoot, String destination,
        List<String> userRoles) {
    for (String key : map.keySet()) {
        Object value = map.get(key);
        if (value instanceof String) {
            List<String> allowedRoles = Arrays.asList(((String) value).split(","));
            if (key.endsWith("*")) {
                if (destination.startsWith(destinationRoot + key.substring(0, key.length() - 1))) {
                    return !Collections.disjoint(userRoles, allowedRoles);
                }// w ww  .  j a v  a  2  s.co  m
            } else if (destination.equals(destinationRoot + key)) {
                return !Collections.disjoint(userRoles, allowedRoles);
            }
        } else {
            Assert.isInstanceOf(Map.class, value);
            if (browseMap((Map) value, destinationRoot + key + "/", destination, userRoles)) {
                return true;
            }
        }
    }
    return false;
}

From source file:org.openregistry.core.domain.jpa.JpaDisclosureSettingsForAddressImpl.java

/**
 * Initializing constructor//from ww  w.ja  va  2s.co  m
 * @param role
 */
public JpaDisclosureSettingsForAddressImpl(JpaDisclosureSettingsImpl disclosure, Type addressType,
        Type affType) {
    Assert.notNull(disclosure);
    Assert.isInstanceOf(JpaTypeImpl.class, addressType);
    Assert.isInstanceOf(JpaTypeImpl.class, affType);
    this.disclosureRecord = disclosure;
    this.addressType = (JpaTypeImpl) addressType;
    this.affiliationType = (JpaTypeImpl) affType;
}

From source file:org.openregistry.core.domain.jpa.JpaNameImpl.java

public void setType(final Type type) {
    Assert.isInstanceOf(JpaTypeImpl.class, type);
    this.type = (JpaTypeImpl) type;
}

From source file:io.twipple.springframework.data.clusterpoint.convert.ClusterpointDocumentPropertyAccessor.java

@Override
public void write(@NotNull EvaluationContext context, @NotNull Object target, @NotNull String name,
        Object newValue) throws AccessException {

    Assert.notNull(context);/*from w w  w  .j av  a 2 s.c  o m*/
    Assert.notNull(target);
    Assert.isInstanceOf(ClusterpointDocument.class, target);
    Assert.hasText(name);

    ClusterpointDocument source = (ClusterpointDocument) target;

    source.write(context, name, newValue);
}

From source file:org.openregistry.core.domain.jpa.sor.JpaSorPhoneImpl.java

public void setAddressType(final Type addressType) {
    Assert.isInstanceOf(JpaTypeImpl.class, addressType);
    this.addressType = (JpaTypeImpl) addressType;
}

From source file:org.openregistry.core.domain.jpa.sor.JpaSorPhoneImpl.java

public void setPhoneType(final Type phoneType) {
    Assert.isInstanceOf(JpaTypeImpl.class, phoneType);
    this.phoneType = (JpaTypeImpl) phoneType;
}

From source file:org.synyx.hades.dao.orm.GenericDaoFactoryBean.java

public void setBeanFactory(BeanFactory beanFactory) {

    Assert.isInstanceOf(ListableBeanFactory.class, beanFactory);

    this.txPostProcessor = new TransactionalDaoProxyPostProcessor((ListableBeanFactory) beanFactory,
            transactionManagerName);/*from  w ww. j  av a  2  s  .  c  om*/
}