by
0
6
2,703
1
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 5743rd place

Published on:

LanguageJava
LicenseMIT_X11

Ethernet java class - Integration of JPA and JAXB Java classes

The class extends the abstract Port class, integratin both JPA and JAX-B java api.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/43635/Ethernet-java-class---Integration-of-JPA?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
package com.examples.jpa; import javax.persistence.Column; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @Entity @Table(name = "ETHERNET_PORT") @DiscriminatorValue("ETHERNET") @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name="eth-port") public class EthernetPort extends Port { @XmlElement(name = "mtu") @Column(name = "MTU_SIZE") private int mtuSize; @Column(name = "SPEED") @XmlElement(name = "speed") private int speed; @XmlElement(name = "auton") @Column(name = "AUTONEGOTATION") private boolean autonegotiation; public EthernetPort() { } public EthernetPort(String label) { super(label); } public EthernetPort(String label, int mtuSize, int speed, boolean autonegotiation) { super(label); this.mtuSize = mtuSize; this.speed = speed; this.autonegotiation = autonegotiation; } public int getMtuSize() { return mtuSize; } public void setMtuSize(int mtuSize) { this.mtuSize = mtuSize; } public int getSpeed() { return speed; } public void setSpeed(int speed) { this.speed = speed; } public boolean isAutonegotiation() { return autonegotiation; } public void setAutonegotiation(boolean autonegotiation) { this.autonegotiation = autonegotiation; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "EthernetPort [mtuSize=" + mtuSize + ", speed=" + speed + ", autonegotiation=" + autonegotiation + "]"; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus