| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
package com.adobe.internal.xmp.impl; |
| 11 |
|
| 12 |
import com.adobe.internal.xmp.XMPConst; |
| 13 |
import com.adobe.internal.xmp.XMPError; |
| 14 |
import com.adobe.internal.xmp.XMPException; |
| 15 |
import com.adobe.internal.xmp.XMPMeta; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
class ParameterAsserts implements XMPConst |
| 24 |
{ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
private ParameterAsserts() |
| 29 |
{ |
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public static void assertArrayName(String arrayName) throws XMPException |
| 40 |
{ |
| 41 |
if (arrayName == null || arrayName.length() == 0) |
| 42 |
{ |
| 43 |
throw new XMPException("Empty array name", XMPError.BADPARAM); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public static void assertPropName(String propName) throws XMPException |
| 54 |
{ |
| 55 |
if (propName == null || propName.length() == 0) |
| 56 |
{ |
| 57 |
throw new XMPException("Empty property name", XMPError.BADPARAM); |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
public static void assertSchemaNS(String schemaNS) throws XMPException |
| 68 |
{ |
| 69 |
if (schemaNS == null || schemaNS.length() == 0) |
| 70 |
{ |
| 71 |
throw new XMPException("Empty schema namespace URI", XMPError.BADPARAM); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public static void assertPrefix(String prefix) throws XMPException |
| 82 |
{ |
| 83 |
if (prefix == null || prefix.length() == 0) |
| 84 |
{ |
| 85 |
throw new XMPException("Empty prefix", XMPError.BADPARAM); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
public static void assertSpecificLang(String specificLang) throws XMPException |
| 96 |
{ |
| 97 |
if (specificLang == null || specificLang.length() == 0) |
| 98 |
{ |
| 99 |
throw new XMPException("Empty specific language", XMPError.BADPARAM); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
public static void assertStructName(String structName) throws XMPException |
| 110 |
{ |
| 111 |
if (structName == null || structName.length() == 0) |
| 112 |
{ |
| 113 |
throw new XMPException("Empty array name", XMPError.BADPARAM); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
public static void assertNotNull(Object param) throws XMPException |
| 124 |
{ |
| 125 |
if (param == null) |
| 126 |
{ |
| 127 |
throw new XMPException("Parameter must not be null", XMPError.BADPARAM); |
| 128 |
} |
| 129 |
else if ((param instanceof String) && ((String) param).length() == 0) |
| 130 |
{ |
| 131 |
throw new XMPException("Parameter must not be null or empty", XMPError.BADPARAM); |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
public static void assertImplementation(XMPMeta xmp) throws XMPException |
| 143 |
{ |
| 144 |
if (xmp == null) |
| 145 |
{ |
| 146 |
throw new XMPException("Parameter must not be null", |
| 147 |
XMPError.BADPARAM); |
| 148 |
} |
| 149 |
else if (!(xmp instanceof XMPMetaImpl)) |
| 150 |
{ |
| 151 |
throw new XMPException("The XMPMeta-object is not compatible with this implementation", |
| 152 |
XMPError.BADPARAM); |
| 153 |
} |
| 154 |
} |
| 155 |
} |