001/** 002 * Copyright 2014 Tampere University of Technology, Pori Department 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package service.tut.pori.facebookjazz; 017 018import javax.xml.bind.annotation.XmlAccessType; 019import javax.xml.bind.annotation.XmlAccessorType; 020import javax.xml.bind.annotation.XmlAttribute; 021import javax.xml.bind.annotation.XmlRootElement; 022import javax.xml.bind.annotation.XmlValue; 023 024/** 025 * An extension of an XML element with weight added as an attribute. The element content is String. 026 * 027 */ 028@XmlRootElement 029@XmlAccessorType(XmlAccessType.NONE) 030public class WeightedStringElement { 031 @XmlValue 032 private String _value = null; 033 @XmlAttribute(name=Definitions.ATTRIBUTE_WEIGHT) 034 private Integer _weight = null; 035 036 /** 037 * for serialization 038 */ 039 @SuppressWarnings("unused") 040 private WeightedStringElement(){ 041 // nothing needed 042 } 043 044 /** 045 * 046 * @param value 047 * @param weight 048 */ 049 public WeightedStringElement(String value, Integer weight){ 050 _value = value; 051 _weight = weight; 052 } 053 054 /** 055 * @return the value 056 */ 057 public String getValue() { 058 return _value; 059 } 060 061 /** 062 * @return the weight 063 */ 064 public Integer getWeight() { 065 return _weight; 066 } 067}