PageRenderTime 17ms CodeModel.GetById 8ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/db-diff/src/main/java/com/googlecode/hdbc/dbdiff/model/UserObjectDefinition.java

http://hdbc.googlecode.com/
Java | 55 lines | 46 code | 9 blank | 0 comment | 5 complexity | d6e17f527a556982e9503d6b09b2191c MD5 | raw file
 1package com.googlecode.hdbc.dbdiff.model;
 2
 3public class UserObjectDefinition {
 4	private final String objectType;
 5	private final String objectName;
 6
 7	public UserObjectDefinition(final String objName, final String objType) {
 8		objectName = objName;
 9		objectType = objType;
10	}
11
12	public final String getObjectName() {
13		return objectName;
14	}
15
16	public final String getObjectType() {
17		return objectType;
18	}
19
20	public final boolean isTabularObject() {
21		return this.objectType.equals("TABLE") || this.objectType.equals("VIEW");
22	}
23
24	public final boolean isScriptedObject() {
25	    return this.objectType.equals("FUNCTION") || this.objectType.equals("PROCEDURE");
26	}
27
28	@Override
29	public final boolean equals(final Object obj) {
30		if (obj == null) {
31			return false;
32		}
33		if (!(obj instanceof UserObjectDefinition)) {
34			return false;
35		}
36		UserObjectDefinition temp = (UserObjectDefinition) obj;
37		return temp.getObjectName().equals(objectName) &&
38			temp.getObjectType().equals(objectType);
39	}
40
41	@Override
42	public final int hashCode() {
43		return objectName.hashCode() + objectType.hashCode();
44	}
45
46	@Override
47	public final String toString() {
48	    StringBuilder temp = new StringBuilder();
49	    return temp.append(this.objectName)
50	        .append(" (")
51	        .append(this.objectType)
52	        .append(")")
53	        .toString();
54	}
55}