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:org.openregistry.core.domain.jpa.JpaPersonImpl.java

public IdCard addIDCard(IdCard idCard) {
    Assert.isInstanceOf(JpaIdCardImpl.class, idCard);
    JpaIdCardImpl card = new JpaIdCardImpl(this, idCard.getCardNumber(), idCard.getCardSecurityValue(),
            idCard.getBarCode());/*  ww  w  . j  ava 2  s . c  om*/
    card.setPrimary(idCard.isPrimary());
    card.setProximityNumber(idCard.getProximityNumber());
    card.setExpirationDate(card.getExpirationDate());
    //todo revist start date
    this.idCards.add(card);
    return card;

}

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

public void addAddress(Address address) {
    Assert.isInstanceOf(JpaSorAddressImpl.class, address);
    this.addresses.add(address);
}

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

public void setAffiliationType(Type affiliationType) {
    Assert.isInstanceOf(JpaTypeImpl.class, affiliationType);
    this.affiliationType = (JpaTypeImpl) affiliationType;
}

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

public void expireNow(final Type terminationReason, final boolean orphaned) {
    Assert.isInstanceOf(JpaTypeImpl.class, terminationReason);
    //        Assert.isTrue(this.end == null || this.end.compareTo(new Date()) < 0, "this role has already been expired."); expire it again even if it is already expire
    this.end = new Date();
    this.terminationReason = terminationReason;
    if (orphaned) {
        this.sorRoleId = null;
    }/*ww w. j a  v  a 2 s . c  om*/
}

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

public void addEmailAddress(EmailAddress emailAddress) {
    Assert.isInstanceOf(JpaSorEmailAddressImpl.class, emailAddress);
    this.emailAddresses.add(emailAddress);
}

From source file:org.LexGrid.LexBIG.caCore.test.rest.RESTTest.java

public void testRESTXMLWithWrongCodingSchemeParameter() throws Exception {
    try {//from www.  ja va 2 s  . c  o  m
        callRestfulService(
                "GetXML?query=org.LexGrid.codingSchemes.CodingScheme&org.LexGrid.codingSchemes.CodingScheme&codingSchemeName=INVALID_CODING_SCHEME");
    } catch (Exception e) {
        Assert.isInstanceOf(FileNotFoundException.class, e);
        return;
    }
    fail();
}

From source file:org.LexGrid.LexBIG.caCore.test.rest.RESTTest.java

public void testRESTHTMLWithWrongCodingSchemeParameter() throws Exception {
    try {//from  w w w  .j av  a2  s.  c  o m
        callRestfulService(
                "GetHTML?query=org.LexGrid.codingSchemes.CodingScheme&org.LexGrid.codingSchemes.CodingScheme&codingSchemeName=INVALID_CODING_SCHEME");
    } catch (Exception e) {
        Assert.isInstanceOf(FileNotFoundException.class, e);

        return;
    }
    fail();
}

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

public void addPhone(Phone phone) {
    Assert.isInstanceOf(JpaSorPhoneImpl.class, phone);
    this.phones.add(phone);
}

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

public void addUrl(Url url) {
    Assert.isInstanceOf(JpaSorUrlImpl.class, url);
    this.urls.add(url);
}

From source file:org.LexGrid.LexBIG.caCore.test.rest.RESTTest.java

public void testRESTXMLWithWrongCodingSchemeAndVersionParameter() throws Exception {
    try {/* w w  w. ja  va2  s.  c  o  m*/
        callRestfulService(
                "GetXML?query=org.LexGrid.codingSchemes.CodingScheme&org.LexGrid.codingSchemes.CodingScheme&codingSchemeName="
                        + ServiceTestCase.THES_SCHEME + "&codingSchemeVersion=INVALID_VERSION");
    } catch (Exception e) {
        Assert.isInstanceOf(FileNotFoundException.class, e);
        return;
    }
    fail();
}