001package org.apache.archiva.admin.model.beans; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import javax.xml.bind.annotation.XmlRootElement; 022import java.io.Serializable; 023 024/** 025 * Bean to expose Map entries as Json 026 * 027 * @author Olivier Lamy 028 * @since 1.4-M3 029 */ 030@XmlRootElement(name = "propertyEntry") 031public class PropertyEntry 032 implements Serializable, Comparable<PropertyEntry> 033{ 034 private String key; 035 036 private String value; 037 038 public PropertyEntry() 039 { 040 // no op 041 } 042 043 public PropertyEntry( String key, String value ) 044 { 045 this.key = key; 046 this.value = value; 047 } 048 049 public String getKey() 050 { 051 return key; 052 } 053 054 public void setKey( String key ) 055 { 056 this.key = key; 057 } 058 059 public String getValue() 060 { 061 return value; 062 } 063 064 public void setValue( String value ) 065 { 066 this.value = value; 067 } 068 069 @Override 070 public String toString() 071 { 072 final StringBuilder sb = new StringBuilder(); 073 sb.append( "PropertyEntry" ); 074 sb.append( "{key='" ).append( key ).append( '\'' ); 075 sb.append( ", value='" ).append( value ).append( '\'' ); 076 sb.append( '}' ); 077 return sb.toString(); 078 } 079 080 @Override 081 public int compareTo( PropertyEntry o ) 082 { 083 if (o == null || o.getKey() == null) 084 { 085 return 1; 086 } 087 return this.key.compareTo( o.getKey() ); 088 } 089}