Java Code Examples for com.google.inject.Provider

The following are top voted examples for showing how to use com.google.inject.Provider. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> thisTypeRefImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EObject location) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleThisTypeRefEObject(G, _subtrace_, location);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("thisTypeRefEObject") + stringRepForEnv(G) + " |~ " + stringRep(location) + " ~> " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleThisTypeRefEObject) {
  	thisTypeRefThrowException(ruleName("thisTypeRefEObject") + stringRepForEnv(G) + " |~ " + stringRep(location) + " ~> " + "TypeRef",
  		THISTYPEREFEOBJECT,
  		e_applyRuleThisTypeRefEObject, location, new ErrorInformation[] {new ErrorInformation(location)});
  	return null;
  }
}
 
Example 2
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeArgument> substTypeVariablesImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComposedTypeRef typeRef) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeArgument> _result_ = applyRuleSubstTypeVariablesInComposedTypeRef(G, _subtrace_, typeRef);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("substTypeVariablesInComposedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubstTypeVariablesInComposedTypeRef) {
  	substTypeVariablesThrowException(ruleName("substTypeVariablesInComposedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + "ComposedTypeRef",
  		SUBSTTYPEVARIABLESINCOMPOSEDTYPEREF,
  		e_applyRuleSubstTypeVariablesInComposedTypeRef, typeRef, new ErrorInformation[] {new ErrorInformation(typeRef)});
  	return null;
  }
}
 
Example 3
Project: Pogamut3   File: UT2004BotModule.java   Source Code and License 6 votes vote down vote up
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(BotFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(ILockableVisionWorldView.class);
			bind(ILockableWorldView.class).to(ILockableVisionWorldView.class);
			bind(ILockableVisionWorldView.class).to(UT2004SyncLockableWorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004SyncLockableWorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IAgent3D.class);
			bind(IAgent3D.class).to(IUT2004Bot.class);
			bind(IUT2004Bot.class).to(UT2004Bot.class);
			if (botControllerClass != null) {
				bind(IUT2004BotController.class).to(botControllerClass);
			}
			bind(UT2004BotParameters.class).toProvider((Provider<? extends UT2004BotParameters>) getAgentParamsProvider());
		}
		
	});
}
 
Example 4
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeTypeRef left, final TypeTypeRef right) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeTypeTypeRef(G, _subtrace_, left, right);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeTypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeTypeTypeRef) {
  	subtypeThrowException(ruleName("subtypeTypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right),
  		SUBTYPETYPETYPEREF,
  		e_applyRuleSubtypeTypeTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
  	return null;
  }
}
 
Example 5
Project: empiria.player   File: ExtendTestGuiceModule.java   Source Code and License 6 votes vote down vote up
private Provider<?> getProvider(final Class<?> clazz, final BindType bindType) {
    Provider<?> provider = new Provider<Object>() {
        @Override
        public Object get() {
            try {
                Object instance = null;
                if (bindType == BindType.SPY) {
                    instance = spy(clazz.newInstance());
                } else if (bindType == BindType.MOCK) {
                    instance = mock(clazz);
                }
                return instance;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
    };
    return provider;
}
 
Example 6
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TEnumLiteral enumLiteral) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeTEnumLiteral(G, _subtrace_, enumLiteral);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeTEnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeTEnumLiteral) {
  	typeThrowException(ruleName("typeTEnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + "TypeRef",
  		TYPETENUMLITERAL,
  		e_applyRuleTypeTEnumLiteral, enumLiteral, new ErrorInformation[] {new ErrorInformation(enumLiteral)});
  	return null;
  }
}
 
Example 7
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> expectedTypeInImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PostfixExpression e, final Expression expression) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleExpectedTypeInPostfixExpression(G, _subtrace_, e, expression);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("expectedTypeInPostfixExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " |> " + stringRep(expression) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleExpectedTypeInPostfixExpression) {
  	expectedTypeInThrowException(ruleName("expectedTypeInPostfixExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " |> " + stringRep(expression) + " : " + "TypeRef",
  		EXPECTEDTYPEINPOSTFIXEXPRESSION,
  		e_applyRuleExpectedTypeInPostfixExpression, e, expression, new ErrorInformation[] {new ErrorInformation(e), new ErrorInformation(expression)});
  	return null;
  }
}
 
