net.fortuna.ical4j.model.Property.getParameter()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(99)

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

Property.getParameter介绍

[英]Convenience method for retrieving a single parameter.
[中]检索单个参数的简便方法。

代码示例

代码示例来源:origin: org.bedework/bw-util2-calendar

private static String getTzid(final Property p) {
 TzId tzidParam = (TzId)p.getParameter(Parameter.TZID);
 if (tzidParam == null) {
  return null;
 }
 return tzidParam.getValue();
}

代码示例来源:origin: 1and1/cosmo

private void fixDateTimeProperties(Component component) {
  PropertyList<Property> props = component.getProperties();
  for(Property prop : props) {
    if(prop instanceof DateProperty || prop instanceof DateListProperty) {
      Value v = (Value) prop.getParameter(Parameter.VALUE);
      if(Value.DATE_TIME.equals(v)) {
        prop.getParameters().remove(v);
      }
    }
  }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

private void fixDateTimeProperties(Component component) {
  PropertyList<Property> props = component.getProperties();
  for(Property prop : props) {
    if(prop instanceof DateProperty || prop instanceof DateListProperty) {
      Value v = (Value) prop.getParameter(Parameter.VALUE);
      if(Value.DATE_TIME.equals(v)) {
        prop.getParameters().remove(v);
      }
    }
  }
}

代码示例来源:origin: org.bedework/bw-util2-calendar

private static boolean dateOnly(final Property p) {
 Value valParam = (Value)p.getParameter(Parameter.VALUE);
 if ((valParam == null) || (valParam.getValue() == null)) {
  return false;
 }
 return valParam.getValue().toUpperCase().equals(Value.DATE);
}

代码示例来源:origin: org.bedework.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final String toString() {
  final StringBuilder buffer = new StringBuilder();
  buffer.append(getName());
  if (getParameters() != null) {
    buffer.append(getParameters());
  }
  buffer.append(':');
  boolean needsEscape = false;
  if (this instanceof XProperty) {
    Value valParam = (Value) getParameter(Parameter.VALUE);
    if (valParam == null || valParam.equals(Value.TEXT)) {
      needsEscape = true;
    }
  } else if (this instanceof Escapable) {
    needsEscape = true;
  }
  if (needsEscape) {
    buffer.append(Strings.escape(Strings.valueOf(getValue())));
  } else {
    buffer.append(Strings.valueOf(getValue()));
  }
  buffer.append(Strings.LINE_SEPARATOR);
  return buffer.toString();
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

private static boolean areTimeZoneIdsValid(VEvent event) {
    for (String propertyName : PROPERTIES_WITH_TIMEZONES) {
      List<Property> props = event.getProperties(propertyName);
      for (Property p : props) {
        if (p != null && p.getParameter(Parameter.TZID) != null) {
          String tzId = p.getParameter(Parameter.TZID).getValue();
          if (tzId != null && timeZoneRegistry.getTimeZone(tzId) == null) {
            LOG.warn("Unknown TZID [" + tzId + "] for event " + event);
            return false;
          }
        }
      }
    }
    return true;
  }
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final String toString() {
  final StringBuilder buffer = new StringBuilder();
  buffer.append(getName());
  if (getParameters() != null) {
    buffer.append(getParameters());
  }
  buffer.append(':');
  boolean needsEscape = false;
  if (this instanceof XProperty) {
    Value valParam = (Value) getParameter(Parameter.VALUE);
    if (valParam == null || valParam.equals(Value.TEXT)) {
      needsEscape = true;
    }
  } else if (this instanceof Escapable) {
    needsEscape = true;
  }
  if (needsEscape) {
    buffer.append(Strings.escape(Strings.valueOf(getValue())));
  } else {
    buffer.append(Strings.valueOf(getValue()));
  }
  buffer.append(Strings.LINE_SEPARATOR);
  return buffer.toString();
}

代码示例来源:origin: 1and1/cosmo

private static boolean areTimeZoneIdsValid(VEvent event) {
    for (String propertyName : PROPERTIES_WITH_TIMEZONES) {
      List<Property> props = event.getProperties(propertyName);
      for (Property p : props) {
        if (p != null && p.getParameter(Parameter.TZID) != null) {
          String tzId = p.getParameter(Parameter.TZID).getValue();
          if (tzId != null && timeZoneRegistry.getTimeZone(tzId) == null) {
            LOG.warn("Unknown TZID [" + tzId + "] for event " + event);
            return false;
          }
        }
      }
    }
    return true;
  }
}

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

/**
 * {@inheritDoc}
 */
public final String toString() {
  final StringBuilder buffer = new StringBuilder();
  buffer.append(getName());
  if (getParameters() != null) {
    buffer.append(getParameters());
  }
  buffer.append(':');
  boolean needsEscape = false;
  if (this instanceof XProperty) {
    Value valParam = getParameter(Parameter.VALUE);
    if (valParam == null || valParam.equals(Value.TEXT)) {
      needsEscape = true;
    }
  } else if (this instanceof Escapable) {
    needsEscape = true;
  }
  if (needsEscape) {
    buffer.append(Strings.escape(Strings.valueOf(getValue())));
  } else {
    buffer.append(Strings.valueOf(getValue()));
  }
  buffer.append(Strings.LINE_SEPARATOR);
  return buffer.toString();
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

static void correctTzParameterFrom(Property property) {
  if (property.getParameter(Parameter.TZID) != null) {
    String newTimezoneId = getCorrectedTimezoneFromTzParameter(property);
    correctTzParameter(property, newTimezoneId);
  }
}

代码示例来源:origin: org.mnode.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final String toString() {
  final StringBuilder buffer = new StringBuilder();
  buffer.append(getName());
  if (getParameters() != null) {
    buffer.append(getParameters());
  }
  buffer.append(':');
  boolean needsEscape = false;
  if (this instanceof XProperty) {
    Value valParam = getParameter(Parameter.VALUE);
    if (valParam == null || valParam.equals(Value.TEXT)) {
      needsEscape = true;
    }
  } else if (this instanceof Escapable) {
    needsEscape = true;
  }
  if (needsEscape) {
    buffer.append(Strings.escape(Strings.valueOf(getValue())));
  } else {
    buffer.append(Strings.valueOf(getValue()));
  }
  buffer.append(Strings.LINE_SEPARATOR);
  return buffer.toString();
}

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

static void correctTzParameterFrom(Property property) {
  if (property.getParameter(Parameter.TZID) != null) {
    String newTimezoneId = getCorrectedTimezoneFromTzParameter(property);
    correctTzParameter(property, newTimezoneId);
  }
}

代码示例来源:origin: org.bedework/bw-util2-calendar

private static String paramVal(final Property p,
                final String paramName) {
 Parameter param = p.getParameter(paramName);
 if ((param == null) || (param.getValue() == null)) {
  return null;
 }
 return param.getValue();
}

代码示例来源:origin: org.mnode.ical4j/ical4j

static void correctTzParameterFrom(Property property) {
  if (property.getParameter(Parameter.TZID) != null) {
    String newTimezoneId = getCorrectedTimezoneFromTzParameter(property);
    correctTzParameter(property, newTimezoneId);
  }
}

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

private static String getCorrectedTimezoneFromTzParameter(Property property) {
  String tzIdValue = property.getParameter(Parameter.TZID).getValue();
  return getCorrectedTimeZoneIdFrom(tzIdValue);
}

代码示例来源:origin: org.mnode.ical4j/ical4j

private static String getCorrectedTimezoneFromTzParameter(Property property) {
  String tzIdValue = property.getParameter(Parameter.TZID).getValue();
  return getCorrectedTimeZoneIdFrom(tzIdValue);
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

private static String getCorrectedTimezoneFromTzParameter(Property property) {
  String tzIdValue = property.getParameter(Parameter.TZID).getValue();
  return getCorrectedTimeZoneIdFrom(tzIdValue);
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical

private static boolean checkLocation(final IcalCallback cb,
                   final ChangeTable chg,
                   final BwEvent ev,
                   final Property prop) throws CalFacadeException {
 final Parameter param =
     prop.getParameter(XcalTags.xBedeworkLocationKey.getLocalPart());
 final String val = prop.getValue();
 final BwLocation evloc = ev.getLocation();
 final BwLocation loc;
 if (param == null) {
  final BwString sval = new BwString(null, val);
  loc = cb.getLocation(sval);
  if (loc == null) {
   return false;
  }
 } else {
  final GetEntityResponse<BwLocation> resp =
      cb.fetchLocationByKey(param.getValue(), val);
  if (resp.getStatus() != ok) {
   return false;
  }
  loc = resp.getEntity();
 }
 ev.setLocation(loc);
 chg.changed(PropertyIndex.PropertyInfoIndex.LOCATION,
       evloc, loc);
 return true;
}

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

if (tzParam.equals(property.getParameter(Parameter.TZID))) {

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

/**
   * @throws IOException
   * @throws ParserException
   */
  public void testTzIdCompatibility() throws IOException, ParserException {
    
    CalendarBuilder builder = new CalendarBuilder();
    Calendar calendar = builder.build(getClass().getResourceAsStream("/samples/valid/tmeher.ics"));
    
    // ensure the calendar is loaded properly..
    assertNotNull(calendar);
    
    TimeZoneRegistry registry = builder.getRegistry();

    calendar.getComponents().forEach(calendarComponent -> {
      calendarComponent.getProperties().forEach(property -> {
        TzId tzId = property.getParameter(Parameter.TZID);
        if (tzId != null) {
          assertNotNull(registry.getTimeZone(tzId.getValue()));
        }
      });
    });
  }
}

相关文章