DbtIdSpecification.java :  » UnTagged » more-than-enough » com » boodaba » todocarts » domain » Android Open Source

Android Open Source » UnTagged » more than enough 
more than enough » com » boodaba » todocarts » domain » DbtIdSpecification.java
package com.boodaba.todocarts.domain;

public class DbtIdSpecification<T extends DrivenByTitle<?>> {
  private final String mTargetTitle;
  
  public DbtIdSpecification(String title) {
    mTargetTitle = title;
  }
  
  public DbtIdSpecification(T dbtEntity) {
    this(dbtEntity == null ? null : dbtEntity.mTitle);
  }
  
  public Boolean isSatisfiedBy(T entity) {
    return entity != null
        && (mTargetTitle == null && entity.mTitle == null
          || mTargetTitle != null && mTargetTitle.equals(entity.mTitle));
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.