gpt4 book ai didi

org.yaml.snakeyaml.error.YAMLException.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 09:46:40 30 4
gpt4 key购买 nike

本文整理了Java中org.yaml.snakeyaml.error.YAMLException.<init>()方法的一些代码示例,展示了YAMLException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLException.<init>()方法的具体详情如下:
包路径:org.yaml.snakeyaml.error.YAMLException
类名称:YAMLException
方法名:<init>

YAMLException.<init>介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

public Token(Mark startMark, Mark endMark) {
  if (startMark == null || endMark == null) {
    throw new YAMLException("Token requires marks.");
  }
  this.startMark = startMark;
  this.endMark = endMark;
}

代码示例来源:origin: redisson/redisson

public void setIndicatorIndent(int indicatorIndent) {
  if (indicatorIndent < 0) {
    throw new YAMLException("Indicator indent must be non-negative.");
  }
  if (indicatorIndent > Emitter.MAX_INDENT - 1) {
    throw new YAMLException("Indicator indent must be at most Emitter.MAX_INDENT-1: " + (Emitter.MAX_INDENT - 1));
  }
  this.indicatorIndent = indicatorIndent;
}

代码示例来源:origin: redisson/redisson

public void setIndent(int indent) {
  if (indent < Emitter.MIN_INDENT) {
    throw new YAMLException("Indent must be at least " + Emitter.MIN_INDENT);
  }
  if (indent > Emitter.MAX_INDENT) {
    throw new YAMLException("Indent must be at most " + Emitter.MAX_INDENT);
  }
  this.indent = indent;
}

代码示例来源:origin: redisson/redisson

public static String decode(String buff) {
    try {
      return URLDecoder.decode(buff, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new YAMLException(e);
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
public Object get(Object object) {
  try {
    return field.get(object);
  } catch (Exception e) {
    throw new YAMLException("Unable to access field " + field.getName() + " on object "
        + object + " : " + e);
  }
}

代码示例来源:origin: redisson/redisson

private static final String check(String s) {
  if (s == null) {
    throw new NullPointerException("Root type must be provided.");
  }
  if (s.trim().length() == 0) {
    throw new YAMLException("Root type must be provided.");
  }
  return s;
}

代码示例来源:origin: redisson/redisson

public DirectiveToken(String name, List<T> value, Mark startMark, Mark endMark) {
  super(startMark, endMark);
  this.name = name;
  if (value != null && value.size() != 2) {
    throw new YAMLException("Two strings must be provided instead of "
        + String.valueOf(value.size()));
  }
  this.value = value;
}

代码示例来源:origin: redisson/redisson

@Override
public Object get(Object object) {
  try {
    property.getReadMethod().setAccessible(true);// issue 50
    return property.getReadMethod().invoke(object);
  } catch (Exception e) {
    throw new YAMLException("Unable to find getter for property '" + property.getName()
        + "' on object " + object + ":" + e);
  }
}

代码示例来源:origin: redisson/redisson

protected Object newInstance(Node node) {
  try {
    return newInstance(Object.class, node);
  } catch (InstantiationException e) {
    throw new YAMLException(e);
  }
}

代码示例来源:origin: redisson/redisson

public String getClassName() {
  if (!value.startsWith(Tag.PREFIX)) {
    throw new YAMLException("Invalid tag: " + value);
  }
  return UriEncoder.decode(value.substring(Tag.PREFIX.length()));
}

代码示例来源:origin: redisson/redisson

@Override
public void set(Object object, Object value) throws Exception {
  if (!writable) {
    throw new YAMLException("No writable property '" + getName() + "' on class: "
        + object.getClass().getName());
  }
  property.getWriteMethod().invoke(object, value);
}

代码示例来源:origin: redisson/redisson

public Property getProperty(Class<? extends Object> type, String name, BeanAccess bAccess) {
  Map<String, Property> properties = getPropertiesMap(type, bAccess);
  Property property = properties.get(name);
  if (property == null && skipMissingProperties) {
    property = new MissingProperty(name);
  }
  if (property == null) {
    throw new YAMLException(
        "Unable to find property '" + name + "' on class: " + type.getName());
  }
  return property;
}

代码示例来源:origin: redisson/redisson

protected void setProperties(Object bean, Map<String, Object> data) throws Exception {
  if (data == null) {
    throw new NullPointerException("Data for Compact Object Notation cannot be null.");
  }
  for (Map.Entry<String, Object> entry : data.entrySet()) {
    String key = entry.getKey();
    Property property = getPropertyUtils().getProperty(bean.getClass(), key);
    try {
      property.set(bean, entry.getValue());
    } catch (IllegalArgumentException e) {
      throw new YAMLException("Cannot set property='" + key + "' with value='"
          + data.get(key) + "' (" + data.get(key).getClass() + ") in " + bean);
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
  @SuppressWarnings("unchecked")
  public void construct2ndStep(Node node, Object object) {
    if (node.isTwoStepsConstruction()) {
      constructSet2ndStep((MappingNode) node, (Set<Object>) object);
    } else {
      throw new YAMLException("Unexpected recursive set structure. Node: " + node);
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
  @SuppressWarnings("unchecked")
  public void construct2ndStep(Node node, Object object) {
    if (node.isTwoStepsConstruction()) {
      constructMapping2ndStep((MappingNode) node, (Map<Object, Object>) object);
    } else {
      throw new YAMLException("Unexpected recursive mapping structure. Node: " + node);
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
  @SuppressWarnings("unchecked")
  public void construct2ndStep(Node node, Object data) {
    if (node.isTwoStepsConstruction()) {
      constructSequenceStep2((SequenceNode) node, (List<Object>) data);
    } else {
      throw new YAMLException("Unexpected recursive sequence structure. Node: " + node);
    }
  }
}

代码示例来源:origin: redisson/redisson

protected Object constructCompactFormat(ScalarNode node, CompactData data) {
  try {
    Object obj = createInstance(node, data);
    Map<String, Object> properties = new HashMap<String, Object>(data.getProperties());
    setProperties(obj, properties);
    return obj;
  } catch (Exception e) {
    throw new YAMLException(e);
  }
}

代码示例来源:origin: redisson/redisson

protected void applySequence(Object bean, List<?> value) {
  try {
    Property property = getPropertyUtils().getProperty(bean.getClass(),
        getSequencePropertyName(bean.getClass()));
    property.set(bean, value);
  } catch (Exception e) {
    throw new YAMLException(e);
  }
}

代码示例来源:origin: redisson/redisson

@SuppressWarnings("unchecked")
  public void construct2ndStep(Node node, Object object) {
    SequenceNode snode = (SequenceNode) node;
    if (List.class.isAssignableFrom(node.getType())) {
      List<Object> list = (List<Object>) object;
      constructSequenceStep2(snode, list);
    } else if (node.getType().isArray()) {
      constructArrayStep2(snode, object);
    } else {
      throw new YAMLException("Immutable objects cannot be recursive.");
    }
  }
}

代码示例来源:origin: redisson/redisson

private void dumpAll(Iterator<? extends Object> data, Writer output, Tag rootTag) {
  Serializer serializer = new Serializer(new Emitter(output, dumperOptions), resolver,
      dumperOptions, rootTag);
  try {
    serializer.open();
    while (data.hasNext()) {
      Node node = representer.represent(data.next());
      serializer.serialize(node);
    }
    serializer.close();
  } catch (IOException e) {
    throw new YAMLException(e);
  }
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com