本文整理了Java中java.text.DateFormat.isLenient()
方法的一些代码示例,展示了DateFormat.isLenient()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateFormat.isLenient()
方法的具体详情如下:
包路径:java.text.DateFormat
类名称:DateFormat
方法名:isLenient
[英]Indicates whether the calendar used by this date format is lenient.
[中]指示此日期格式使用的日历是否宽松。
代码示例来源:origin: stackoverflow.com
return localSimpleDateFormat.get().isLenient();
代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base
/**
* Returns whether date/time parsing is lenient.
* @stable ICU 2.0
*/
public boolean isLenient()
{
return dateFormat.isLenient();
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Tell whether date/time parsing is to be lenient. It is the same as {@link java.text.DateFormat#isLenient()}.
*
* @return true or false.
*/
public boolean isLenient() {
return _format.isLenient();
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base
/**
* Returns whether date/time parsing is lenient.
* @stable ICU 2.0
*/
public boolean isLenient()
{
return dateFormat.isLenient();
}
代码示例来源:origin: com.jgoodies/jgoodies-common
@Override
public boolean isLenient() {
return delegate.isLenient();
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public boolean isLenient()
{
return delegate.get().isLenient();
}
代码示例来源:origin: com.github.XDean/Java-EX
@Override
public boolean isLenient() {
return get().isLenient();
}
}
代码示例来源:origin: stackoverflow.com
SimpleDateFormat sdf = new SimpleDateFormat("M/dd/yyyy");
try {
sdf.setLenient(true);
Date date = sdf.parse("1/33/1999");
System.out.println("DateFormat is OK");
sdf.setLenient(false);
date = sdf.parse("1/33/1999");
} catch (ParseException ex) {
ex.printStackTrace();
if (!sdf.isLenient()) {
System.out.println("Invalid date");
} else {
System.out.println("Invalid date pattern");
}
}
代码示例来源:origin: EvoSuite/evosuite
public boolean isLenient()
{
Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, "isLenient", "()Z", new Object[] {});
boolean ret = super.isLenient();
Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, ret);
return ret;
}
代码示例来源:origin: Talend/components
public static java.text.DateFormat getInstance(String pattern, Locale locale, boolean lenient) {
localDateFormatKey.get().pattern = pattern;
localDateFormatKey.get().locale = locale;
java.text.DateFormat format = localCache.get().get(localDateFormatKey.get());
if (format == null) {
if (pattern.equals("yyyy-MM-dd")) { //$NON-NLS-1$
format = new DateParser();
} else if (pattern.equals("yyyy-MM-dd HH:mm:ss")) { //$NON-NLS-1$
format = new DateTimeParser();
} else {
if (locale != null) {
format = new java.text.SimpleDateFormat(pattern, locale);
} else {
format = new java.text.SimpleDateFormat(pattern);
}
}
localCache.get().put(getInstance().new DateFormatKey(pattern, locale), format);
}
if (format.isLenient() != lenient) {
format.setLenient(lenient);
}
return format;
}
代码示例来源:origin: org.talend.components/components-common
public static java.text.DateFormat getInstance(String pattern, Locale locale, boolean lenient) {
localDateFormatKey.get().pattern = pattern;
localDateFormatKey.get().locale = locale;
java.text.DateFormat format = localCache.get().get(localDateFormatKey.get());
if (format == null) {
if (pattern.equals("yyyy-MM-dd")) { //$NON-NLS-1$
format = new DateParser();
} else if (pattern.equals("yyyy-MM-dd HH:mm:ss")) { //$NON-NLS-1$
format = new DateTimeParser();
} else {
if (locale != null) {
format = new java.text.SimpleDateFormat(pattern, locale);
} else {
format = new java.text.SimpleDateFormat(pattern);
}
}
localCache.get().put(getInstance().new DateFormatKey(pattern, locale), format);
}
if (format.isLenient() != lenient) {
format.setLenient(lenient);
}
return format;
}
代码示例来源:origin: apache/tapestry-5
public boolean isCoercedStringToDateFormatLenient()
{
return typeCoercer.coerce("dd/MM/yyyy", java.text.DateFormat.class).isLenient();
}
}
代码示例来源:origin: pentaho/pentaho-reporting
private void verifyCommonDateFormats( DateFormat dateFormat ) {
assertThat( dateFormat, is( notNullValue() ) );
assertFalse( dateFormat.isLenient() );
assertEquals( TimeZone.getDefault(), dateFormat.getTimeZone() );
}
}
代码示例来源:origin: stackoverflow.com
return _format.isLenient();
代码示例来源:origin: jpos/jPOS
@Test
public void testConstructor() throws Throwable {
DailyLogListener dailyLogListener = new DailyLogListener();
assertEquals("dailyLogListener.getCompressionBufferSize()", 131072, dailyLogListener.getCompressionBufferSize());
assertNotNull("dailyLogListener.p", dailyLogListener.p);
assertEquals("dailyLogListener.getCompressedSuffix()", "", dailyLogListener.getCompressedSuffix());
assertEquals("dailyLogListener.getSuffix()", ".log", dailyLogListener.getSuffix());
assertEquals("dailyLogListener.getCompressionFormat()", 0, dailyLogListener.getCompressionFormat());
assertTrue("dailyLogListener.getDateFmt().isLenient()", dailyLogListener.getDateFmt().isLenient());
}
代码示例来源:origin: jpos/jPOS
@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
DailyLogListener dailyLogListener = new DailyLogListener();
Configuration cfg = new SubConfiguration();
try {
dailyLogListener.setConfiguration(cfg);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertNull("dailyLogListener.rotate", dailyLogListener.rotate);
assertEquals("dailyLogListener.getCompressionBufferSize()", 131072, dailyLogListener.getCompressionBufferSize());
assertNotNull("dailyLogListener.p", dailyLogListener.p);
assertNull("dailyLogListener.getPrefix()", dailyLogListener.getPrefix());
assertEquals("dailyLogListener.getSuffix()", ".log", dailyLogListener.getSuffix());
assertNull("dailyLogListener.f", dailyLogListener.f);
assertEquals("dailyLogListener.getCompressedSuffix()", "", dailyLogListener.getCompressedSuffix());
assertNull("dailyLogListener.logName", dailyLogListener.logName);
assertEquals("dailyLogListener.sleepTime", 0L, dailyLogListener.sleepTime);
assertEquals("dailyLogListener.maxSize", 0L, dailyLogListener.maxSize);
assertEquals("dailyLogListener.getCompressionFormat()", 0, dailyLogListener.getCompressionFormat());
assertTrue("dailyLogListener.getDateFmt().isLenient()", dailyLogListener.getDateFmt().isLenient());
}
}
内容来源于网络,如有侵权,请联系作者删除!