Example 8
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TVariable tvariable) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeTVariable(G, _subtrace_, tvariable);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeTVariable") + stringRepForEnv(G) + " |- " + stringRep(tvariable) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeTVariable) {
  	typeThrowException(ruleName("typeTVariable") + stringRepForEnv(G) + " |- " + stringRep(tvariable) + " : " + "TypeRef",
  		TYPETVARIABLE,
  		e_applyRuleTypeTVariable, tvariable, new ErrorInformation[] {new ErrorInformation(tvariable)});
  	return null;
  }
}
 
Example 9
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ObjectLiteral ol) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeObjectLiteral(G, _subtrace_, ol);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeObjectLiteral") + stringRepForEnv(G) + " |- " + stringRep(ol) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeObjectLiteral) {
  	typeThrowException(ruleName("typeObjectLiteral") + stringRepForEnv(G) + " |- " + stringRep(ol) + " : " + "TypeRef",
  		TYPEOBJECTLITERAL,
  		e_applyRuleTypeObjectLiteral, ol, new ErrorInformation[] {new ErrorInformation(ol)});
  	return null;
  }
}
 
Example 10
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final SuperLiteral superLiteral) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeSuperLiteral(G, _subtrace_, superLiteral);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeSuperLiteral") + stringRepForEnv(G) + " |- " + stringRep(superLiteral) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeSuperLiteral) {
  	typeThrowException(ruleName("typeSuperLiteral") + stringRepForEnv(G) + " |- " + stringRep(superLiteral) + " : " + "TypeRef",
  		TYPESUPERLITERAL,
  		e_applyRuleTypeSuperLiteral, superLiteral, new ErrorInformation[] {new ErrorInformation(superLiteral)});
  	return null;
  }
}
 
Example 11
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IdentifierRef idref) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeIdentifierRef(G, _subtrace_, idref);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeIdentifierRef") + stringRepForEnv(G) + " |- " + stringRep(idref) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeIdentifierRef) {
  	typeThrowException(ruleName("typeIdentifierRef") + stringRepForEnv(G) + " |- " + stringRep(idref) + " : " + "TypeRef",
  		TYPEIDENTIFIERREF,
  		e_applyRuleTypeIdentifierRef, idref, new ErrorInformation[] {new ErrorInformation(idref)});
  	return null;
  }
}
 
Example 12
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> expectedTypeInImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VariableBinding binding, final Expression initExpr) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleExpectedTypeOfRightSideInVariableBinding(G, _subtrace_, binding, initExpr);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("expectedTypeOfRightSideInVariableBinding") + stringRepForEnv(G) + " |- " + stringRep(binding) + " |> " + stringRep(initExpr) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleExpectedTypeOfRightSideInVariableBinding) {
  	expectedTypeInThrowException(ruleName("expectedTypeOfRightSideInVariableBinding") + stringRepForEnv(G) + " |- " + stringRep(binding) + " |> " + stringRep(initExpr) + " : " + "TypeRef",
  		EXPECTEDTYPEOFRIGHTSIDEINVARIABLEBINDING,
  		e_applyRuleExpectedTypeOfRightSideInVariableBinding, binding, initExpr, new ErrorInformation[] {new ErrorInformation(binding), new ErrorInformation(initExpr)});
  	return null;
  }
}
 
Example 13
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final N4EnumLiteral enumLiteral) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeN4EnumLiteral(G, _subtrace_, enumLiteral);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeN4EnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeN4EnumLiteral) {
  	typeThrowException(ruleName("typeN4EnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + "TypeRef",
  		TYPEN4ENUMLITERAL,
  		e_applyRuleTypeN4EnumLiteral, enumLiteral, new ErrorInformation[] {new ErrorInformation(enumLiteral)});
  	return null;
  }
}
 
Example 14
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ArrayLiteral al) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeArrayLiteral(G, _subtrace_, al);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeArrayLiteral") + stringRepForEnv(G) + " |- " + stringRep(al) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeArrayLiteral) {
  	typeThrowException(ruleName("typeArrayLiteral") + stringRepForEnv(G) + " |- " + stringRep(al) + " : " + "TypeRef",
  		TYPEARRAYLITERAL,
  		e_applyRuleTypeArrayLiteral, al, new ErrorInformation[] {new ErrorInformation(al)});
  	return null;
  }
}
 
