Java 类javax.xml.bind.TypeConstraintException 实例源码

项目:NFVO    文件:VirtualNetworkFunctionDescriptor.java   
@Override
public void setConnection_point(Set<ConnectionPoint> connection_point) {
  for (ConnectionPoint cp : connection_point)
    if (!(cp instanceof VNFDConnectionPoint))
      throw new TypeConstraintException(
          "Connection Point "
              + cp.getId()
              + " field must be an instance of "
              + ConnectionPoint.class.getCanonicalName());
  this.connection_point = connection_point;
}
项目:openbaton-libs    文件:VirtualNetworkFunctionDescriptor.java   
@Override
public void setConnection_point(Set<ConnectionPoint> connection_point) {
  for (ConnectionPoint cp : connection_point)
    if (!(cp instanceof VNFDConnectionPoint))
      throw new TypeConstraintException(
          "Connection Point "
              + cp.getId()
              + " field must be an instance of "
              + ConnectionPoint.class.getCanonicalName());
  this.connection_point = connection_point;
}
项目:piwik-java-tracker    文件:PiwikRequest.java   
private URL returnAsUrl(String parameter, String name, String altMethod){
    Object obj = getParameter(parameter);
    if (obj == null){
        return null;
    }
    if (obj instanceof URL){
        return (URL)obj;
    }
    throw new TypeConstraintException("The stored " + name +
            " is a String, not a URL.  Use \""+
            altMethod + "\" instead.");
}
项目:piwik-java-tracker    文件:PiwikRequest.java   
private String returnAsString(String parameter, String name, String altMethod){
    Object obj = getParameter(parameter);
    if (obj == null){
        return null;
    }
    if (obj instanceof String){
        return (String)obj;
    }
    throw new TypeConstraintException("The stored " + name +
            " is a URL, not a String.  Use \""+
            altMethod + "\" instead.");
}
项目:rubycollect4j    文件:RubyString.java   
private String stringify(Object o) {
  if (o == null) throw new TypeConstraintException(
      "TypeError: no implicit conversion of null into String");

  if (o instanceof String) return (String) o;

  if (o instanceof CharSequence) {
    CharSequence cs = (CharSequence) o;
    return new StringBuilder(cs.length()).append(cs).toString();
  }

  return o.toString();
}
项目:rubycollect4j    文件:RubyString.java   
/**
 * Searches sep in the string and returns the part before it, the match, and
 * the part after it. If it is not found, returns two empty strings and str.
 * 
 * @param sep
 * @return {@link RubyArray}
 */
public RubyArray<String> partition(String sep) {
  if (sep == null)
    throw new TypeConstraintException("TypeError: type mismatch: null given");

  int sepIndex = str.indexOf(sep);
  if (sepIndex == -1) return Ruby.Array.of(str, "", "");

  return Ruby.Array.of(str.substring(0, sepIndex), sep,
      str.substring(sepIndex + sep.length()));
}
项目:rubycollect4j    文件:RubyString.java   
/**
 * Searches pattern in the string and returns the part before it, the match,
 * and the part after it. If it is not found, returns two empty strings and
 * str.
 * 
 * @param pattern
 *          a Pattern
 * @return {@link RubyArray}
 */
public RubyArray<String> partition(Pattern pattern) {
  if (pattern == null)
    throw new TypeConstraintException("TypeError: type mismatch: null given");

  Matcher matcher = pattern.matcher(str);
  if (matcher.find()) {
    String sep = matcher.group();
    int sepIndex = str.indexOf(sep);
    return Ruby.Array.of(str.substring(0, sepIndex), sep,
        str.substring(sepIndex + sep.length()));
  } else {
    return Ruby.Array.of(str, "", "");
  }
}
项目:rubycollect4j    文件:RubyString.java   
/**
 * Returns the matching portion of the string.
 * 
 * @param pattern
 *          a Pattern
 * @return new {@link RubyString} or null
 */
public RubyString slice(Pattern pattern) {
  if (pattern == null)
    throw new TypeConstraintException("TypeError: type mismatch: null given");

  Matcher matcher = pattern.matcher(str);
  if (matcher.find())
    return Ruby.String.of(matcher.group());
  else
    return null;
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testRpartitionWithPatternException() {
  rs.rpartition((Pattern) null);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testSqueezeWithCharSetException() {
  rs("  now   is  the").squeeze(null);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testLindexWithPatternAndStopAtException() {
  rs.rindex((Pattern) null, -1);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testTrSException1() {
  rs.trS(null, "");
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testUptoWithExclusiveAndBlockException() {
  rs.upto(null, true, (Consumer<String>) null);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testSliceWithPatternException() {
  rs.slice((Pattern) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testCountException1() {
  RubyStrings.count(rs, (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testCryptException() {
  RubyStrings.crypt(rs, null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testDeleteException() {
  RubyStrings.delete(rs, null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testEachLineWithSeparatorException() {
  RubyStrings.eachLine(rs, (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testEachLineWithSeparatorAndBlockException() {
  RubyStrings.eachLine(rs, (String) null, item -> {});
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testEncodeException() {
  RubyStrings.encode(rs, null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testEncodeExceptionWithNullDestinationEncoding() {
  RubyStrings.encode(rs, null, "UTF-8");
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testEncodeExceptionWithNullSourceEncoding() {
  RubyStrings.encode(rs, "ISO-8859-1", null);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testSliceǃWithPatternException() {
  rs.sliceǃ((Pattern) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testGsubException1() {
  RubyStrings.gsub("ab4c56", null, "77");
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testGsubException2() {
  RubyStrings.gsub("ab4c56", "\\d+", (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testGsubWithMapException() {
  RubyStrings.gsub("0ab4c56", null, rh("4", "88", "56", "99"));
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testGsubWithBlockException() {
  RubyStrings.gsub("ab4c56", null, item -> item + "0");
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testGsubWithoutReplacementException() {
  RubyStrings.gsub("ab4c56", null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testIndexException() {
  RubyStrings.index(rs, (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testIndexWithOffsetException() {
  RubyStrings.index(rs, (String) null, 100);
}
项目:rubycollect4j    文件:RubyArrayTest.java   
@Test(expected = TypeConstraintException.class)
public void testTransposeException1() {
  ra.transpose();
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testIndexWithPatternAndOffsetException() {
  RubyStrings.index(rs, (Pattern) null, 1);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testInsertException() {
  RubyStrings.insert(rs, 0, null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testLinesWithSeparatorException() {
  RubyStrings.lines("a\nb\n\nc", null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testLjustWithPadstrException() {
  RubyStrings.ljust("hello", 20, null);
}
项目:rubycollect4j    文件:ByteUtilsTest.java   
@Test(expected = TypeConstraintException.class)
public void testToByteArrayWithObjectAndException2() {
  ByteUtils.toByteArray((Object) null, le);
}
项目:rubycollect4j    文件:RubyStringTest.java   
@Test(expected = TypeConstraintException.class)
public void testSubException2() {
  rs("hello").sub("[aeiou]", (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testPartitionException() {
  RubyStrings.partition(rs, (String) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testPartitionWithPatternException() {
  RubyStrings.partition(rs, (Pattern) null);
}
项目:rubycollect4j    文件:RubyStringsTest.java   
@Test(expected = TypeConstraintException.class)
public void testPrependException() {
  RubyStrings.prepend(rs, null);
}