本文整理汇总了Java中org.eclipse.xtext.xbase.lib.Procedures类的典型用法代码示例。如果您正苦于以下问题:Java Procedures类的具体用法?Java Procedures怎么用?Java Procedures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Procedures类属于org.eclipse.xtext.xbase.lib包,在下文中一共展示了Procedures类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toGetter
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* Creates a getter method for the given property name and the field name.
*
* Example: <code>
* public String getPropertyName() {
* return this.fieldName;
* }
* </code>
*
* @return a getter method for a JavaBeans property, <code>null</code> if sourceElement or name are <code>null</code>.
*/
/* @Nullable */
public JvmOperation toGetter(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final String propertyName, /* @Nullable */ final String fieldName, /* @Nullable */ JvmTypeReference typeRef) {
if(sourceElement == null || propertyName == null || fieldName == null)
return null;
JvmOperation result = typesFactory.createJvmOperation();
result.setVisibility(JvmVisibility.PUBLIC);
String prefix = (isPrimitiveBoolean(typeRef) ? "is" : "get");
result.setSimpleName(prefix + Strings.toFirstUpper(propertyName));
result.setReturnType(cloneWithProxies(typeRef));
setBody(result, new Procedures.Procedure1<ITreeAppendable>() {
@Override
public void apply(/* @Nullable */ ITreeAppendable p) {
if(p != null) {
p = p.trace(sourceElement);
p.append("return this.");
p.append(javaKeywords.isJavaKeyword(fieldName) ? fieldName+"_" : fieldName);
p.append(";");
}
}
});
return associate(sourceElement, result);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:34,代码来源:JvmTypesBuilder.java
示例2: toSetter
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* Creates a setter method for the given properties name with the standard implementation assigning the passed
* parameter to a similarly named field.
*
* Example: <code>
* public void setFoo(String foo) {
* this.foo = foo;
* }
* </code>
*
* @return a setter method for a JavaBeans property with the given name, <code>null</code> if sourceElement or name are <code>null</code>.
*/
/* @Nullable */
public JvmOperation toSetter(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final String propertyName, /* @Nullable */ final String fieldName, /* @Nullable */ JvmTypeReference typeRef) {
if(sourceElement == null || propertyName == null || fieldName == null)
return null;
JvmOperation result = typesFactory.createJvmOperation();
result.setVisibility(JvmVisibility.PUBLIC);
result.setReturnType(references.getTypeForName(Void.TYPE,sourceElement));
result.setSimpleName("set" + Strings.toFirstUpper(propertyName));
result.getParameters().add(toParameter(sourceElement, propertyName, typeRef));
setBody(result, new Procedures.Procedure1<ITreeAppendable>() {
@Override
public void apply(/* @Nullable */ ITreeAppendable p) {
if(p != null) {
p = p.trace(sourceElement);
p.append("this.");
p.append(javaKeywords.isJavaKeyword(fieldName) ? fieldName+"_" : fieldName);
p.append(" = ");
p.append(javaKeywords.isJavaKeyword(propertyName) ? propertyName+"_" : propertyName);
p.append(";");
}
}
});
return associate(sourceElement, result);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:37,代码来源:JvmTypesBuilder.java
示例3: buildUri
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public static String buildUri(final boolean procedure, final int functionParamCount) {
final int paramCount = Math.min(6, functionParamCount);
if (procedure) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("java:/Objects/");
String _canonicalName = Procedures.class.getCanonicalName();
_builder.append(_canonicalName);
_builder.append("#");
String _canonicalName_1 = Procedures.class.getCanonicalName();
_builder.append(_canonicalName_1);
_builder.append("$Procedure");
_builder.append(paramCount);
return _builder.toString();
}
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("java:/Objects/");
String _canonicalName_2 = Functions.class.getCanonicalName();
_builder_1.append(_canonicalName_2);
_builder_1.append("#");
String _canonicalName_3 = Functions.class.getCanonicalName();
_builder_1.append(_canonicalName_3);
_builder_1.append("$Function");
_builder_1.append(paramCount);
return _builder_1.toString();
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:XFunctionTypeRefs.java
示例4: asRunnable
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public Runnable asRunnable(final Procedures.Procedure0 procedure) {
return new Runnable() {
@Override
public void run() {
procedure.apply();
}
};
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:ClosureClient.java
示例5: asProcedure
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public Procedures.Procedure0 asProcedure(final Runnable runnable) {
return new Procedures.Procedure0() {
@Override
public void apply() {
runnable.run();
}
};
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:ClosureClient.java
示例6: isFunctionAndProcedureAvailable
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public boolean isFunctionAndProcedureAvailable(ITypeReferenceOwner owner) {
JvmType type = typeReferences.findDeclaredType(Procedures.Procedure1.class, owner.getContextResourceSet());
if (type == null) {
return false;
}
if (type instanceof JvmTypeParameterDeclarator) {
return !((JvmTypeParameterDeclarator) type).getTypeParameters().isEmpty();
}
return false;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:FunctionTypes.java
示例7: loadFunctionClass
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
private Class<?> loadFunctionClass(String simpleFunctionName, boolean procedure) {
try {
if (!procedure) {
return Functions.class.getClassLoader().loadClass(
Functions.class.getCanonicalName() + "$" + simpleFunctionName);
} else {
return Procedures.class.getClassLoader().loadClass(
Procedures.class.getCanonicalName() + "$" + simpleFunctionName);
}
} catch (ClassNotFoundException e) {
throw new WrappedException(e);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:FunctionTypes.java
示例8: getFunctionTypeKind
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public FunctionTypeKind getFunctionTypeKind(ParameterizedTypeReference typeReference) {
JvmType type = typeReference.getType();
if (type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) {
JvmDeclaredType outerType = ((JvmGenericType) type).getDeclaringType();
if (outerType != null) {
if (Procedures.class.getName().equals(outerType.getIdentifier())) {
return FunctionTypeKind.PROCEDURE;
}
if (Functions.class.getName().equals(outerType.getIdentifier())) {
return FunctionTypeKind.FUNCTION;
}
}
}
return FunctionTypeKind.NONE;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:FunctionTypes.java
示例9: setCompilationStrategy
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
protected void setCompilationStrategy(/* @Nullable */ JvmMember member, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) {
if(member == null || strategy == null)
return;
CompilationStrategyAdapter adapter = new CompilationStrategyAdapter();
adapter.setCompilationStrategy(strategy);
member.eAdapters().add(adapter);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmTypesBuilder.java
示例10: useProcedureForCharSequence
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* @since 2.3
*/
public String useProcedureForCharSequence(Procedures.Procedure1<CharSequence> proc) {
proc.apply(null);
return "done";
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:ClosureClient.java
示例11: simpleComputeExtensionClasses
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
protected Multimap<Class<?>, Class<?>> simpleComputeExtensionClasses() {
Multimap<Class<?>, Class<?>> result = ArrayListMultimap.create();
result.put(String.class, StringExtensions.class);
result.put(Double.TYPE, DoubleExtensions.class);
result.put(Float.TYPE, FloatExtensions.class);
result.put(Long.TYPE, LongExtensions.class);
result.put(Integer.TYPE, IntegerExtensions.class);
result.put(Character.TYPE, CharacterExtensions.class);
result.put(Short.TYPE, ShortExtensions.class);
result.put(Byte.TYPE, ByteExtensions.class);
result.put(Boolean.TYPE, BooleanExtensions.class);
result.put(double[].class, ArrayExtensions.class);
result.put(float[].class, ArrayExtensions.class);
result.put(long[].class, ArrayExtensions.class);
result.put(int[].class, ArrayExtensions.class);
result.put(char[].class, ArrayExtensions.class);
result.put(short[].class, ArrayExtensions.class);
result.put(byte[].class, ArrayExtensions.class);
result.put(boolean[].class, ArrayExtensions.class);
result.put(BigInteger.class, BigIntegerExtensions.class);
result.put(BigDecimal.class, BigDecimalExtensions.class);
result.put(Comparable.class, ComparableExtensions.class);
result.put(Object.class, ObjectExtensions.class);
result.put(List.class, ListExtensions.class);
result.put(Collection.class, CollectionExtensions.class);
result.put(Map.class, CollectionExtensions.class);
result.put(Map.class, MapExtensions.class);
result.put(Iterable.class, IterableExtensions.class);
result.put(Iterator.class, IteratorExtensions.class);
result.put(Functions.Function0.class, FunctionExtensions.class);
result.put(Functions.Function1.class, FunctionExtensions.class);
result.put(Functions.Function2.class, FunctionExtensions.class);
result.put(Functions.Function3.class, FunctionExtensions.class);
result.put(Functions.Function4.class, FunctionExtensions.class);
result.put(Functions.Function5.class, FunctionExtensions.class);
result.put(Functions.Function6.class, FunctionExtensions.class);
result.put(Procedures.Procedure0.class, ProcedureExtensions.class);
result.put(Procedures.Procedure1.class, ProcedureExtensions.class);
result.put(Procedures.Procedure2.class, ProcedureExtensions.class);
result.put(Procedures.Procedure3.class, ProcedureExtensions.class);
result.put(Procedures.Procedure4.class, ProcedureExtensions.class);
result.put(Procedures.Procedure5.class, ProcedureExtensions.class);
result.put(Procedures.Procedure6.class, ProcedureExtensions.class);
return result;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:46,代码来源:StaticImplicitMethodsFeatureForTypeProvider.java
示例12: isProcedure
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
private boolean isProcedure(LightweightTypeReference typeReference) {
return identifierStartWith(typeReference, Procedures.class.getCanonicalName());
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:TypeConvertingCompiler.java
示例13: getCompilationStrategy
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public Procedures.Procedure1<ITreeAppendable> getCompilationStrategy() {
return compilationStrategy;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:CompilationStrategyAdapter.java
示例14: setCompilationStrategy
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public void setCompilationStrategy(Procedures.Procedure1<ITreeAppendable> compilationStrategy) {
this.compilationStrategy = compilationStrategy;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:CompilationStrategyAdapter.java
示例15: coerceArgumentType
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
protected Object coerceArgumentType(Object value, JvmTypeReference expectedType) {
if (value == null)
return null;
if (expectedType.getType() instanceof JvmGenericType && ((JvmGenericType) expectedType.getType()).isInterface()) {
try {
JvmType type = expectedType.getType();
Class<?> functionIntf = classFinder.forName(type.getIdentifier());
if (!functionIntf.isInstance(value)) {
InvocationHandler invocationHandler = null;
if (Proxy.isProxyClass(value.getClass())) {
invocationHandler = Proxy.getInvocationHandler(value);
} else if (getClass(Functions.Function0.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function0.class));
} else if (getClass(Functions.Function1.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function1.class));
} else if (getClass(Functions.Function2.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function2.class));
} else if (getClass(Functions.Function3.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function3.class));
} else if (getClass(Functions.Function4.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function4.class));
} else if (getClass(Functions.Function5.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function5.class));
} else if (getClass(Functions.Function6.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Functions.Function6.class));
} else if (getClass(Procedures.Procedure0.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure0.class));
} else if (getClass(Procedures.Procedure1.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure1.class));
} else if (getClass(Procedures.Procedure2.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure2.class));
} else if (getClass(Procedures.Procedure3.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure3.class));
} else if (getClass(Procedures.Procedure4.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure4.class));
} else if (getClass(Procedures.Procedure5.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure5.class));
} else if (getClass(Procedures.Procedure6.class).isInstance(value)) {
invocationHandler = new DelegatingInvocationHandler(value, getClass(Procedures.Procedure6.class));
} else {
return value;
}
Object proxy = Proxy.newProxyInstance(classLoader, new Class<?>[] { functionIntf },
invocationHandler);
return proxy;
}
} catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.getMessage());
}
}
return value;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:54,代码来源:XbaseInterpreter.java
示例16: Ack
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
public Ack(final Procedures.Procedure1<Ack> initializer) {
initializer.apply(this);
}
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:4,代码来源:Ack.java
示例17: setInitializer
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* Attaches the given compile strategy to the given {@link JvmField} such that the compiler knows how to
* initialize the {@link JvmField} when it is translated to Java source code.
*
* @param field the field to add the initializer to. If <code>null</code> this method does nothing.
* @param strategy the compilation strategy. If <code>null</code> this method does nothing.
*/
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) {
if (field == null || strategy == null)
return;
removeExistingBody(field);
setCompilationStrategy(field, strategy);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:JvmTypesBuilder.java
示例18: accept
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* Accepts a {@link JvmDeclaredType} with no container, to be added to the contents list of a {@link org.eclipse.emf.ecore.resource.Resource}.
* The second parameter is a lazy initializer that is never executed during <i>preIndexingPhase</i>.
*
* @see IJvmModelInferrer#infer(EObject, IJvmDeclaredTypeAcceptor, boolean)
*
* @param type the type to
* @param lateInitialization the initializer
*/
<T extends JvmDeclaredType> void accept(T type, Procedures.Procedure1<? super T> lateInitialization);
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:IJvmDeclaredTypeAcceptor.java
示例19: initializeLater
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* The passed procedure will be executed only if in post-indexing phase, and it is executed after all {@link JvmDeclaredType} are created
* and attached to the {@link org.eclipse.emf.ecore.resource.Resource}.
*
* @deprecated use {@link #accept(JvmDeclaredType, org.eclipse.xtext.xbase.lib.Procedures.Procedure1)} instead
*/
@Deprecated
void initializeLater(Procedures.Procedure1<? super T> lateInitialization);
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:IJvmDeclaredTypeAcceptor.java
示例20: setBody
import org.eclipse.xtext.xbase.lib.Procedures; //导入依赖的package包/类
/**
* Attaches the given compile strategy to the given {@link JvmExecutable} such that the compiler knows how to
* implement the {@link JvmExecutable} when it is translated to Java source code.
*
* @param executable the operation or constructor to add the method body to. If <code>null</code> this method does nothing.
* @param strategy the compilation strategy. If <code>null</code> this method does nothing.
*/
public void setBody(/* @Nullable */ JvmExecutable executable, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) {
removeExistingBody(executable);
setCompilationStrategy(executable, strategy);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:JvmTypesBuilder.java
注:本文中的org.eclipse.xtext.xbase.lib.Procedures类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论