Shuyi Chen | d7955ce | 2013-05-22 14:51:55 -0700 | [diff] [blame] | 1 | // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org) |
| 2 | |
| 3 | package org.xbill.DNS; |
| 4 | |
| 5 | /** |
| 6 | * CNAME Record - maps an alias to its real name |
| 7 | * |
| 8 | * @author Brian Wellington |
| 9 | */ |
| 10 | |
| 11 | public class CNAMERecord extends SingleCompressedNameBase { |
| 12 | |
| 13 | private static final long serialVersionUID = -4020373886892538580L; |
| 14 | |
| 15 | CNAMERecord() {} |
| 16 | |
| 17 | Record |
| 18 | getObject() { |
| 19 | return new CNAMERecord(); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Creates a new CNAMERecord with the given data |
| 24 | * @param alias The name to which the CNAME alias points |
| 25 | */ |
| 26 | public |
| 27 | CNAMERecord(Name name, int dclass, long ttl, Name alias) { |
| 28 | super(name, Type.CNAME, dclass, ttl, alias, "alias"); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Gets the target of the CNAME Record |
| 33 | */ |
| 34 | public Name |
| 35 | getTarget() { |
| 36 | return getSingleName(); |
| 37 | } |
| 38 | |
| 39 | /** Gets the alias specified by the CNAME Record */ |
| 40 | public Name |
| 41 | getAlias() { |
| 42 | return getSingleName(); |
| 43 | } |
| 44 | |
| 45 | } |