如何解析星级而不是字符串?

时间:2015-10-25 18:57:07

标签: java android string

我试图解析来自这个网站的信息http://www.petwave.com/Dogs/Breeds/Airedale-Terrier.aspx ..最后是一张带有星级评分的几个属性的表格。现在我只有字符串解析的值..无论如何要解析网站的评级?我想将这些值(如Lifespan和origin)更改为星值?知道怎么做吗?

class Dog implements Serializable {
   private String name;
   private String origin;
   private String lifeSpan;
   private String sizeType;
   private String otherNames;
   private ArrayList<Detail> details;
   private String thumbnailURL;
   private String mainImageURL;
   private String url;
   private String articleText = "";
   private Breed.Name breed;

   private boolean basicDataReady = false;
   private boolean detailDataReady = false;

     Dog(String name, String sizeType, String thumbnailURL, String url,    Breed.Name breed) {
      this.name = name;
      this.sizeType = sizeType;
      this.thumbnailURL = thumbnailURL;
      this.url = url;
      this.breed = breed;
      basicDataReady = true;
  }

    Dog(String name, String origin, String lifeSpan, String url, String thumbnailURL, Breed.Name breed) {
        this.name = name;
        this.origin = origin;
        this.lifeSpan = lifeSpan;
        this.url = url;
        this.thumbnailURL = thumbnailURL;
        this.breed = breed;
        basicDataReady = true;
    }

    Dog(String name, String url, String thumbnailURL, Breed.Name breed) {
        this.name = name;
        this.url = url;
        this.thumbnailURL = thumbnailURL;
        this.breed = breed;
        basicDataReady = true;
    }

    Dog(String url, Breed.Name breed) {
        this.url = url;
        this.breed = breed;
    }

    Dog() {

    }

    public String getArticleText() {
        return articleText;
    }

    public void setArticleText(String articleText) {
        this.articleText = articleText;
    }

    public String getOrigin() {
        return origin;
    }

    public String getLifeSpan() {
        return lifeSpan;
    }

    public String getSizeType() {
        return sizeType;
    }

    public boolean isBasicDataReady() {
        return basicDataReady;
    }

    public void setBasicDataReady(boolean basicDataReady) {
        this.basicDataReady = basicDataReady;
    }

    public boolean isDetailDataReady() {
        return detailDataReady;
    }

    public void setDetailDataReady(boolean detailDataReady) {
        this.detailDataReady = detailDataReady;
    }

    public Breed.Name getBreed() {
        return breed;
    }

    public void setBreed(Breed.Name breed) {
        this.breed = breed;
    }

    public String getMainImageURL() {
        return mainImageURL;
    }

    public void setMainImageURL(String mainImageURL) {
        this.mainImageURL = mainImageURL;
    }

    public ArrayList<Detail> getDetails() {
        return details;
    }

    public void setDetails(ArrayList<Detail> details) {
        this.details = details;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOtherNames() {
        return otherNames;
    }

    public void setOtherNames(String otherNames) {
        this.otherNames = otherNames;
    }

    public String getThumbnailURL() {
        return thumbnailURL;
    }

    public void setThumbnailURL(String thumbnailURL) {
        this.thumbnailURL = thumbnailURL;
    }

    public String getUrl() {
        return url;
    }


    static class Detail implements Serializable {
        private final String key;
        private final String value;

        public Detail(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public String getKey() {
            return key;
        }
    }
}

0 个答案:

没有答案