Example 15
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final N4FieldDeclaration fieldDecl) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeN4FieldDeclaration(G, _subtrace_, fieldDecl);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeN4FieldDeclaration") + stringRepForEnv(G) + " |- " + stringRep(fieldDecl) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeN4FieldDeclaration) {
  	typeThrowException(ruleName("typeN4FieldDeclaration") + stringRepForEnv(G) + " |- " + stringRep(fieldDecl) + " : " + "TypeRef",
  		TYPEN4FIELDDECLARATION,
  		e_applyRuleTypeN4FieldDeclaration, fieldDecl, new ErrorInformation[] {new ErrorInformation(fieldDecl)});
  	return null;
  }
}
 
Example 16
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParenExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeParenExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeParenExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeParenExpression) {
  	typeThrowException(ruleName("typeParenExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "TypeRef",
  		TYPEPARENEXPRESSION,
  		e_applyRuleTypeParenExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 17
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AwaitExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeAwaitExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeAwaitExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeAwaitExpression) {
  	typeThrowException(ruleName("typeAwaitExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "TypeRef",
  		TYPEAWAITEXPRESSION,
  		e_applyRuleTypeAwaitExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 18
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedPropertyAccessExpression expr) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypePropertyAccessExpression(G, _subtrace_, expr);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typePropertyAccessExpression") + stringRepForEnv(G) + " |- " + stringRep(expr) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypePropertyAccessExpression) {
  	typeThrowException(ruleName("typePropertyAccessExpression") + stringRepForEnv(G) + " |- " + stringRep(expr) + " : " + "TypeRef",
  		TYPEPROPERTYACCESSEXPRESSION,
  		e_applyRuleTypePropertyAccessExpression, expr, new ErrorInformation[] {new ErrorInformation(expr)});
  	return null;
  }
}
 
Example 19
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NewTarget nt) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeNewTarget(G, _subtrace_, nt);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeNewTarget") + stringRepForEnv(G) + " |- " + stringRep(nt) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeNewTarget) {
  	typeThrowException(ruleName("typeNewTarget") + stringRepForEnv(G) + " |- " + stringRep(nt) + " : " + "TypeRef",
  		TYPENEWTARGET,
  		e_applyRuleTypeNewTarget, nt, new ErrorInformation[] {new ErrorInformation(nt)});
  	return null;
  }
}
 
Example 20
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeTypeRef left, final ParameterizedTypeRef right) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeTypeTypeRef__ParameterizedTypeRef(G, _subtrace_, left, right);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeTypeTypeRef__ParameterizedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeTypeTypeRef__ParameterizedTypeRef) {
  	subtypeThrowException(ruleName("subtypeTypeTypeRef__ParameterizedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right),
  		SUBTYPETYPETYPEREF__PARAMETERIZEDTYPEREF,
  		e_applyRuleSubtypeTypeTypeRef__ParameterizedTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
  	return null;
  }
}
 
Example 21
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> thisTypeRefImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef type) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleThisTypeRefParameterizedTypeRef(G, _subtrace_, type);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("thisTypeRefParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(type) + " ~> " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleThisTypeRefParameterizedTypeRef) {
  	thisTypeRefThrowException(ruleName("thisTypeRefParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(type) + " ~> " + "BoundThisTypeRef",
  		THISTYPEREFPARAMETERIZEDTYPEREF,
  		e_applyRuleThisTypeRefParameterizedTypeRef, type, new ErrorInformation[] {new ErrorInformation(type)});
  	return null;
  }
}
 
