summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/mapping/ClassEntry.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/mapping/ClassEntry.java')
-rw-r--r--src/cuchaz/enigma/mapping/ClassEntry.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/mapping/ClassEntry.java b/src/cuchaz/enigma/mapping/ClassEntry.java
new file mode 100644
index 0000000..7e78d4c
--- /dev/null
+++ b/src/cuchaz/enigma/mapping/ClassEntry.java
@@ -0,0 +1,67 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma.mapping;
12
13import java.io.Serializable;
14
15
16public class ClassEntry implements Serializable
17{
18 private static final long serialVersionUID = 4235460580973955811L;
19
20 private String m_name;
21
22 public ClassEntry( String className )
23 {
24 if( className == null )
25 {
26 throw new IllegalArgumentException( "Class name cannot be null!" );
27 }
28 if( className.contains( "." ) )
29 {
30 throw new IllegalArgumentException( "Class name must be in JVM format. ie, path/to/package/class$inner" );
31 }
32
33 m_name = className;
34 }
35
36 public String getName( )
37 {
38 return m_name;
39 }
40
41 @Override
42 public int hashCode( )
43 {
44 return m_name.hashCode();
45 }
46
47 @Override
48 public boolean equals( Object other )
49 {
50 if( other instanceof ClassEntry )
51 {
52 return equals( (ClassEntry)other );
53 }
54 return false;
55 }
56
57 public boolean equals( ClassEntry other )
58 {
59 return m_name.equals( other.m_name );
60 }
61
62 @Override
63 public String toString( )
64 {
65 return m_name;
66 }
67}