001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.dto.atom; 014 015import static org.apache.juneau.internal.StringUtils.*; 016import static org.apache.juneau.xml.annotation.XmlFormat.*; 017 018import java.net.*; 019import java.net.URI; 020 021import org.apache.juneau.*; 022import org.apache.juneau.annotation.*; 023import org.apache.juneau.xml.*; 024import org.apache.juneau.xml.annotation.*; 025 026/** 027 * Represents an <code>atomCommonAttributes</code> construct in the RFC4287 specification. 028 * 029 * <h5 class='figure'>Schema</h5> 030 * <p class='bcode'> 031 * atomCommonAttributes = 032 * attribute xml:base { atomUri }?, 033 * attribute xml:lang { atomLanguageTag }?, 034 * undefinedAttribute* 035 * </p> 036 * 037 * <h5 class='section'>See Also:</h5> 038 * <ul class='doctree'> 039 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Atom'>Overview > juneau-dto > Atom</a> 040 * <li class='jp'><a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.dto.atom</a> 041 * </ul> 042 */ 043public abstract class Common { 044 045 private URI base; 046 private String lang; 047 048 049 //-------------------------------------------------------------------------------- 050 // Bean properties 051 //-------------------------------------------------------------------------------- 052 053 /** 054 * Returns the uri base of this object. 055 * 056 * @return The URI base of this object. 057 */ 058 @Xml(prefix="xml", format=ATTR) 059 public URI getBase() { 060 return base; 061 } 062 063 /** 064 * Sets the URI base of this object. 065 * 066 * <p> 067 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 068 * Strings must be valid URIs. 069 * 070 * <p> 071 * URIs defined by {@link UriResolver} can be used for values. 072 * 073 * @param base The URI base of this object. 074 * @return This object (for method chaining). 075 */ 076 @BeanProperty("base") 077 public Common base(Object base) { 078 this.base = toURI(base); 079 return this; 080 } 081 082 /** 083 * Returns the language of this object. 084 * 085 * @return The language of this object. 086 */ 087 @Xml(prefix="xml", format=ATTR) 088 public String getLang() { 089 return lang; 090 } 091 092 /** 093 * Sets the language of this object. 094 * 095 * @param lang The language of this object. 096 * @return This object (for method chaining). 097 */ 098 @BeanProperty("lang") 099 public Common lang(String lang) { 100 this.lang = lang; 101 return this; 102 } 103 104 @Override /* Object */ 105 public String toString() { 106 return XmlSerializer.DEFAULT_SQ.toString(this); 107 } 108}