本文整理了Java中java.text.SimpleDateFormat.parseObject()
方法的一些代码示例,展示了SimpleDateFormat.parseObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.parseObject()
方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:parseObject
暂无
代码示例来源:origin: org.apache.commons/commons-lang3
@Override
public Object parseObject(final String source, final ParsePosition pos) {
synchronized(this) {
return inner.parseObject(source, pos);
}
}
};
代码示例来源:origin: bluelinelabs/LoganSquare
@Override
public Object parseObject(String string) throws ParseException {
return super.parseObject(getFixedInputString(string));
}
代码示例来源:origin: bluelinelabs/LoganSquare
@Override
public Object parseObject(String string, ParsePosition position) {
return super.parseObject(getFixedInputString(string), position);
}
代码示例来源:origin: org.joda/joda-convert
@Override
public Object convertFromString(Class<?> cls, String str) {
if (str.length() != 29) {
throw new IllegalArgumentException("Unable to parse date: " + str);
}
String str2 = str.substring(0, 26) + str.substring(27);
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
try {
return f.parseObject(str2);
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
}
},
代码示例来源:origin: org.mortbay.jetty/jetty-util
public Object fromJSON(Map map)
{
if (!_fromJSON)
throw new UnsupportedOperationException();
try
{
synchronized(_format)
{
return _format.parseObject((String)map.get("value"));
}
}
catch(Exception e)
{
Log.warn(e);
}
return null;
}
代码示例来源:origin: org.joda/joda-convert
@Override
public Object convertFromString(Class<?> cls, String str) {
if (str.length() < 31 || str.charAt(26) != ':'
|| str.charAt(29) != '[' || str.charAt(str.length() - 1) != ']') {
throw new IllegalArgumentException("Unable to parse date: " + str);
}
TimeZone zone = TimeZone.getTimeZone(str.substring(30, str.length() - 1));
String str2 = str.substring(0, 26) + str.substring(27, 29);
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
GregorianCalendar cal = new GregorianCalendar(zone);
cal.setTimeInMillis(0);
f.setCalendar(cal);
try {
f.parseObject(str2);
return f.getCalendar();
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
}
},
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.Attributable#hydrate(java.lang.String)
*/
@Override
public AttributableDate hydrate(String s) {
// don't do anything to empty dates
if (StringUtils.isEmpty(s)) {
return null;
}
try {
// try to parse as the current user (
return new AttributableDate(((Date) Context.getDateFormat().parseObject(s)).getTime());
}
catch (ParseException e) {
try {
return new AttributableDate(((Date) new SimpleDateFormat(dateFormat).parseObject(s)).getTime());
}
catch (ParseException e2) {
// if we can't parse it as the normalized string or as the current
// user's date format, bail out
throw new APIException("unable.parse.string.as.date", new Object[] { s });
}
}
}
代码示例来源:origin: org.leapframework/leap-lang
@Override
public synchronized Object parseObject(String source) throws ParseException {
return format.parseObject(source);
}
}
代码示例来源:origin: org.leapframework/leap-lang
@Override
public synchronized Object parseObject(String source, ParsePosition pos) {
return format.parseObject(source, pos);
}
代码示例来源:origin: org.refcodes/refcodes-date
/**
* {@inheritDoc}
*
* @deprecated as it is not considered to be thread safe.
*/
@Deprecated
@Override
public Object parseObject( String source ) throws ParseException {
return super.parseObject( source );
}
}
代码示例来源:origin: org.refcodes/refcodes-date
/**
* {@inheritDoc}
*
* @deprecated as it is not considered to be thread safe.
*/
@Deprecated
@Override
public Object parseObject( String source, ParsePosition pos ) {
return super.parseObject( source, pos );
}
代码示例来源:origin: com.novoda/notils
public Object parseObject(String source) throws ParseException {
return localSimpleDateFormat.get().parseObject(source);
}
代码示例来源:origin: com.novoda/notils
public Object parseObject(String source, ParsePosition position) {
return localSimpleDateFormat.get().parseObject(source, position);
}
代码示例来源:origin: novoda/notils
public Object parseObject(String source, ParsePosition position) {
return localSimpleDateFormat.get().parseObject(source, position);
}
代码示例来源:origin: net.hasor/hasor-commons
public Object fromJSON(Map map) {
if (!_fromJSON)
throw new UnsupportedOperationException();
try {
synchronized (_format) {
return _format.parseObject((String) map.get("value"));
}
} catch (Exception e) {
logger.warning(e.getMessage());
}
return null;
}
public void toJSON(Object obj, JSON.Output out) {
代码示例来源:origin: zycgit/hasor
public Object fromJSON(Map map) {
if (!_fromJSON)
throw new UnsupportedOperationException();
try {
synchronized (_format) {
return _format.parseObject((String) map.get("value"));
}
} catch (Exception e) {
logger.warning(e.getMessage());
}
return null;
}
public void toJSON(Object obj, JSON.Output out) {
代码示例来源:origin: redfish64/TinyTravelTracker
public Object convertFromString(Class<?> cls, String str) {
if (str.length() != 29) {
throw new IllegalArgumentException("Unable to parse date: " + str);
}
str = str.substring(0, 26) + str.substring(27);
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
try {
return f.parseObject(str);
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
}
},
代码示例来源:origin: com.bbossgroups.plugins/bboss-elasticsearch-rest
public static void putGendate(ESIndice esIndice,SimpleDateFormat format){
int dsplit = esIndice.getIndex().lastIndexOf('-');
try {
if(dsplit > 0){
String date = esIndice.getIndex().substring(dsplit+1);
esIndice.setGenDate((Date)format.parseObject(date));
}
} catch (Exception e) {
}
}
代码示例来源:origin: bbossgroups/bboss-elasticsearch
public static void putGendate(ESIndice esIndice,SimpleDateFormat format){
int dsplit = esIndice.getIndex().lastIndexOf('-');
try {
if(dsplit > 0){
String date = esIndice.getIndex().substring(dsplit+1);
esIndice.setGenDate((Date)format.parseObject(date));
}
} catch (Exception e) {
}
}
代码示例来源:origin: org.ow2.bonita/bonita-server
public Object revert(Object o) {
try {
return dateFormat.get().parseObject((String) o);
} catch (ParseException e) {
String message = ExceptionManager.getInstance().getFullMessage("bp_DTSC_1", o);
throw new BonitaRuntimeException(message, e);
}
}
内容来源于网络,如有侵权,请联系作者删除!