Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/ast/ObjectProperty.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript.ast;
import org.mozilla.javascript.Token;
/**
* AST node for a single name:value entry in an Object literal. For simple entries, the node type is
* {@link Token#COLON}, and the name (left side expression) is either a {@link Name}, a {@link
* StringLiteral}, a {@link NumberLiteral} or a {@link BigIntLiteral}.
*
* <p>This node type is also used for getter/setter properties in object literals. In this case the
* node bounds include the "get" or "set" keyword. The left-hand expression in this case is always a
* {@link Name}, and the overall node type is {@link Token#GET} or {@link Token#SET}, as
* appropriate. The {@code operatorPosition} field is meaningless if the node is a getter or setter.
*
* <pre><i>ObjectProperty</i> :
* PropertyName <b>:</b> AssignmentExpression
* <i>PropertyName</i> :
* Identifier
* StringLiteral
* NumberLiteral
* BigIntLiteral</pre>
*/
public class ObjectProperty extends InfixExpression {
{
type = Token.COLON;
}
/**
* Sets the node type. Must be one of {@link Token#COLON}, {@link Token#GET}, or {@link
* Token#SET}.
*
* @throws IllegalArgumentException if {@code nodeType} is invalid
*/
public void setNodeType(int nodeType) {
if (nodeType != Token.COLON
&& nodeType != Token.GET
&& nodeType != Token.SET
&& nodeType != Token.METHOD)
throw new IllegalArgumentException("invalid node type: " + nodeType);
setType(nodeType);
}
public ObjectProperty() {}
public ObjectProperty(int pos) {
super(pos);
}
public ObjectProperty(int pos, int len) {
super(pos, len);
}
/** Marks this node as a "getter" property. */
public void setIsGetterMethod() {
type = Token.GET;
}
/** Returns true if this is a getter function. */
public boolean isGetterMethod() {
return type == Token.GET;
}
/** Marks this node as a "setter" property. */
public void setIsSetterMethod() {
type = Token.SET;
}
/** Returns true if this is a setter function. */
public boolean isSetterMethod() {
return type == Token.SET;
}
public void setIsNormalMethod() {
type = Token.METHOD;
}
public boolean isNormalMethod() {
return type == Token.METHOD;
}
public boolean isMethod() {
return isGetterMethod() || isSetterMethod() || isNormalMethod();
}
@Override
public String toSource(int depth) {
StringBuilder sb = new StringBuilder();
sb.append("\n");
sb.append(makeIndent(depth + 1));
if (isGetterMethod()) {
sb.append("get ");
} else if (isSetterMethod()) {
sb.append("set ");
}
sb.append(left.toSource(getType() == Token.COLON ? 0 : depth));
if (type == Token.COLON) {
sb.append(": ");
}
sb.append(right.toSource(getType() == Token.COLON ? 0 : depth + 1));
return sb.toString();
}
}
⏎ org/mozilla/javascript/ast/ObjectProperty.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈208🔥, 1💬
Popular Posts:
What Is poi-examples-5.2.3.jar? poi-examples-5.2.3.jar is one of the JAR files for Apache POI 5.2.3,...
JDK 17 jdk.internal.le.jmod is the JMOD file for JDK 17 Internal Line Editing module. JDK 17 Interna...
xml-commons External Source Code Files are provided in the source package file, xml-commons-external...
layout.jar is a component in iText Java library to provide layout functionalities. iText Java librar...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...