Java Code Examples for org.eclipse.xtext.common.types.JvmFloatAnnotationValue#getValues()

The following examples show how to use org.eclipse.xtext.common.types.JvmFloatAnnotationValue#getValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdtBasedTypeFactory.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createFloatAnnotationValue(Object value) {
	JvmFloatAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmFloatAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof Float) {
					values.addUnique(element);
				} else if (element != null) {
					values.addUnique(((Number)element).floatValue());
				}
			}
		} else if (value instanceof Float) {
			values.addUnique(value);
		} else if (value instanceof Number) {
			values.addUnique(((Number)value).floatValue());
		}
	}
	return annotationValue;
}
 
Example 2
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final long[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Long> _function = (Long v) -> {
    EList<Float> _values = it.getValues();
    _values.add(Float.valueOf(((float) (v).longValue())));
  };
  ((List<Long>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 3
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final int[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Integer> _function = (Integer v) -> {
    EList<Float> _values = it.getValues();
    _values.add(Float.valueOf(((float) (v).intValue())));
  };
  ((List<Integer>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 4
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final short[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Short> _function = (Short v) -> {
    EList<Float> _values = it.getValues();
    _values.add(Float.valueOf(((float) (v).shortValue())));
  };
  ((List<Short>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 5
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final byte[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Byte> _function = (Byte v) -> {
    EList<Float> _values = it.getValues();
    _values.add(Float.valueOf(((float) (v).byteValue())));
  };
  ((List<Byte>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 6
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final char[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Character> _function = (Character v) -> {
    EList<Float> _values = it.getValues();
    _values.add(Float.valueOf(((float) (v).charValue())));
  };
  ((List<Character>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 7
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void _setValue(final JvmFloatAnnotationValue it, final float[] value, final String componentType, final boolean mustBeArray) {
  EList<Float> _values = it.getValues();
  Iterables.<Float>addAll(_values, ((Iterable<? extends Float>)Conversions.doWrapArray(value)));
}