Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit 1a652db

Browse files
committed
Create interfaces for remaining value types
1 parent 429512c commit 1a652db

6 files changed

Lines changed: 117 additions & 13 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2018 ImpactDevelopment
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package clientapi.value;
18+
19+
import pw.knx.feather.structures.Color;
20+
21+
/**
22+
* @author Brady
23+
* @since 9/27/2018
24+
*/
25+
public interface IColorValue extends IValue<Color> {
26+
27+
default float getRed() {
28+
return this.getValue().getRed();
29+
}
30+
31+
default float getGreen() {
32+
return this.getValue().getGreen();
33+
}
34+
35+
default float getBlue() {
36+
return this.getValue().getBlue();
37+
}
38+
39+
default float getHue() {
40+
return this.getValue().getHue();
41+
}
42+
43+
default float getSaturation() {
44+
return this.getValue().getSaturation();
45+
}
46+
47+
default float getBrightness() {
48+
return this.getValue().getBrightness();
49+
}
50+
51+
default int getHex() {
52+
return this.getValue().getHex();
53+
}
54+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2018 ImpactDevelopment
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package clientapi.value;
18+
19+
/**
20+
* @author Brady
21+
* @since 9/27/2018
22+
*/
23+
public interface IStringValue extends IValue<String> {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2018 ImpactDevelopment
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package clientapi.value;
18+
19+
/**
20+
* @author Brady
21+
* @since 9/27/2018
22+
*/
23+
public interface IVoidValue extends IValue<Void> {
24+
25+
@Override
26+
default Void getValue() {
27+
return null;
28+
}
29+
30+
@Override
31+
default void setValue(Void value) {
32+
throw new UnsupportedOperationException("Attempted to set the value of an IVoidValue");
33+
}
34+
}

src/main/java/clientapi/value/type/ColorType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package clientapi.value.type;
1818

19+
import clientapi.value.IColorValue;
1920
import clientapi.value.Value;
2021
import clientapi.value.annotation.ColorValue;
2122
import pw.knx.feather.structures.Color;
@@ -30,7 +31,7 @@
3031
* @author Brady
3132
* @since 4/11/2018
3233
*/
33-
public final class ColorType extends Value<Color> {
34+
public final class ColorType extends Value<Color> implements IColorValue {
3435

3536
public ColorType(String name, String parent, String id, String description, Object object, Field field) {
3637
super(name, parent, id, description, object, field);

src/main/java/clientapi/value/type/StringType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package clientapi.value.type;
1818

19+
import clientapi.value.IStringValue;
1920
import clientapi.value.Value;
2021
import clientapi.value.annotation.StringValue;
2122

@@ -29,7 +30,7 @@
2930
* @author Brady
3031
* @since 1/23/2017
3132
*/
32-
public final class StringType extends Value<String> {
33+
public final class StringType extends Value<String> implements IStringValue {
3334

3435
public StringType(String name, String parent, String id, String description, Object object, Field field) {
3536
super(name, parent, id, description, object, field);

src/main/java/clientapi/value/type/VoidType.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package clientapi.value.type;
1818

19+
import clientapi.value.IVoidValue;
1920
import clientapi.value.Value;
2021
import clientapi.value.annotation.VoidValue;
2122

@@ -30,19 +31,9 @@
3031
* @author Brady
3132
* @since 8/21/2018
3233
*/
33-
public final class VoidType extends Value<Void> {
34+
public final class VoidType extends Value<Void> implements IVoidValue {
3435

3536
public VoidType(String name, String parent, String id, String description, Object object, Field field) {
3637
super(name, parent, id, description, object, field);
3738
}
38-
39-
@Override
40-
public Void getValue() {
41-
return null;
42-
}
43-
44-
@Override
45-
public void setValue(Void value) {
46-
throw new UnsupportedOperationException("Attempted to set the value of a VoidType");
47-
}
4839
}

0 commit comments

Comments
 (0)