Example 22
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> supertypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final TypeRef right) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSupertypeTypeRef(G, _subtrace_, left, right);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("supertypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " :> " + stringRep(right);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSupertypeTypeRef) {
  	supertypeThrowException(ruleName("supertypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " :> " + stringRep(right),
  		SUPERTYPETYPEREF,
  		e_applyRuleSupertypeTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
  	return null;
  }
}
 
Example 23
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ShiftExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeShiftExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeShiftExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeShiftExpression) {
  	typeThrowException(ruleName("typeShiftExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "ParameterizedTypeRef",
  		TYPESHIFTEXPRESSION,
  		e_applyRuleTypeShiftExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 24
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RelationalExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeRelationalExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeRelationalExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeRelationalExpression) {
  	typeThrowException(ruleName("typeRelationalExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "ParameterizedTypeRef",
  		TYPERELATIONALEXPRESSION,
  		e_applyRuleTypeRelationalExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 25
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BinaryBitwiseExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeBinaryBitwiseExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeBinaryBitwiseExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeBinaryBitwiseExpression) {
  	typeThrowException(ruleName("typeBinaryBitwiseExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "ParameterizedTypeRef",
  		TYPEBINARYBITWISEEXPRESSION,
  		e_applyRuleTypeBinaryBitwiseExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 26
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleUpperBoundExistentialTypeRef(G, _subtrace_, existentialTypeRef);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleUpperBoundExistentialTypeRef) {
  	upperBoundThrowException(ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + "TypeRef",
  		UPPERBOUNDEXISTENTIALTYPEREF,
  		e_applyRuleUpperBoundExistentialTypeRef, existentialTypeRef, new ErrorInformation[] {new ErrorInformation(existentialTypeRef)});
  	return null;
  }
}
 
Example 27
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final CastExpression e) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeCastExpression(G, _subtrace_, e);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeCastExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeCastExpression) {
  	typeThrowException(ruleName("typeCastExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " : " + "TypeRef",
  		TYPECASTEXPRESSION,
  		e_applyRuleTypeCastExpression, e, new ErrorInformation[] {new ErrorInformation(e)});
  	return null;
  }
}
 
Example 28
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModuleNamespaceVirtualType t) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleTypeModuleNamespace(G, _subtrace_, t);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("typeModuleNamespace") + stringRepForEnv(G) + " |- " + stringRep(t) + " : " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleTypeModuleNamespace) {
  	typeThrowException(ruleName("typeModuleNamespace") + stringRepForEnv(G) + " |- " + stringRep(t) + " : " + "TypeRef",
  		TYPEMODULENAMESPACE,
  		e_applyRuleTypeModuleNamespace, t, new ErrorInformation[] {new ErrorInformation(t)});
  	return null;
  }
}
 
Example 29
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final TypeRef right) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeTypeRef(G, _subtrace_, left, right);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeTypeRef) {
  	subtypeThrowException(ruleName("subtypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right),
  		SUBTYPETYPEREF,
  		e_applyRuleSubtypeTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
  	return null;
  }
}
 
Example 30
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnknownTypeRef left, final TypeRef right) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeUnknownTypeRef_Left(G, _subtrace_, left, right);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeUnknownTypeRef_Left") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeUnknownTypeRef_Left) {
  	subtypeThrowException(ruleName("subtypeUnknownTypeRef_Left") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right),
  		SUBTYPEUNKNOWNTYPEREF_LEFT,
  		e_applyRuleSubtypeUnknownTypeRef_Left, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
  	return null;
  }
}
 
Example 31
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef leftOriginal, final ParameterizedTypeRef rightOriginal) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeParameterizedTypeRef(G, _subtrace_, leftOriginal, rightOriginal);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeParameterizedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(leftOriginal) + " <: " + stringRep(rightOriginal);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeParameterizedTypeRef) {
  	subtypeThrowException(ruleName("subtypeParameterizedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(leftOriginal) + " <: " + stringRep(rightOriginal),
  		SUBTYPEPARAMETERIZEDTYPEREF,
  		e_applyRuleSubtypeParameterizedTypeRef, leftOriginal, rightOriginal, new ErrorInformation[] {new ErrorInformation(leftOriginal), new ErrorInformation(rightOriginal)});
  	return null;
  }
}
 
Example 32
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeArgument> substTypeVariablesImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionTypeRef typeRef) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeArgument> _result_ = applyRuleSubstTypeVariablesInFunctionTypeRef(G, _subtrace_, typeRef);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("substTypeVariablesInFunctionTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubstTypeVariablesInFunctionTypeRef) {
  	substTypeVariablesThrowException(ruleName("substTypeVariablesInFunctionTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + "TypeRef",
  		SUBSTTYPEVARIABLESINFUNCTIONTYPEREF,
  		e_applyRuleSubstTypeVariablesInFunctionTypeRef, typeRef, new ErrorInformation[] {new ErrorInformation(typeRef)});
  	return null;
  }
}
 
