本文整理汇总了Java中com.google.gwt.core.shared.GwtIncompatible类的典型用法代码示例。如果您正苦于以下问题:Java GwtIncompatible类的具体用法?Java GwtIncompatible怎么用?Java GwtIncompatible使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GwtIncompatible类属于com.google.gwt.core.shared包,在下文中一共展示了GwtIncompatible类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isJsObject
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
private static final boolean isJsObject(Class<?> type) {
JsType jsType = type.getAnnotation(JsType.class);
if (jsType == null) {
return false;
}
if (!jsType.isNative()) {
return false;
}
if (!JsPackage.GLOBAL.equals(jsType.namespace())) {
return false;
}
if (!"Object".equals(jsType.name())) {
return false;
}
return true;
}
开发者ID:codegen-io,项目名称:jso-builder,代码行数:18,代码来源:PrimitivesJSOJSOBuilder.java
示例2: removeAllOccurences
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Removes the occurrences of the specified element from the specified int array.
*
* <p>
* All subsequent elements are shifted to the left (subtracts one from their indices).
* If the array doesn't contains such an element, no elements are removed from the array.
* <code>null</code> will be returned if the input array is <code>null</code>.
* </p>
*
* @param element the element to remove
* @param array the input array
*
* @return A new array containing the existing elements except the occurrences of the specified element.
* @since 3.5
*/
@GwtIncompatible("incompatible method")
public static int[] removeAllOccurences(final int[] array, final int element) {
int index = indexOf(array, element);
if (index == INDEX_NOT_FOUND) {
return clone(array);
}
final int[] indices = new int[array.length - index];
indices[0] = index;
int count = 1;
while ((index = indexOf(array, element, indices[count - 1] + 1)) != INDEX_NOT_FOUND) {
indices[count++] = index;
}
return removeAll(array, Arrays.copyOf(indices, count));
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:33,代码来源:ArrayUtils.java
示例3: validate
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Performs validations based on the configured resources.
*
* @return The <code>Map</code> returned uses the property of the
* <code>Field</code> for the key and the value is the number of error the
* field had.
* @throws ValidatorException If an error occurs during validation
*/
@GwtIncompatible("incompatible method")
public ValidatorResults validate() throws ValidatorException {
Locale locale = (Locale) this.getParameterValue(LOCALE_PARAM);
if (locale == null) {
locale = Locale.getDefault();
}
this.setParameter(VALIDATOR_PARAM, this);
Form form = this.resources.getForm(locale, this.formName);
if (form != null) {
this.setParameter(FORM_PARAM, form);
return form.validate(
this.parameters,
this.resources.getValidatorActions(),
this.page,
this.fieldName);
}
return new ValidatorResults();
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:31,代码来源:Validator.java
示例4: formatByte
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Checks if the value can safely be converted to a byte primitive.
*
* @param value The value validation is being performed on.
* @param locale The locale to use to parse the number (system default if
* null)
* @return the converted Byte value.
*/
@GwtIncompatible("incompatible method")
public static Byte formatByte(String value, Locale locale) {
Byte result = null;
if (value != null) {
NumberFormat formatter = null;
if (locale != null) {
formatter = NumberFormat.getNumberInstance(locale);
} else {
formatter = NumberFormat.getNumberInstance(Locale.getDefault());
}
formatter.setParseIntegerOnly(true);
ParsePosition pos = new ParsePosition(0);
Number num = formatter.parse(value, pos);
// If there was no error and we used the whole string
if (pos.getErrorIndex() == -1 && pos.getIndex() == value.length() &&
num.doubleValue() >= Byte.MIN_VALUE &&
num.doubleValue() <= Byte.MAX_VALUE) {
result = Byte.valueOf(num.byteValue());
}
}
return result;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:34,代码来源:GenericTypeValidator.java
示例5: formatInt
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Checks if the value can safely be converted to an int primitive.
*
* @param value The value validation is being performed on.
* @param locale The locale to use to parse the number (system default if
* null)
* @return the converted Integer value.
*/
@GwtIncompatible("incompatible method")
public static Integer formatInt(String value, Locale locale) {
Integer result = null;
if (value != null) {
NumberFormat formatter = null;
if (locale != null) {
formatter = NumberFormat.getNumberInstance(locale);
} else {
formatter = NumberFormat.getNumberInstance(Locale.getDefault());
}
formatter.setParseIntegerOnly(true);
ParsePosition pos = new ParsePosition(0);
Number num = formatter.parse(value, pos);
// If there was no error and we used the whole string
if (pos.getErrorIndex() == -1 && pos.getIndex() == value.length() &&
num.doubleValue() >= Integer.MIN_VALUE &&
num.doubleValue() <= Integer.MAX_VALUE) {
result = Integer.valueOf(num.intValue());
}
}
return result;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:34,代码来源:GenericTypeValidator.java
示例6: formatFloat
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Checks if the value can safely be converted to a float primitive.
*
* @param value The value validation is being performed on.
* @param locale The locale to use to parse the number (system default if
* null)
* @return the converted Float value.
*/
@GwtIncompatible("incompatible method")
public static Float formatFloat(String value, Locale locale) {
Float result = null;
if (value != null) {
NumberFormat formatter = null;
if (locale != null) {
formatter = NumberFormat.getInstance(locale);
} else {
formatter = NumberFormat.getInstance(Locale.getDefault());
}
ParsePosition pos = new ParsePosition(0);
Number num = formatter.parse(value, pos);
// If there was no error and we used the whole string
if (pos.getErrorIndex() == -1 && pos.getIndex() == value.length() &&
num.doubleValue() >= (Float.MAX_VALUE * -1) &&
num.doubleValue() <= Float.MAX_VALUE) {
result = new Float(num.floatValue());
}
}
return result;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:33,代码来源:GenericTypeValidator.java
示例7: formatDouble
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Checks if the value can safely be converted to a double primitive.
*
* @param value The value validation is being performed on.
* @param locale The locale to use to parse the number (system default if
* null)
* @return the converted Double value.
*/
@GwtIncompatible("incompatible method")
public static Double formatDouble(String value, Locale locale) {
Double result = null;
if (value != null) {
NumberFormat formatter = null;
if (locale != null) {
formatter = NumberFormat.getInstance(locale);
} else {
formatter = NumberFormat.getInstance(Locale.getDefault());
}
ParsePosition pos = new ParsePosition(0);
Number num = formatter.parse(value, pos);
// If there was no error and we used the whole string
if (pos.getErrorIndex() == -1 && pos.getIndex() == value.length() &&
num.doubleValue() >= (Double.MAX_VALUE * -1) &&
num.doubleValue() <= Double.MAX_VALUE) {
result = new Double(num.doubleValue());
}
}
return result;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:33,代码来源:GenericTypeValidator.java
示例8: getShortClassName
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@GwtIncompatible("incompatible method")
protected String getShortClassName(final java.lang.Class<?> cls) {
Class<? extends Annotation> annotationType = null;
for (final Class<?> iface : ClassUtils.getAllInterfaces(cls)) {
if (Annotation.class.isAssignableFrom(iface)) {
@SuppressWarnings("unchecked") // OK because we just checked the assignability
final
Class<? extends Annotation> found = (Class<? extends Annotation>) iface;
annotationType = found;
break;
}
}
return new StringBuilder(annotationType == null ? StringUtils.EMPTY : annotationType.getName())
.insert(0, '@').toString();
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:20,代码来源:AnnotationUtils.java
示例9: add
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Underlying implementation of add(array, index, element) methods.
* The last parameter is the class, which may not equal element.getClass
* for primitives.
*
* @param array the array to add the element to, may be {@code null}
* @param index the position of the new object
* @param element the object to add
* @param clss the type of the element being added
* @return A new array containing the existing elements and the new element
*/
@GwtIncompatible("incompatible method")
private static Object add(final Object array, final int index, final Object element, final Class<?> clss) {
if (array == null) {
if (index != 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0");
}
final Object joinedArray = Array.newInstance(clss, 1);
Array.set(joinedArray, 0, element);
return joinedArray;
}
final int length = Array.getLength(array);
if (index > length || index < 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);
}
final Object result = Array.newInstance(clss, length + 1);
System.arraycopy(array, 0, result, 0, index);
Array.set(result, index, element);
if (index < length) {
System.arraycopy(array, index, result, index + 1, length - index);
}
return result;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:34,代码来源:ArrayUtils.java
示例10: append
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Handles the common {@link Formattable} operations of truncate-pad-append.
*
* @param seq the string to handle, not null
* @param formatter the destination formatter, not null
* @param flags the flags for formatting, see {@code Formattable}
* @param width the width of the output, see {@code Formattable}
* @param precision the precision of the output, see {@code Formattable}
* @param padChar the pad character to use
* @param ellipsis the ellipsis to use when precision dictates truncation, null or
* empty causes a hard truncation
* @return the {@code formatter} instance, not null
*/
@GwtIncompatible("incompatible method")
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
final int precision, final char padChar, final CharSequence ellipsis) {
Validate.isTrue(ellipsis == null || precision < 0 || ellipsis.length() <= precision,
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, Integer.valueOf(precision));
final StringBuilder buf = new StringBuilder(seq);
if (precision >= 0 && precision < seq.length()) {
final CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
buf.replace(precision - _ellipsis.length(), seq.length(), _ellipsis.toString());
}
final boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;
for (int i = buf.length(); i < width; i++) {
buf.insert(leftJustify ? i : 0, padChar);
}
formatter.format(buf.toString());
return formatter;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:31,代码来源:FormattableUtils.java
示例11: translate
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@GwtIncompatible("incompatible method")
public boolean translate(final int codepoint, final Writer out) throws IOException {
if (between) {
if (codepoint < below || codepoint > above) {
return false;
}
} else {
if (codepoint >= below && codepoint <= above) {
return false;
}
}
// TODO: Handle potential + sign per various Unicode escape implementations
if (codepoint > 0xffff) {
out.write(toUtf16Escape(codepoint));
} else {
out.write("\\u");
out.write(HEX_DIGITS[(codepoint >> 12) & 15]);
out.write(HEX_DIGITS[(codepoint >> 8) & 15]);
out.write(HEX_DIGITS[(codepoint >> 4) & 15]);
out.write(HEX_DIGITS[(codepoint) & 15]);
}
return true;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:29,代码来源:UnicodeEscaper.java
示例12: toJSON
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
final String toJSON(Object object) {
if (!isJsObject(object.getClass())) {
throw new IllegalStateException("Class " + object.getClass() + " isn't a JavaScript object");
}
StringWriter writer = new StringWriter();
try {
writeJSON(writer, object);
} catch (IOException e) {
throw new RuntimeException(e);
}
return writer.toString();
}
开发者ID:codegen-io,项目名称:jso-builder,代码行数:14,代码来源:PrimitivesJSOJSOBuilder.java
示例13: writeValue
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
private static final void writeValue(Writer writer, CharSequence value) throws IOException {
for (int index = 0; index < value.length(); index++) {
char currentCharacter = value.charAt(index);
switch (currentCharacter) {
case '\\':
writer.write("\\\\");
break;
case '\"':
writer.write("\\\"");
break;
case '\b':
writer.write("\\b");
break;
case '\t':
writer.write("\\t");
break;
case '\n':
writer.write("\\n");
break;
case '\f':
writer.write("\\f");
break;
case '\r':
writer.write("\\r");
break;
default:
if ((currentCharacter >= '\u0000' && currentCharacter <= '\u001f')
|| (currentCharacter >= '\u007f' && currentCharacter <= '\u009f')
|| (currentCharacter >= '\u2028' && currentCharacter <= '\u2029')) {
writer.write("\\u");
String hexValue = Integer.toHexString(currentCharacter);
writer.write("0000", 0, 4 - hexValue.length());
writer.write(hexValue);
} else {
writer.write(currentCharacter);
}
}
}
}
开发者ID:codegen-io,项目名称:jso-builder,代码行数:41,代码来源:PrimitivesJSOJSOBuilder.java
示例14: generateHtml
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
private String generateHtml() {
switch (getAttributes().getMarkupType()) {
case None: return getAttributes().getMarkup();
case Markdown: return generateHtmlFromMarkdown();
}
throw new IllegalArgumentException("Unknown markup type: " + getAttributes().getMarkupType());
}
开发者ID:vsite-hr,项目名称:mentor,代码行数:9,代码来源:TextUnit.java
示例15: before
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
@Before
public void before() {
// for correct stacktrace decoding, we need the debug info.
boolean debug = true;
// Convert to javascript
VertxUI.with(this.getClass(), null, debug, true);
// Start the headless browser
jBrowser = new JBrowserDriver(Settings.builder().logJavascript(true).build());
jBrowser.get("file:///" + new File(VertxUI.getTargetFolder(debug) + "/index.html").getAbsolutePath());
}
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:14,代码来源:TestDOM.java
示例16: after
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
@GwtIncompatible
@After
public void after() {
if (jBrowser != null) {
jBrowser.quit();
}
}
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:8,代码来源:TestDOM.java
示例17: clone
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Creates and returns a copy of this object.
* @return A copy of the Msg.
*/
@GwtIncompatible("incompatible method")
@Override
public Object clone() {
try {
return super.clone();
} catch(CloneNotSupportedException e) {
throw new RuntimeException(e.toString());
}
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:15,代码来源:Msg.java
示例18: copyFastHashMap
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* Makes a deep copy of a <code>FastHashMap</code> if the values
* are <code>Msg</code>, <code>Arg</code>,
* or <code>Var</code>. Otherwise it is a shallow copy.
*
* @param map <code>FastHashMap</code> to copy.
* @return FastHashMap A copy of the <code>FastHashMap</code> that was
* passed in.
* @deprecated This method is not part of Validator's public API. Validator
* will use it internally until FastHashMap references are removed. Use
* copyMap() instead.
*/
@GwtIncompatible("incompatible method")
@Deprecated
public static FastHashMap copyFastHashMap(FastHashMap map) {
FastHashMap results = new FastHashMap();
@SuppressWarnings("unchecked") // FastHashMap is not generic
Iterator<Entry<String, ?>> i = map.entrySet().iterator();
while (i.hasNext()) {
Entry<String, ?> entry = i.next();
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
results.setFast(true);
return results;
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:39,代码来源:ValidatorUtils.java
示例19: isSupported
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* <p>Returns whether the named charset is supported.</p>
*
* <p>This is similar to <a
* href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html#isSupported%28java.lang.String%29">
* java.nio.charset.Charset.isSupported(String)</a> but handles more formats</p>
*
* @param name the name of the requested charset; may be either a canonical name or an alias, null returns false
* @return {@code true} if the charset is available in the current Java virtual machine
* @deprecated Please use {@link Charset#isSupported(String)} instead, although be aware that {@code null}
* values are not accepted by that method and an {@link IllegalCharsetNameException} may be thrown.
*/
@GwtIncompatible("incompatible method")
@Deprecated
public static boolean isSupported(final String name) {
if (name == null) {
return false;
}
try {
return Charset.isSupported(name);
} catch (final IllegalCharsetNameException ex) {
return false;
}
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:25,代码来源:CharEncoding.java
示例20: isValidAnnotationMemberType
import com.google.gwt.core.shared.GwtIncompatible; //导入依赖的package包/类
/**
* <p>Checks if the specified type is permitted as an annotation member.</p>
*
* <p>The Java language specification only permits certain types to be used
* in annotations. These include {@link String}, {@link Class}, primitive
* types, {@link Annotation}, {@link Enum}, and single-dimensional arrays of
* these types.</p>
*
* @param type the type to check, {@code null}
* @return {@code true} if the type is a valid type to use in an annotation
*/
@GwtIncompatible("incompatible method")
public static boolean isValidAnnotationMemberType(Class<?> type) {
if (type == null) {
return false;
}
if (type.isArray()) {
type = type.getComponentType();
}
return type.isPrimitive() || type.isEnum() || type.isAnnotation()
|| String.class.equals(type) || Class.class.equals(type);
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-lang3,代码行数:23,代码来源:AnnotationUtils.java
注:本文中的com.google.gwt.core.shared.GwtIncompatible类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论