diff --git a/etc/formatting.xml b/etc/formatting.xml new file mode 100644 index 000000000..c74468778 --- /dev/null +++ b/etc/formatting.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java index 3f329d226..49b7c70ed 100644 --- a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java +++ b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java @@ -58,10 +58,8 @@ public class MongoChangeSetPersister implements ChangeSetPersister { this.entityManagerFactory = entityManagerFactory; } - - public void getPersistentState(Class entityClass, - Object id, final ChangeSet changeSet) - throws DataAccessException, NotFoundException { + public void getPersistentState(Class entityClass, Object id, final ChangeSet changeSet) + throws DataAccessException, NotFoundException { if (id == null) { log.debug("Unable to load MongoDB data for null id"); @@ -77,8 +75,7 @@ public class MongoChangeSetPersister implements ChangeSetPersister { log.debug("Loading MongoDB data for " + dbk); } mongoTemplate.execute(collName, new CollectionCallback() { - public Object doInCollection(DBCollection collection) - throws MongoException, DataAccessException { + public Object doInCollection(DBCollection collection) throws MongoException, DataAccessException { for (DBObject dbo : collection.find(dbk)) { String key = (String) dbo.get(ENTITY_FIELD_NAME); if (log.isDebugEnabled()) { @@ -87,9 +84,8 @@ public class MongoChangeSetPersister implements ChangeSetPersister { if (!changeSet.getValues().containsKey(key)) { String className = (String) dbo.get(ENTITY_FIELD_CLASS); if (className == null) { - throw new DataIntegrityViolationException( - "Unble to convert property " + key - + ": Invalid metadata, " + ENTITY_FIELD_CLASS + " not available"); + throw new DataIntegrityViolationException("Unble to convert property " + key + ": Invalid metadata, " + + ENTITY_FIELD_CLASS + " not available"); } Class clazz = ClassUtils.resolveClassName(className, ClassUtils.getDefaultClassLoader()); Object value = mongoTemplate.getConverter().read(clazz, dbo); @@ -135,10 +131,8 @@ public class MongoChangeSetPersister implements ChangeSetPersister { dbQuery.put(ENTITY_ID, getPersistentId(entity, cs)); dbQuery.put(ENTITY_CLASS, entity.getClass().getName()); dbQuery.put(ENTITY_FIELD_NAME, key); - DBObject dbId = mongoTemplate.execute(collName, - new CollectionCallback() { - public DBObject doInCollection(DBCollection collection) - throws MongoException, DataAccessException { + DBObject dbId = mongoTemplate.execute(collName, new CollectionCallback() { + public DBObject doInCollection(DBCollection collection) throws MongoException, DataAccessException { return collection.findOne(dbQuery); } }); @@ -147,14 +141,12 @@ public class MongoChangeSetPersister implements ChangeSetPersister { log.debug("Flush: removing: " + dbQuery); } mongoTemplate.execute(collName, new CollectionCallback() { - public Object doInCollection(DBCollection collection) - throws MongoException, DataAccessException { + public Object doInCollection(DBCollection collection) throws MongoException, DataAccessException { collection.remove(dbQuery); return null; } }); - } - else { + } else { final DBObject dbDoc = new BasicDBObject(); dbDoc.putAll(dbQuery); if (log.isDebugEnabled()) { @@ -166,8 +158,7 @@ public class MongoChangeSetPersister implements ChangeSetPersister { dbDoc.put("_id", dbId.get("_id")); } mongoTemplate.execute(collName, new CollectionCallback() { - public Object doInCollection(DBCollection collection) - throws MongoException, DataAccessException { + public Object doInCollection(DBCollection collection) throws MongoException, DataAccessException { collection.save(dbDoc); return null; } diff --git a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoDocumentBacking.aj b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoDocumentBacking.aj index 49d5295a8..5bb05290f 100644 --- a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoDocumentBacking.aj +++ b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoDocumentBacking.aj @@ -38,235 +38,234 @@ import org.springframework.data.crossstore.HashMapChangeSet; import org.springframework.transaction.support.TransactionSynchronizationManager; /** - * Aspect to turn an object annotated with @Document into a persistent document - * using Mongo. + * Aspect to turn an object annotated with @Document into a persistent document using Mongo. * * @author Thomas Risberg */ public aspect MongoDocumentBacking { - private static final Log LOGGER = LogFactory - .getLog(MongoDocumentBacking.class); + private static final Log LOGGER = LogFactory.getLog(MongoDocumentBacking.class); - // Aspect shared config - private ChangeSetPersister changeSetPersister; + // Aspect shared config + private ChangeSetPersister changeSetPersister; - public void setChangeSetPersister( - ChangeSetPersister changeSetPersister) { - this.changeSetPersister = changeSetPersister; - } + public void setChangeSetPersister(ChangeSetPersister changeSetPersister) { + this.changeSetPersister = changeSetPersister; + } - // ITD to introduce N state to Annotated objects - declare parents : (@Entity *) implements DocumentBacked; + // ITD to introduce N state to Annotated objects + declare parents : (@Entity *) implements DocumentBacked; - // The annotated fields that will be persisted in MongoDB rather than with JPA - declare @field: @RelatedDocument * (@Entity+ *).*:@Transient; + // The annotated fields that will be persisted in MongoDB rather than with JPA + declare @field: @RelatedDocument * (@Entity+ *).*:@Transient; - // ------------------------------------------------------------------------- - // Advise user-defined constructors of ChangeSetBacked objects to create a new - // backing ChangeSet - // ------------------------------------------------------------------------- - pointcut arbitraryUserConstructorOfChangeSetBackedObject(DocumentBacked entity) : + // ------------------------------------------------------------------------- + // Advise user-defined constructors of ChangeSetBacked objects to create a new + // backing ChangeSet + // ------------------------------------------------------------------------- + pointcut arbitraryUserConstructorOfChangeSetBackedObject(DocumentBacked entity) : execution((DocumentBacked+).new(..)) && !execution((DocumentBacked+).new(ChangeSet)) && this(entity); - pointcut finderConstructorOfChangeSetBackedObject(DocumentBacked entity, - ChangeSet cs) : + pointcut finderConstructorOfChangeSetBackedObject(DocumentBacked entity, ChangeSet cs) : execution((DocumentBacked+).new(ChangeSet)) && this(entity) && args(cs); - protected pointcut entityFieldGet(DocumentBacked entity) : + protected pointcut entityFieldGet(DocumentBacked entity) : get(@RelatedDocument * DocumentBacked+.*) && this(entity) && !get(* DocumentBacked.*); - protected pointcut entityFieldSet(DocumentBacked entity, Object newVal) : + protected pointcut entityFieldSet(DocumentBacked entity, Object newVal) : set(@RelatedDocument * DocumentBacked+.*) && this(entity) && args(newVal) && !set(* DocumentBacked.*); - // intercept EntityManager.merge calls - public pointcut entityManagerMerge(EntityManager em, Object entity) : + // intercept EntityManager.merge calls + public pointcut entityManagerMerge(EntityManager em, Object entity) : call(* EntityManager.merge(Object)) && target(em) && args(entity); - - // intercept EntityManager.remove calls -// public pointcut entityManagerRemove(EntityManager em, Object entity) : -// call(* EntityManager.remove(Object)) && -// target(em) && -// args(entity); - - // move changeSet from detached entity to the newly merged persistent object - Object around(EntityManager em, Object entity) : entityManagerMerge(em, entity) { - Object mergedEntity = proceed(em, entity); - if (entity instanceof DocumentBacked && mergedEntity instanceof DocumentBacked) { - ((DocumentBacked)mergedEntity).changeSet = ((DocumentBacked)entity).getChangeSet(); - } - return mergedEntity; - } - - // clear changeSet from removed entity -// Object around(EntityManager em, Object entity) : entityManagerRemove(em, entity) { -// if (entity instanceof DocumentBacked) { -// removeChangeSetValues((DocumentBacked)entity); -// } -// return proceed(em, entity); -// } - - private static void removeChangeSetValues(DocumentBacked entity) { - LOGGER.debug("Removing all change-set values for " + entity); - ChangeSet nulledCs = new HashMapChangeSet(); - DocumentBacked documentEntity = (DocumentBacked) entity; - @SuppressWarnings("unchecked") - ChangeSetPersister changeSetPersister = (ChangeSetPersister)documentEntity.itdChangeSetPersister; - try { - changeSetPersister.getPersistentState( - documentEntity.getClass(), - documentEntity.get_persistent_id(), - documentEntity.getChangeSet()); - } - catch (DataAccessException e) {} - catch (NotFoundException e) {} - for (String key :entity.getChangeSet().getValues().keySet()) { - nulledCs.set(key, null); + + // intercept EntityManager.remove calls + // public pointcut entityManagerRemove(EntityManager em, Object entity) : + // call(* EntityManager.remove(Object)) && + // target(em) && + // args(entity); + + // move changeSet from detached entity to the newly merged persistent object + Object around(EntityManager em, Object entity) : entityManagerMerge(em, entity) { + Object mergedEntity = proceed(em, entity); + if (entity instanceof DocumentBacked && mergedEntity instanceof DocumentBacked) { + ((DocumentBacked) mergedEntity).changeSet = ((DocumentBacked) entity).getChangeSet(); + } + return mergedEntity; + } + + // clear changeSet from removed entity + // Object around(EntityManager em, Object entity) : entityManagerRemove(em, entity) { + // if (entity instanceof DocumentBacked) { + // removeChangeSetValues((DocumentBacked)entity); + // } + // return proceed(em, entity); + // } + + private static void removeChangeSetValues(DocumentBacked entity) { + LOGGER.debug("Removing all change-set values for " + entity); + ChangeSet nulledCs = new HashMapChangeSet(); + DocumentBacked documentEntity = (DocumentBacked) entity; + @SuppressWarnings("unchecked") + ChangeSetPersister changeSetPersister = (ChangeSetPersister) documentEntity.itdChangeSetPersister; + try { + changeSetPersister.getPersistentState(documentEntity.getClass(), documentEntity.get_persistent_id(), + documentEntity.getChangeSet()); + } catch (DataAccessException e) { + } catch (NotFoundException e) { + } + for (String key : entity.getChangeSet().getValues().keySet()) { + nulledCs.set(key, null); + } + entity.setChangeSet(nulledCs); + } + + before(DocumentBacked entity) : arbitraryUserConstructorOfChangeSetBackedObject(entity) { + LOGGER.debug("User-defined constructor called on DocumentBacked object of class " + entity.getClass()); + // Populate all ITD fields + entity.setChangeSet(new HashMapChangeSet()); + entity.itdChangeSetPersister = changeSetPersister; + entity.itdTransactionSynchronization = new ChangeSetBackedTransactionSynchronization(changeSetPersister, entity); + // registerTransactionSynchronization(entity); + } + + private static void registerTransactionSynchronization(DocumentBacked entity) { + if (TransactionSynchronizationManager.isSynchronizationActive()) { + if (!TransactionSynchronizationManager.getSynchronizations().contains(entity.itdTransactionSynchronization)) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Adding transaction synchronization for " + entity); + } + TransactionSynchronizationManager.registerSynchronization(entity.itdTransactionSynchronization); + } else { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Transaction synchronization already active for " + entity); + } + } + } else { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Transaction synchronization is not active for " + entity); + } + } + } + + // ------------------------------------------------------------------------- + // ChangeSet-related mixins + // ------------------------------------------------------------------------- + // Introduced field + @Transient + private ChangeSet DocumentBacked.changeSet; + + @Transient + private ChangeSetPersister DocumentBacked.itdChangeSetPersister; + + @Transient + private ChangeSetBackedTransactionSynchronization DocumentBacked.itdTransactionSynchronization; + + public void DocumentBacked.setChangeSet(ChangeSet cs) { + this.changeSet = cs; + } + + public ChangeSet DocumentBacked.getChangeSet() { + return changeSet; + } + + // Flush the entity state to the persistent store + public void DocumentBacked.flush() { + Object id = itdChangeSetPersister.getPersistentId(this, this.changeSet); + itdChangeSetPersister.persistState(this, this.changeSet); + } + + public Object DocumentBacked.get_persistent_id() { + return itdChangeSetPersister.getPersistentId(this, this.changeSet); + } + + // lifecycle methods + @javax.persistence.PostPersist + public void DocumentBacked.itdPostPersist() { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("JPA lifecycle event PrePersist: " + this.getClass().getName()); + } + registerTransactionSynchronization(this); + } + + @javax.persistence.PreUpdate + public void DocumentBacked.itdPreUpdate() { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("JPA lifecycle event PreUpdate: " + this.getClass().getName() + " :: " + this); + } + registerTransactionSynchronization(this); + } + + @javax.persistence.PostUpdate + public void DocumentBacked.itdPostUpdate() { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("JPA lifecycle event PostUpdate: " + this.getClass().getName() + " :: " + this); + } + registerTransactionSynchronization(this); + } + + @javax.persistence.PostRemove + public void DocumentBacked.itdPostRemove() { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("JPA lifecycle event PostRemove: " + this.getClass().getName() + " :: " + this); + } + registerTransactionSynchronization(this); + removeChangeSetValues(this); + } + + @javax.persistence.PostLoad + public void DocumentBacked.itdPostLoad() { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("JPA lifecycle event PostLoad: " + this.getClass().getName() + " :: " + this); + } + registerTransactionSynchronization(this); + } + + /** + * delegates field reads to the state accessors instance + */ + Object around(DocumentBacked entity): entityFieldGet(entity) { + Field f = field(thisJoinPoint); + String propName = f.getName(); + LOGGER.trace("GET " + f + " -> ChangeSet value property [" + propName + "] using: " + entity.getChangeSet()); + if (entity.getChangeSet().getValues().get(propName) == null) { + try { + this.changeSetPersister + .getPersistentState(entity.getClass(), entity.get_persistent_id(), entity.getChangeSet()); + } catch (NotFoundException e) { + } + } + Object fValue = entity.getChangeSet().getValues().get(propName); + if (fValue != null) { + return fValue; + } + return proceed(entity); + } + + /** + * delegates field writes to the state accessors instance + */ + Object around(DocumentBacked entity, Object newVal) : entityFieldSet(entity, newVal) { + Field f = field(thisJoinPoint); + String propName = f.getName(); + LOGGER.trace("SET " + f + " -> ChangeSet number value property [" + propName + "] with value=[" + newVal + "]"); + entity.getChangeSet().set(propName, newVal); + return proceed(entity, newVal); + } + + Field field(JoinPoint joinPoint) { + FieldSignature fieldSignature = (FieldSignature) joinPoint.getSignature(); + return fieldSignature.getField(); } - entity.setChangeSet(nulledCs); - } - - before(DocumentBacked entity) : arbitraryUserConstructorOfChangeSetBackedObject(entity) { - LOGGER - .debug("User-defined constructor called on DocumentBacked object of class " - + entity.getClass()); - // Populate all ITD fields - entity.setChangeSet(new HashMapChangeSet()); - entity.itdChangeSetPersister = changeSetPersister; - entity.itdTransactionSynchronization = - new ChangeSetBackedTransactionSynchronization(changeSetPersister, entity); - //registerTransactionSynchronization(entity); - } - - private static void registerTransactionSynchronization(DocumentBacked entity) { - if (TransactionSynchronizationManager.isSynchronizationActive()) { - if (!TransactionSynchronizationManager.getSynchronizations().contains(entity.itdTransactionSynchronization)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Adding transaction synchronization for " + entity); - } - TransactionSynchronizationManager.registerSynchronization(entity.itdTransactionSynchronization); - } - else { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Transaction synchronization already active for " + entity); - } - } - } - else { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Transaction synchronization is not active for " + entity); - } - } - } - - // ------------------------------------------------------------------------- - // ChangeSet-related mixins - // ------------------------------------------------------------------------- - // Introduced field - @Transient private ChangeSet DocumentBacked.changeSet; - - @Transient private ChangeSetPersister DocumentBacked.itdChangeSetPersister; - - @Transient private ChangeSetBackedTransactionSynchronization DocumentBacked.itdTransactionSynchronization; - - public void DocumentBacked.setChangeSet(ChangeSet cs) { - this.changeSet = cs; - } - - public ChangeSet DocumentBacked.getChangeSet() { - return changeSet; - } - - // Flush the entity state to the persistent store - public void DocumentBacked.flush() { - Object id = itdChangeSetPersister.getPersistentId(this, this.changeSet); - itdChangeSetPersister.persistState(this, this.changeSet); - } - - public Object DocumentBacked.get_persistent_id() { - return itdChangeSetPersister.getPersistentId(this, this.changeSet); - } - - // lifecycle methods - @javax.persistence.PostPersist public void DocumentBacked.itdPostPersist() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JPA lifecycle event PrePersist: " + this.getClass().getName()); - } - registerTransactionSynchronization(this); - } - @javax.persistence.PreUpdate public void DocumentBacked.itdPreUpdate() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JPA lifecycle event PreUpdate: " + this.getClass().getName() + " :: " + this); - } - registerTransactionSynchronization(this); - } - @javax.persistence.PostUpdate public void DocumentBacked.itdPostUpdate() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JPA lifecycle event PostUpdate: " + this.getClass().getName() + " :: " + this); - } - registerTransactionSynchronization(this); - } - @javax.persistence.PostRemove public void DocumentBacked.itdPostRemove() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JPA lifecycle event PostRemove: " + this.getClass().getName() + " :: " + this); - } - registerTransactionSynchronization(this); - removeChangeSetValues(this); - } - @javax.persistence.PostLoad public void DocumentBacked.itdPostLoad() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JPA lifecycle event PostLoad: " + this.getClass().getName() + " :: " + this); - } - registerTransactionSynchronization(this); - } - - /** - * delegates field reads to the state accessors instance - */ - Object around(DocumentBacked entity): entityFieldGet(entity) { - Field f = field(thisJoinPoint); - String propName = f.getName(); - LOGGER.trace("GET " + f + " -> ChangeSet value property [" + propName - + "] using: " + entity.getChangeSet()); - if (entity.getChangeSet().getValues().get(propName) == null) { - try { - this.changeSetPersister.getPersistentState(entity.getClass(), - entity.get_persistent_id(), entity.getChangeSet()); - } catch (NotFoundException e) { - } - } - Object fValue = entity.getChangeSet().getValues().get(propName); - if (fValue != null) { - return fValue; - } - return proceed(entity); - } - - /** - * delegates field writes to the state accessors instance - */ - Object around(DocumentBacked entity, Object newVal) : entityFieldSet(entity, newVal) { - Field f = field(thisJoinPoint); - String propName = f.getName(); - LOGGER.trace("SET " + f + " -> ChangeSet number value property [" + propName - + "] with value=[" + newVal + "]"); - entity.getChangeSet().set(propName, newVal); - return proceed(entity, newVal); - } - - Field field(JoinPoint joinPoint) { - FieldSignature fieldSignature = (FieldSignature) joinPoint.getSignature(); - return fieldSignature.getField(); - } } diff --git a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/RelatedDocument.java b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/RelatedDocument.java index 95c955999..33ff2a2bf 100644 --- a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/RelatedDocument.java +++ b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/RelatedDocument.java @@ -24,8 +24,6 @@ import java.lang.annotation.Target; * @author Thomas Risberg */ @Retention(RetentionPolicy.RUNTIME) -@Target({ - ElementType.FIELD -}) +@Target({ ElementType.FIELD }) public @interface RelatedDocument { } diff --git a/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/CrossStoreMongoTests.java b/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/CrossStoreMongoTests.java index b6e9d7cdd..a36229924 100644 --- a/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/CrossStoreMongoTests.java +++ b/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/CrossStoreMongoTests.java @@ -90,8 +90,7 @@ public class CrossStoreMongoTests { Assert.assertNotNull(found); Assert.assertEquals(Long.valueOf(1), found.getId()); Assert.assertNotNull(found.getResume()); - Assert.assertEquals("DiMark, DBA, 1990-2000" + "; " - + "VMware, Developer, 2007-", found.getResume().getJobs()); + Assert.assertEquals("DiMark, DBA, 1990-2000" + "; " + "VMware, Developer, 2007-", found.getResume().getJobs()); found.getResume().addJob("SpringDeveloper.com, Consultant, 2005-2006"); found.setAge(44); } @@ -106,8 +105,7 @@ public class CrossStoreMongoTests { Assert.assertNotNull(found); Assert.assertEquals(Long.valueOf(1), found.getId()); Assert.assertNotNull(found.getResume()); - Assert.assertEquals("DiMark, DBA, 1990-2000" + "; " - + "VMware, Developer, 2007-" + "; " + Assert.assertEquals("DiMark, DBA, 1990-2000" + "; " + "VMware, Developer, 2007-" + "; " + "SpringDeveloper.com, Consultant, 2005-2006", found.getResume().getJobs()); } diff --git a/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/test/Address.java b/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/test/Address.java index d23a560b9..072239d21 100644 --- a/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/test/Address.java +++ b/spring-data-mongodb-cross-store/src/test/java/org/springframework/data/mongodb/crossstore/test/Address.java @@ -23,8 +23,7 @@ public class Address { private String state; private String zip; - public Address(Integer streetNumber, String streetName, String city, - String state, String zip) { + public Address(Integer streetNumber, String streetName, String city, String state, String zip) { super(); this.streetNumber = streetNumber; this.streetName = streetName; @@ -36,34 +35,41 @@ public class Address { public Integer getStreetNumber() { return streetNumber; } + public void setStreetNumber(Integer streetNumber) { this.streetNumber = streetNumber; } + public String getStreetName() { return streetName; } + public void setStreetName(String streetName) { this.streetName = streetName; } + public String getCity() { return city; } + public void setCity(String city) { this.city = city; } + public String getState() { return state; } + public void setState(String state) { this.state = state; } + public String getZip() { return zip; } + public void setZip(String zip) { this.zip = zip; } - - }