Example 33
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final Wildcard wildcard) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<TypeRef> _result_ = applyRuleUpperBoundWildcardTypeRef(G, _subtrace_, wildcard);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("upperBoundWildcardTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(wildcard) + " /\\ " + stringRep(_result_.getFirst());
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleUpperBoundWildcardTypeRef) {
  	upperBoundThrowException(ruleName("upperBoundWildcardTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(wildcard) + " /\\ " + "TypeRef",
  		UPPERBOUNDWILDCARDTYPEREF,
  		e_applyRuleUpperBoundWildcardTypeRef, wildcard, new ErrorInformation[] {new ErrorInformation(wildcard)});
  	return null;
  }
}
 
Example 34
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final BoundThisTypeRef boundThisTypeRef) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeTypeRefBoundThisTypeRef(G, _subtrace_, left, boundThisTypeRef);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeTypeRefBoundThisTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(boundThisTypeRef);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeTypeRefBoundThisTypeRef) {
  	subtypeThrowException(ruleName("subtypeTypeRefBoundThisTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(boundThisTypeRef),
  		SUBTYPETYPEREFBOUNDTHISTYPEREF,
  		e_applyRuleSubtypeTypeRefBoundThisTypeRef, left, boundThisTypeRef, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(boundThisTypeRef)});
  	return null;
  }
}
 
Example 35
Project: n4js   File: InternalTypeSystem.java   Source Code and License 6 votes vote down vote up
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
  try {
  	final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
  	final Result<Boolean> _result_ = applyRuleSubtypeExistentialTypeRef_Right(G, _subtrace_, left, existentialTypeRef);
  	addToTrace(_trace_, new Provider<Object>() {
  		public Object get() {
  			return ruleName("subtypeExistentialTypeRef_Right") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(existentialTypeRef);
  		}
  	});
  	addAsSubtrace(_trace_, _subtrace_);
  	return _result_;
  } catch (Exception e_applyRuleSubtypeExistentialTypeRef_Right) {
  	subtypeThrowException(ruleName("subtypeExistentialTypeRef_Right") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(existentialTypeRef),
  		SUBTYPEEXISTENTIALTYPEREF_RIGHT,
  		e_applyRuleSubtypeExistentialTypeRef_Right, left, existentialTypeRef, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(existentialTypeRef)});
  	return null;
  }
}
 
Example 36
Project: Lagerta   File: LeadServiceForTests.java   Source Code and License 5 votes vote down vote up
@Inject
public LeadServiceForTests(final DoubleLeadService lead) {
    super(new Provider<LeadService>() {
        @Override
        public LeadService get() {
            return lead;
        }
    });
}
 
Example 37
Project: verify-hub   File: SamlProxySamlTransformationErrorExceptionMapper.java   Source Code and License 5 votes vote down vote up
@Inject
public SamlProxySamlTransformationErrorExceptionMapper(
        Provider<HttpServletRequest> contextProvider,
        EventSinkMessageSender eventSinkMessageSender,
        LevelLoggerFactory<SamlProxySamlTransformationErrorExceptionMapper> levelLoggerFactory) {
    super(contextProvider);
    this.eventSinkMessageSender = eventSinkMessageSender;
    this.levelLogger = levelLoggerFactory.createLevelLogger(SamlProxySamlTransformationErrorExceptionMapper.class);
}
 
Example 38
Project: n4js   File: N4JSRuntimeModule.java   Source Code and License 5 votes vote down vote up
/**
 * Provides new instances of the ImportedNamesAdapter, e.g. concrete instances of N4JSImportedNamesAdapter.
 *
 * @see ImportedNamesAdapter
 */
public Provider<ImportedNamesAdapter> provideImportedNamesAdapter() {
	return new Provider<ImportedNamesAdapter>() {
		@Override
		public ImportedNamesAdapter get() {
			return new N4JSImportedNamesAdapter();
		}
	};
}
 
Example 39
Project: Pogamut3   File: AgentScope.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> Provider scope(Key<T> key, Provider<T> creator) {
	synchronized(providers) {
		Provider p = providers.get(key);
		if (p != null) { 
			return p;
		}
		SingletonProvider<T> provider = new SingletonProvider<T>(creator);
		providers.put(key, provider);
		return provider;
	}
}
 
Example 40
Project: pokemon-tcgo-deck-generator   File: AbstractPkmntcgoRuntimeModule.java   Source Code and License 4 votes vote down vote up
public Provider<? extends InternalPkmntcgoLexer> provideInternalPkmntcgoLexer() {
	return LexerProvider.create(InternalPkmntcgoLexer.class);
}