modules/graphics/src/main/java/javafx/css/Declaration.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
@@ -21,29 +21,30 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package com.sun.javafx.css;
+package javafx.css;
-import com.sun.javafx.css.converters.URLConverter;
-import javafx.css.ParsedValue;
-import javafx.css.StyleConverter;
-import javafx.css.StyleOrigin;
+import com.sun.javafx.css.ParsedValueImpl;
+import javafx.css.converter.URLConverter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
+/**
+ * @since 9
+ */
final public class Declaration {
final String property;
- final ParsedValueImpl parsedValue;
+ final ParsedValue parsedValue;
final boolean important;
// The Rule to which this Declaration belongs.
Rule rule;
- public Declaration(final String propertyName, final ParsedValueImpl parsedValue,
+ Declaration(final String propertyName, final ParsedValue parsedValue,
final boolean important) {
this.property = propertyName;
this.parsedValue = parsedValue;
this.important = important;
if (propertyName == null) {
@@ -57,26 +58,21 @@
/** @return ParsedValue contains the parsed declaration. */
public ParsedValue getParsedValue() {
return parsedValue;
}
- /** @return ParsedValue contains the parsed declaration. */
- ParsedValueImpl getParsedValueImpl() {
- return parsedValue;
- }
-
/** @return The CSS property name */
public String getProperty() {
return property;
}
/** @return The Rule to which this Declaration belongs. */
public Rule getRule() {
return rule;
}
- public boolean isImportant() {
+ boolean isImportant() {
return important;
}
/** Helper */
private StyleOrigin getOrigin() {
@@ -89,12 +85,11 @@
/**
* One declaration is the equal to another regardless of the Rule to which
* the Declaration belongs. Only the property, value and importance are
* considered.
*/
- @Override
- public boolean equals(Object obj) {
+ @Override public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
@@ -116,12 +111,11 @@
return false;
}
return true;
}
- @Override
- public int hashCode() {
+ @Override public int hashCode() {
int hash = 5;
hash = 89 * hash + (this.property != null ? this.property.hashCode() : 0);
hash = 89 * hash + (this.parsedValue != null ? this.parsedValue.hashCode() : 0);
hash = 89 * hash + (this.important ? 1 : 0);
return hash;
@@ -168,17 +162,19 @@
}
}
- final void writeBinary(final DataOutputStream os, final StringStore stringStore)
+ final void writeBinary(final DataOutputStream os, final StyleConverter.StringStore stringStore)
throws IOException
{
+ if (parsedValue instanceof ParsedValueImpl) {
os.writeShort(stringStore.addString(getProperty()));
- getParsedValueImpl().writeBinary(os,stringStore);
+ ((ParsedValueImpl)parsedValue).writeBinary(os,stringStore);
os.writeBoolean(isImportant());
}
+ }
static Declaration readBinary(int bssVersion, DataInputStream is, String[] strings)
throws IOException
{
final String propertyName = strings[is.readShort()];