|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.javascript.jscomp.CodingConventions.Proxy
public static class CodingConventions.Proxy
A convention that wraps another. When you want to support a new library, you should subclass this delegate, and override the methods that you want to customize. This way, a person using jQuery and Closure Library can create a new coding convention by creating a jQueryCodingConvention that delegates to a ClosureCodingConvention that delegates to a DefaultCodingConvention.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.google.javascript.jscomp.CodingConvention |
---|
CodingConvention.AssertionFunctionSpec, CodingConvention.Bind, CodingConvention.DelegateRelationship, CodingConvention.ObjectLiteralCast, CodingConvention.SubclassRelationship, CodingConvention.SubclassType |
Field Summary | |
---|---|
protected CodingConvention |
nextConvention
|
Constructor Summary | |
---|---|
protected |
CodingConventions.Proxy(CodingConvention convention)
|
Method Summary | |
---|---|
void |
applyDelegateRelationship(ObjectType delegateSuperclass,
ObjectType delegateBase,
ObjectType delegator,
FunctionType delegateProxy,
FunctionType findDelegate)
In many JS libraries, the function that creates a delegate relationship also adds properties to the delegator and delegate base. |
void |
applySingletonGetter(FunctionType functionType,
FunctionType getterType,
ObjectType objectType)
In many JS libraries, the function that adds a singleton getter to a class adds properties to the class. |
void |
applySubclassRelationship(FunctionType parentCtor,
FunctionType childCtor,
CodingConvention.SubclassType type)
In many JS libraries, the function that produces inheritance also adds properties to the superclass and/or subclass. |
void |
checkForCallingConventionDefiningCalls(Node n,
Map<String,String> delegateCallingConventions)
Checks for function calls that set the calling conventions on delegate methods. |
void |
defineDelegateProxyPrototypeProperties(JSTypeRegistry registry,
Scope scope,
List<ObjectType> delegateProxyPrototypes,
Map<String,String> delegateCallingConventions)
Defines the delegate proxy prototype properties. |
CodingConvention.Bind |
describeFunctionBind(Node n)
A Bind instance or null. |
String |
extractClassNameIfProvide(Node node,
Node parent)
Convenience method for determining provided dependencies amongst different js scripts. |
String |
extractClassNameIfRequire(Node node,
Node parent)
Convenience method for determining required dependencies amongst different js scripts. |
String |
getAbstractMethodName()
Function name for abstract methods. |
Collection<CodingConvention.AssertionFunctionSpec> |
getAssertionFunctions()
Returns the set of AssertionFunction. |
CodingConvention.SubclassRelationship |
getClassesDefinedByCall(Node callNode)
Checks if the given method defines a subclass relationship, and if it does, returns information on that relationship. |
CodingConvention.DelegateRelationship |
getDelegateRelationship(Node callNode)
|
String |
getDelegateSuperclassName()
|
String |
getExportPropertyFunction()
Function name used when exporting properties. |
String |
getExportSymbolFunction()
Function name used when exporting symbols. |
String |
getGlobalObject()
Gets the name of the global object. |
CodingConvention.ObjectLiteralCast |
getObjectLiteralCast(NodeTraversal t,
Node callNode)
Checks if the given method performs a object literal cast, and if it does, returns information on the cast. |
String |
getSingletonGetterClassName(Node callNode)
Checks if the given method defines a singleton getter, and if it does, returns the name of the class with the singleton getter. |
List<String> |
identifyTypeDeclarationCall(Node n)
Checks if the given CALL node is forward-declaring any types, and returns the name of the types if it is. |
boolean |
isConstant(String variableName)
This checks whether a given variable name, such as a name in all-caps should be treated as if it had the @const annotation. |
boolean |
isConstantKey(String keyName)
This checks whether a given key of an object literal, such as a name in all-caps should be treated as if it had the @const annotation. |
boolean |
isExported(String name)
Should be isExported(name, true) || isExported(name, false); |
boolean |
isExported(String name,
boolean local)
Checks whether a global variable or function name should be treated as exported, or externally referenceable. |
boolean |
isOptionalParameter(Node parameter)
This checks whether a given parameter name should be treated as an optional parameter as far as type checking or function call arg count checking is concerned. |
boolean |
isPrivate(String name)
Checks whether a name should be considered private. |
boolean |
isPropertyTestFunction(Node call)
Whether this CALL function is testing for the existence of a property. |
boolean |
isPrototypeAlias(Node getProp)
Whether this GETPROP node is an alias for an object prototype. |
boolean |
isSuperClassReference(String propertyName)
Returns true if passed a string referring to the superclass. |
boolean |
isValidEnumKey(String key)
This checks that a given key may be used as a key for an enum. |
boolean |
isVarArgsParameter(Node parameter)
This checks whether a given parameter should be treated as a marker for a variable argument list function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final CodingConvention nextConvention
Constructor Detail |
---|
protected CodingConventions.Proxy(CodingConvention convention)
Method Detail |
---|
public boolean isConstant(String variableName)
CodingConvention
isConstant
in interface CodingConvention
variableName
- potentially constant variable name
true
if the name should be treated as a constant.public boolean isConstantKey(String keyName)
CodingConvention
isConstantKey
in interface CodingConvention
public boolean isValidEnumKey(String key)
CodingConvention
key
may be used as a key for an enum.
isValidEnumKey
in interface CodingConvention
key
- the potential key to an enum
true
if the key
may be used as an enum key,
false
otherwisepublic boolean isOptionalParameter(Node parameter)
CodingConvention
isOptionalParameter
in interface CodingConvention
parameter
- The parameter's node.
true
if the parameter should be treated as an optional
parameter.public boolean isVarArgsParameter(Node parameter)
CodingConvention
isVarArgsParameter
in interface CodingConvention
parameter
- The parameter's node.
true
if the parameter should be treated as a variable
length parameter.public boolean isExported(String name, boolean local)
CodingConvention
isExported
in interface CodingConvention
name
- A global variable or function name.local
- true
if the name is a local variable.
true
if the name should be considered exported.public final boolean isExported(String name)
CodingConvention
isExported
in interface CodingConvention
public boolean isPrivate(String name)
CodingConvention
isPrivate
in interface CodingConvention
name
- The name of a global variable or function, or a method or
property.
true
if the name should be considered private.public CodingConvention.SubclassRelationship getClassesDefinedByCall(Node callNode)
CodingConvention
getClassesDefinedByCall
in interface CodingConvention
callNode
- A CALL node.public boolean isSuperClassReference(String propertyName)
CodingConvention
isSuperClassReference
in interface CodingConvention
public String extractClassNameIfProvide(Node node, Node parent)
CodingConvention
extractClassNameIfProvide
in interface CodingConvention
public String extractClassNameIfRequire(Node node, Node parent)
CodingConvention
extractClassNameIfRequire
in interface CodingConvention
public String getExportPropertyFunction()
CodingConvention
getExportPropertyFunction
in interface CodingConvention
public String getExportSymbolFunction()
CodingConvention
getExportSymbolFunction
in interface CodingConvention
public List<String> identifyTypeDeclarationCall(Node n)
CodingConvention
identifyTypeDeclarationCall
in interface CodingConvention
public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, CodingConvention.SubclassType type)
CodingConvention
applySubclassRelationship
in interface CodingConvention
public String getAbstractMethodName()
CodingConvention
getAbstractMethodName
in interface CodingConvention
public String getSingletonGetterClassName(Node callNode)
CodingConvention
getSingletonGetterClassName
in interface CodingConvention
callNode
- A CALL node.public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType)
CodingConvention
applySingletonGetter
in interface CodingConvention
public CodingConvention.DelegateRelationship getDelegateRelationship(Node callNode)
getDelegateRelationship
in interface CodingConvention
public void applyDelegateRelationship(ObjectType delegateSuperclass, ObjectType delegateBase, ObjectType delegator, FunctionType delegateProxy, FunctionType findDelegate)
CodingConvention
applyDelegateRelationship
in interface CodingConvention
public String getDelegateSuperclassName()
getDelegateSuperclassName
in interface CodingConvention
public void checkForCallingConventionDefiningCalls(Node n, Map<String,String> delegateCallingConventions)
CodingConvention
checkForCallingConventionDefiningCalls
in interface CodingConvention
public void defineDelegateProxyPrototypeProperties(JSTypeRegistry registry, Scope scope, List<ObjectType> delegateProxyPrototypes, Map<String,String> delegateCallingConventions)
CodingConvention
defineDelegateProxyPrototypeProperties
in interface CodingConvention
delegateProxyPrototypes
- List of delegate proxy prototypes.public String getGlobalObject()
CodingConvention
getGlobalObject
in interface CodingConvention
public Collection<CodingConvention.AssertionFunctionSpec> getAssertionFunctions()
CodingConvention
getAssertionFunctions
in interface CodingConvention
public CodingConvention.Bind describeFunctionBind(Node n)
CodingConvention
describeFunctionBind
in interface CodingConvention
public boolean isPropertyTestFunction(Node call)
CodingConvention
isPropertyTestFunction
in interface CodingConvention
public boolean isPrototypeAlias(Node getProp)
CodingConvention
isPrototypeAlias
in interface CodingConvention
public CodingConvention.ObjectLiteralCast getObjectLiteralCast(NodeTraversal t, Node callNode)
CodingConvention
getObjectLiteralCast
in interface CodingConvention
t
- The node traversal.callNode
- A CALL node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |